how to do data frames [closed]
I need to arrange some data in R. trt, type, day1, day2, day3, etc. but for each day I have percentage values. How do I arrange these so that I could have plots y=percentage value, x=days and trt and...
View ArticleHow to avoid the ambiguous overloaded operator problem when using list and...
GoalThe code below is a very simplified version of my original code for creating a reproducible example. In this code, I am trying to generate a vector that is filled up by using 2 values in each...
View Articlefor loop a non-parametric test filtered by year and save each year's result...
I'm trying to create and print a list of data frames that are the result of the Mann-Whitney-Wilcoxon Test. My code currently runs the Mann-Whitney-Wilcoxon Test on all the observations and compares...
View ArticleLimit Command in R?
What is the take a limit command or function in R? (I could not find it by searching using ? and ?? functions or in introductory manuals. lim() and limit() do not exist.)This is in the sense of limit...
View ArticleHow come I am able to pass a dataframe into 'dparams' argument in 'geom_qq'...
How come I am able to pass a dataframe into the dparams argument of the geom_qq function, when it is specified as a list type argument?Is it because a dataframe is technically a list of equal length...
View ArticleRolling sum with inequality conditionals
I'm working with some historical financial data from multiple companies.My data.frames/tables have the following form:library(data.table) dt <- data.table(company = rep(1:2, each = 9), period = c(1,...
View ArticleConverting factor variables to numeric ones by replacing blanks cells to NA...
This question already has an answer here:How to convert a factor to integer\numeric without loss of information? 8 answersI want to convert some factor variables to numeric variables by this code:...
View ArticleGenerating dynamic .tabset in Rmarkdown
I wanna create 3 .tabsets, one per level of Species on the Iris Dataset (example). On each .tabset, a want 3 or more tabs. Each tab will have your own plot.I wrote this code:```{r echo=FALSE,...
View Article[R6]Error in as.vector(x, "symbol") : cannot coerce type 'environment' to...
I use my R6 object and funcion in the following codeTest = R6Class( "test", public = list( y_name = NA, initialize = function(y_name){ self$y_name = y_name } ) ) someAnalysis = function(tbl, y_name =...
View ArticleApply different sf functions to groups in a data frame
I'm trying to calculate different Euclidean buffers (one 400m and one 800m) within a single simple features data frame using a set of piped dplyr function calls. The buffer distance should be specified...
View ArticleReplace conditional panel logic with reactive panels with renderUI()
I have the shiny app below in which the user selects the inputs from the 2 widgets in tabpanel ONE and Number of drills and Select Players for Training Session. If Number of Drills==1 then the table in...
View ArticleHow to properly fit a four parameter self-starting function on nls model
data <- read.table("c:\\temp\\chicks.txt",header=T) attach(data) names(data) [1] "weight""Time" model <- nls(weight~SSfpl(Time, a, b, c, d)) xv <- seq(0,22,.2) yv <-...
View Articlegeom_boxplot gave wrong whiskers
I am making a boxplot using geom_boxplot in ggplot2. However, I found the whiskers length is not correct and I don't know why. Here is my data:value =...
View ArticleIs there a command character to pass "CTRL+8" to the console?
I am setting up my .Rprofile and I would like Rstudio to open the environment tab on open.I am looking for something like the cat("\014") command that clears the console.Function to clear the console...
View ArticleR- melting groups of columns from survey data -understanding how R(gather) works
New to code in general and have been through hundreds of google searches and stackoverflow threads but nothing yet really explains how my solution works. There are many ways to melt data, most appear...
View ArticleChange legend labels in ggcompetingrisks plot in r
I have made a cumulative incidence plot using cmprsk::cuminc and then ggcompetingrisks for plotting. I want to change legend labels for the group. I've tried with legend.lab = c("A", "B", "C"). This...
View ArticlePut Autoarima summary results in data frame R
I am running several regression models and desire to have the results in a data frame. I tried several methods they have been unsuccessful.Series <- ts(DATA[,2],start = c(2012,9), end =...
View ArticleSine Fitting in MatLab and R
I am working on translating code from MatLab into R, however I am completely new to MatLab. I am having trouble understanding how what is happening in the MatLab code and how I can translate this to R....
View ArticleHow to create an linear model output with clustered (by firms) standard error...
[https://1drv.ms/u/s!ArUNQ8J4vgGqhe8IAVP0ulapoEv4uQ?e=wRMEWN][1]m1_1 <- lm(ROA ~ fam_ownership + lag_investment + dual_class + age + crisis , na.action=na.exclude, data) m1_2 <- lm(ROA ~...
View ArticleR group_by() + rleid() equivalent in Python
I've got a following data frame in Python:df = pd.DataFrame.from_dict({'measurement_id': np.repeat([1, 2], [6, 6]), 'min': np.concatenate([np.repeat([1, 2, 3], [2, 2, 2]), np.repeat([1, 2, 3], [2, 2,...
View Article