search for: x_name

Displaying 6 results from an estimated 6 matches for "x_name".

Did you mean: __name
2017 Sep 09
0
Avoid duplication in dplyr::summarise
...only mean of X values as function of factors f1 and f2. library(tidyverse) library(psych) df <- data.frame(matrix(rnorm(40), 10, 4), f1 = gl(3, 10, labels = letters[1:3]), f2 = gl(3, 10, labels = letters[4:6])) ##To get all summary of your data df%>% gather(X_name,X_value,X1:X4)%>% group_by(f1,f2,X_name)%>% do(describe(.$X_value)) ##To obtain only means of your data df%>% gather(X_name,X_value,X1:X4)%>% group_by(f1,f2,X_name)%>% do(describe(.$X_value))%>% select(mean)%>%# You select only mean value spread(X_name,mean)# Vinc...
2017 Sep 09
2
Avoid duplication in dplyr::summarise
Dear group, Is there a way I could avoid the sort of duplication illustrated below? i.e., I have the same dplyr::summarise function on different group_by arguments. So I'd like to create a single summarise function that could be applied to both. My attempt below fails. df <- data.frame(matrix(rnorm(40), 10, 4), f1 = gl(3, 10, labels = letters[1:3]), f2 =
2017 Sep 09
1
Avoid duplication in dplyr::summarise
...s f1 and f2. > > library(tidyverse) > library(psych) > df <- data.frame(matrix(rnorm(40), 10, 4), > f1 = gl(3, 10, labels = letters[1:3]), > f2 = gl(3, 10, labels = letters[4:6])) > > ##To get all summary of your data > df%>% gather(X_name,X_value,X1:X4)%>% > group_by(f1,f2,X_name)%>% > do(describe(.$X_value)) > > ##To obtain only means of your data > df%>% gather(X_name,X_value,X1:X4)%>% > group_by(f1,f2,X_name)%>% > do(describe(.$X_value))%>% > select(mean)%>%# You select only...
2011 Jan 26
1
boxplot - code for labeling outliers - any suggestions for improvements?
...- Handle cases of complex functions (e.g: boxplot(y~a*b)) - Handle cases where there are many outliers leading to a clutter of text (to this I have no idea how to systematically solve) Best, Tal ------------------------------ # the function boxplot.add.outlier.text <- function(DATA, x_name, y_name, label_name) { boxplot.outlier.data <- function(xx, y_name) { y <- xx[,y_name] boxplot_range <- range(boxplot.stats(y)$stats) ss <- (y < boxplot_range[1]) | (y > boxplot_range[2]) return(xx[ss,]) } require(plyr) txt_to_run <- paste("ddply(DATA, .(",x_name...
2006 Feb 08
2
rotating axis / mtext labels
Hello list. Is it possible to use par(srt=45) to rotate text by 45 degrees along the x-axis of a plot. Using: <code> x_names<-c("C57 Nv", "C57 Vacc", "129 Nv", "129 Vacc", "IFNgR Nv", "IFNgR Vacc") par(srt=45) mtext(font=2, x_names, side=1, line=1, at=l, cex=1.2) par(srt=0) </code> doesn't seem to work in R 2.2.0 on SUSE linux. Suggestions would...
2011 Jan 24
1
How to measure/rank ?variable importance when using rpart?
--- included message ---- Thus, my question is: *What common measures exists for ranking/measuring variable importance of participating variables in a CART model? And how can this be computed using R (for example, when using the rpart package)* ---end ---- Consider the following printout from rpart summary(rpart(time ~ age + ph.ecog + pat.karno, data=lung)) Node number 1: 228 observations,