How do I had an alias for magrittr pipe from R in vscode
I would like an alias for typing %>% in vscode (the pipe command in R) . In Rstudio this is mapped to ctrl + shift + M, but if this is not available in vscode for any reason I am happy to map to...
View ArticleHow to find a solution for a non-linear equation in python using ifelse...
I am encountering a problem solving a nonlinea equation using nsolve from the python simpy package, this problem was easily solved in R, below the code I use in R and what I am trying in python:R :...
View ArticleDiagnose a memory leak in C++ code forming part of an R package, on Windows
I am writing an R package that includes C++ code, written by an external developer who is unable to help out. The C++ code currently appears to have a memory leak: R's memory usage keeps increasing...
View ArticleIs there a function to convert multiple observations to a single one,...
This question already has an answer here:Repeat each row of data.frame the number of times specified in a column 7 answersI have a data.frame that looks like this: abun biomass size_cm 1 4 2351.85 35 2...
View Articlesplit strings in n columns of a data frame in R
I have the following data frame (actual data has a larger number of columns):df <- data.frame( l1=c(ind1='000000',ind2='100100'), l2=c(ind1='200204',ind2='124124'),...
View Articlecount_if (EXPSS) with multiple conditions in R
I am using expss::count_if.While something like this works fine (i.e., counting values only where value is equal to "1"):(number_unemployed = count_if("1",unemployed_field,na.rm = TRUE)), This does not...
View Article"reached elapsed time limit" errors in R
I keep getting "reached elapsed time limit" errors in R. I'm using studio. This is the code I am trying to run, a simple graph in ggplot:require(ggplot2) docgraph <- ggplot(data = plotnvto,...
View ArticleComplex Reshaping of Data Frame, tracking record edits
I have a data frame that tracks whenever a project's record was edited, the time of the edit, what field was edited, the old value, and the new value. Columns OrderDate, Probability, and Total display...
View ArticleInlcude windspeed and pollution in pollutionrose
I would like to include the wind speed and the pollution variable together in one pollutionrose or windrose. The function windrose() or pollutionrose() only enables to include data series instead of...
View ArticleR's dbConnect fails with "DSN error" when executed by script called from...
I have 64 bit R, version 3.6.0, installed on my windows 10 machine.I use the following code to establish a connection to the local MySQL database on my machinelibrary(DBI) con <- dbConnect(...
View ArticleQ: Index in sequence with reset [R/dplyr]
Just new to R and programming in general; I'm trying to count the number of rows observed with value > N within each group until values >= are observed, at which point, the count resets.data...
View ArticleHeader in Rmarkdown is showing in a wrong format
In the html report, It is looking like thisWhat could be the problem here?...Header is not showing in a required format
View ArticleAlgorithm for best sum combination from 3 groups list
I have multi group of data like: X <- c(2,3,5,10,15) Y <- c(4,6,23,15,12) Z <- c(23,34,12,1,5) and a target: target = 50I want to know the best (for example): 2 values from X (call it X2), 4...
View ArticleR: Encoding tickbox answers from surveys to dummy variables
Google Forms outputs the survey answers for tickbox questions (i.e. multiple answers can be ticked in a single question) as a single variable with the ticked answers separated by a semicolon.I now want...
View ArticleDegrees of freedom ezANOVA after sphericity correction
I've set up an ANOVA with the function ezANOVA from the package ez. There are sphericity corrections and I see different p-values because of the different degrees of freedom. But how can I see the new...
View Articlefacet_wrap text labelling issues with stat_fit_glance
I am wondering why the text is trending higher in the plots... it won't stay put with the facet_wrap or facet_grid. In a more complex dataset plot, the text is illegible because of the overlap. Below...
View ArticleHow do I find the max of one column with a condition linked to another column
Using the nycflights13 dataset, I want to find, using R, which flight was the latest in each month; in other words, the flight with the largest departure delay in each month.The code I've used:flights...
View ArticleError when trying to use one_hot encoding
I know this may be a potential duplicate question, but I found other answers didn't work in my situation. I am using the following dataset:> str(total_data) 'data.frame': 32260 obs. of 13 variables:...
View ArticleUsing relevant position in a vector to find index
I have a vector for each participant in a study that describes their eating periods. For example Participant 1 and 2 respectively have> eating.period.1 [1] "Day 1 (1/18/15)"" Breakfast"" Morning...
View ArticleAdd Label only for eigenvector>10 in ggplot2
I have the following code for a network graph:How to display in the network graph only when eigenvector >10? When I write label=NOT1Geig>10, it says TRUE OR FALSE on the network graphThanks!!!
View Article