Quantcast
Browsing all 206152 articles
Browse latest View live

Search strings from dict within a data table column values

There is a data.table dt with a column with text sentences in each row (dt$text). Then, there is a dictionary with words (smaller data.table with phrases column: dict$word and lookup_n column with a...

View Article


Levene Test for two groups with different length

I have two different groups with different ages in it, and I would like to compare variance by Levene test but it didn't work.leveneTest(Total_Dem$age~Total_Rep$age)The output was Error in...

View Article


Extracting N number of matches from a text string in RStudio?

I am using stringr in R, and I have a string of text that lists titles of news articles. I want to extract these titles, but only the first N-number of titles that appear. In my example string of text,...

View Article

Replacing NA's with values from another row, conditional on a specific...

I have a data.table with currencies (let's say in USD) as follows, which has NA's after the country has switched to EUR. In addition, I have the year in which the currency switches to...

View Article

How can i pass the input text to the filter component in my React application

I am trying to build an application using "rick and morty API" where there is list of characters with various parameters such as gender,alive status,image etc.What i am trying to do: 1) I am trying to...

View Article


Adding new row to dataframe with group by and summarise

I want to group my df by three columns and add a new row which will be a sum of a fourth column. My data looks like fc <- c("F", "F", "E", "E", "TF", "TF") group_code <- c("Egg_x", "Egg_y",...

View Article

One slider controlling multiple subplots in R

I want to use one slider to control multiple subplots created with plotly. I found answers in Python like these two:Plot.ly. Using slider control with multiple...

View Article

TidyR Separate: last occurence of underscore [duplicate]

This question already has an answer here:Split Character String Using Only Last Delimiter in r 2 answersI have a column with these values:gene_id ENSG00000228572.7_PAR_Y_AL954722.1...

View Article


Image may be NSFW.
Clik here to view.

How to count the frequency of lines in a file

I have the following txt file:Test-case: 1 -------------------- int int0 = (-1790); String string0 = "14_d4BWMJqn"; MethodVisitor methodVisitor0 = mock(MethodVisitor.class, new...

View Article


Usings multiple conditions in select (dplyr)

I want to choose certain columns of a dataframe with dplyr::select() using contains() more than ones. I know there are other ways to solve it, but I wonder whether this is possible inside select(). An...

View Article

How can I create a function that creates a matrix using values from my...

I have a dataset containing 120 observations of 6 variables. Five variables are factors, 1 variable is my target variable. I need to write a function that will creates a matrix (for each factor) which...

View Article

I'm a complete beginner! How to I convert a .txt file (film script) to a...

I'm a complete beginner, and for a project for college I need to analyse film scripts. I want to create a table in which I can match the characters to their lines. My files are all in .txt format and...

View Article

Differences between R's and Numpy's QR decomposition

I'm working through a large R (v3.6.0) codebase and trying to understand what it is doing. To do this, I'm translating some of the R code into Python (v3.6.5) using Numpy (v1.14.3). I have a piece of R...

View Article


How can I find the smallest possible sample size n to ensure my probability...

I have a vector of 0s and 1s where a 0 is a failure and 1 is a success. Using a sample of this vector, I want to find the smallest sample such that I determine a probability of a success to be within...

View Article

split data and re-arrange values based on split number

I have this data: row col [1,] 1 1 [2,] 7 1 [3,] 2 2 [4,] 7 2 [5,] 18 2 [6,] 3 3 [7,] 4 4 [8,] 5 5 [9,] 19 5 [10,] 6 6 [11,] 1 7 [12,] 2 7 [13,] 7 7 [14,] 18 7 [15,] 8 8 [16,] 9 9 [17,] 10 10 [18,] 11...

View Article


Remove NA in a data.table in R

I'm trying to do in R something apparently very easy (sorry but i'm very newbie with data.tables) but I don't manage to get the right solution. I try to delete the rows with NA values on a specific...

View Article

Issue on loading tidyverse through R Script

When trying to load the tidyverse package in R Script, I get the following error message:library(tidyverse) -- Attaching packages -------------------------------------------------tidyverse 1.2.1 -- v...

View Article


Ridge plot curves not appearing in plot in r

I'm trying to recreate this ridge plot:https://i.stack.imgur.com/QAFs1.jpgHowever, I can't seem to be able to get the curves to show up on the plot, As you may have guessed I'm very new to r, so I...

View Article

R function to import text data in predefined Document Term Matrix

I have imported some text data regarding description of some products. That text data was transformed to corpus, made some data preprocessing and finally transfer it to Document Term Matrix (as data...

View Article

Using SQL like '%word%' in R

I want to find the word bank and banco in a specific variable. In SQL I would use:WHERE Name in ('%banco%','%bank%') This is my exact query:transacciones_diarias%>%mutate(TIPO_CAMBIO_POOL =...

View Article
Browsing all 206152 articles
Browse latest View live