similar to: aggregate function - na.action

Displaying 20 results from an estimated 50000 matches similar to: "aggregate function - na.action"

2018 Mar 14
2
truncation/rounding bug with write.csv
I don't see the issue here. It would be helpful if people would report their sessionInfo() when reporting whether or not they see this issue. Mine is > sessionInfo() R version 3.4.3 (2017-11-30) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Arch Linux Matrix products: default BLAS/LAPACK: /usr/lib/libopenblas_haswellp-r0.2.20.so locale: [1] LC_CTYPE=en_US.UTF-8
2010 Mar 20
2
summated scale
hello, I am new to R (convert from Stata) and I am wondering if there is an R command/function for generating a summated scale from, for example, four separate variables in a data set. In other words, I want to transform the variables x1, x2, x3, and x4 (which have high inter-item reliability) into one new summated variable x'. Can't seem to find it in the psy or psych package ...
2011 Jul 25
4
ggplot question: changing the label for the Y axis on a histogram
Some help with how to re-label the vertical axis in a histogram would be appreciated. qplot(off.sc,weight=rel.freq,binwidth=.29,main="test Figure"+ylab("New from inside"))+ylab("New from outside")+ xlab("off.sc\nAggregated frequency plots for 17 equal intervals.") The code
2010 Apr 19
2
How to pass a list of parameters into a function
Does anyone know how to pass a list of parameters into a function? for example: somefun=function(x1,x2,x3,x4,x5,x6,x7,x8,x9){ ans=x1+x2+x3+x4+x5+x6+x7+x8+x9 return(ans) } somefun(1,2,3,4,5,6,7,8,9) # I would like this to work: temp=c(x3=3,x4=4,x5=5,x6=6,x7=7,x8=8,x9=9) somefun(x1=1,x2=2,temp) # OR I would like this to work: temp=list(x3=3,x4=4,x5=5,x6=6,x7=7,x8=8,x9=9)
2006 Oct 18
6
new R-user needs help
Dear all, I have a dataset Exp name id x1 x2 x3 x4 x5 1 a 1 23 24 23 22 30 1 b 2 25 26 27 23 24 1 c 3 32 19 23 25 28 2 a 4 28 32 24 26 27 2 b 5 23 24 25 26 28 2 c 6 23 31 30 38 23 3 a 7 24 25 31 27 29 3 b 8 28 25 26 32 28 3 c 9 21 31 28 23 29 where each name a,b and c is repeated three times. Now I want to calculate the the averages of
2008 Mar 29
1
Tabulating Sparse Contingency Table
I have a sparse contingency table (most cells are 0): > xtabs(~.,data[,idx:(idx+4)]) , , x3 = 1, x4 = 1, x5 = 1 x2 x1 1 2 3 1 0 0 31 2 0 0 112 3 0 0 94 , , x3 = 2, x4 = 1, x5 = 1 x2 x1 1 2 3 1 0 0 0 2 0 0 0 3 0 0 0 , , x3 = 3, x4 = 1, x5 = 1 x2 x1 1 2 3 1 0 0 0 2 0 0 0 3 0 0 0 , , x3 = 1, x4
2010 Apr 01
1
Factorial regression with multiple features: how to remove non-significant features?
Hello all, I am trying to do factorial regression using lm() like this (example): model<-lm(y ~ x1 + x2 + x3 + x4 + x1*x2*x3*x4) The final term 'x1*x2*x3*x4' adds all possible interactions between explanatory variables to the model. i.e. x1:x2, x1:x2:x3, etc, etc. Now, the issue is that some of the interactions are significant and some are not. I can manually remove
2017 Sep 19
3
what do you think about write.table(... qmethod = "excel")?
Last week one of our clients reported trouble with a csv file I generated with write.table. He said that columns with quotes for character variables were rejected by their data importer, which was revised to match the way Microsoft Excel uses quotation marks in character variables. I explained to them that quoted character variables are virtuous and wise, of course, but they say Microsoft Excel
2018 Feb 20
3
Take the maximum of every 12 columns
This is what I was looking for. Thank you everyone! Sincerely, Milu <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> Mail priva di virus. www.avast.com <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
2013 Sep 25
3
ayuda con aggregate
Hola Juan. ¿Si yo en vez de querer obtener la media quiero sacar el porcentaje de casos que son menores que la media como lo haría? Saludos, Sebastián. El 17 de septiembre de 2013 03:34, Joan Carmona <jcmld@carmonarocha.com>escribió: > Hola Sebastián, > > Qué tal así:? > > > t<-data.frame(A=c(1,2,3,4,5,6,7,8,9,10),B=c(1,1,2,2,3,3,4,4,5,5),C=c(1,1,1,1 > >
2013 Sep 16
3
ayuda con aggregate
Estimados usuarios de R: Estoy aprendiendo a usar el comando aggregate. Por ejemplo tengo la siguiente tabla: A B C X1 X2 X3 X4 1 1 1 10 0,333333333 25 1 2 1 1 20 1,818181818 36 1 3 2 1 30 1,428571429 46 1 4 2 1 11 0,35483871 26 2 5 3 2 21 1,75 37 2 6 3 2 31 1,409090909 47 2 7 4 2 12 0,375 27 3 8 4 2 22 1,692307692 38 3 9 5 3 32 3,2 50 3 10 5 3 13 0,65 28 3 Yo quiero agrupar usando como
2018 Feb 20
2
Take the maximum of every 12 columns
On Tue, Feb 20, 2018 at 11:58 AM, Bert Gunter <bgunter.4567 at gmail.com> wrote: > Ista, et. al: efficiency? > (Note: I needed to correct my previous post: do.call() is required for > pmax() over the data frame) > > > x <- data.frame(matrix(runif(12e6), ncol=12)) > > > system.time(r1 <- do.call(pmax,x)) > user system elapsed > 0.049 0.000
2018 Feb 20
0
Take the maximum of every 12 columns
Ista, et. al: efficiency? (Note: I needed to correct my previous post: do.call() is required for pmax() over the data frame) > x <- data.frame(matrix(runif(12e6), ncol=12)) > system.time(r1 <- do.call(pmax,x)) user system elapsed 0.049 0.000 0.049 > identical(r1,r2) [1] FALSE > system.time(r2 <- apply(x,1,max)) user system elapsed 2.162 0.045 2.207 ##
2013 Sep 26
2
ayuda con aggregate
Estimados: Dentro del aggregate utilice un table, son cuatro los valores que puede tomar la variable, ¿como puedo desarmar la lista y crear cuatro variables nuevas donde le asigne 0 si no se da ese valor? Saludos, Sebastián. El 25 de septiembre de 2013 10:41, Jorge I Velez <jorgeivanvelez@gmail.com>escribió: > Sebastián, > > Una forma es > > aggregate(cbind(X1,X2) ~ B +
2005 Jun 07
1
Help with possible bug (assigning NA value to data.frame) ?
There's something peculiar that I do not understand here. However, did you realize that the thing you are assigning into parts of `a' is NULL? Check you're my.test.boot.ci.1: It's NULL. Be that as it may, I get: > a <- data.frame(matrix(1:4, nrow=2), X3=NA, X4=NA) > a X1 X2 X3 X4 1 1 3 NA NA 2 2 4 NA NA > a[a$X1 == 1,]$X3 <- NULL > a X1 X2 X3 X4 1 1
2011 Mar 14
1
Math characters in column heading using latex() in Hmisc
Hi Everybody I want to print a latex table containing math characters in the column heading These are the formulae I want to use as column headings. It prints OK from TeX $\sum_{i}\sum_{j}C_{P,i,j,y}\times\mathit{FC}_{i}$, $XU_{alt,y}$, $n$, $\bar{C}_{P,y}$ My plan was to create a character vector with these and later rbind the values to them. When I create the vector like:
2013 Apr 13
1
how to add a row vector in a dataframe
Hi, Using S=1000 and simdata <- replicate(S, generate(3000)) #If you want both "m1" and "m0" #here the missing values are 0 res1<-sapply(seq_len(ncol(simdata.psm1)),function(i) {x1<-merge(simdata.psm0[,i],simdata.psm1[,i],all=TRUE); x1[is.na(x1)]<-0; x1}) res1[,997:1000] #????? [,1]???????? [,2]???????? [,3]???????? [,4]??????? #x1??? Numeric,3000 Numeric,3000
2012 Apr 20
1
predictOMatic for regression. Please try and advise me
I'm pasting below a working R file featuring a function I'd like to polish up. I'm teaching regression this semester and every time I come to something that is very difficult to explain in class, I try to simplify it by writing an R function (eventually into my package "rockchalk"). Students have a difficult time with predict and newdata objects, so right now I'm
2012 Sep 12
3
how to create a substraction matrix (subtract a row of every column from the same row in other columns)
Hello I have data like this x1 x2 x3 x4 x5 I want to create a matrix similar to a correlation matrix, but with the difference between the two values, like this x1 x2 x3 x4 x5 x1 x2-x1 x3-x1 x4-x1 x5-x1 x2 x3-x2 x4-x2 x5-x2 x3 x4-x3 x5-x3 x4 x5-x4 x5 Then I
2017 Aug 22
1
boot.stepAIC fails with computed formula
Failed? What was the error message? Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Tue, Aug 22, 2017 at 8:17 AM, Stephen O'hagan <SOhagan at manchester.ac.uk> wrote: > I'm trying to use boot.stepAIC for