[R] GmeanRel vs. mult.icc - differential meaning of icc2 results?

2015-08-05 Thread Alain D.
Dear R-list, let us say I want to report the reliability of group means for "HRS" (ICC2): library(multilevel) data("bh1996") mult.icc(bh1996[,c("HRS","LEAD","COHES")],grpid=bh1996$GRP) Variable ICC1ICC2 1 HRS 0.129237 0.91713 2 LEAD 0.147462 0.92804 3COHES 0.048049 0.79008

[R] convert number back to point separated date

2015-02-23 Thread Alain D.
Dear R-List I have a date column formatted dd.mm. separated by points that was converted into a number using as.integer(date). Now I wish to convert the number back into the original date. Something like: date<-as.factor(c("07.12.2010","29.04.2013")) dd<-as.integer(date) as.Date(dd, origi

[R] format selected columns in dataframe as character

2015-02-26 Thread Alain D.
Dear R-List, #I have a df with the first two cols formatted as factor. dfx <- data.frame( group = c(rep('A', 8), rep('B', 15), rep('C', 6)), sex = sample(c("M", "F"), size = 29, replace = TRUE), age = runif(n = 29, min = 18, max = 54)) # now I want to format both factor VARs as character # I

[R] extract descriptive stats for categorial data from dataframe

2014-08-05 Thread Alain D.
Dear R-List, I want to have descriptive stats in a special form and cannot figure out a nice solution. df<-as.data.frame(cbind(i1=rep("+"),i2=rep("+",10),i3=rep("-",10),i4=c(rep("-",2),"0",rep("-",7)),i5=rep("+",10),i6=c(rep("-",9),"+"),i7=c(rep("+",4),"0",rep("+",5)),i8=c(rep(0,4),rep("+",3),"-"

Re: [R] extract descriptive stats for categorial data from dataframe

2014-08-05 Thread Alain D.
Thank you Jim, this is a good step in the right direction. But is there also a way to get the output in a nice dataframe with VAR1 to VAR 1 to 9 as rows? Best wishes Alain > Jim Lemon hat am 5. August 2014 um 14:35 geschrieben: > > > On Tue, 5 Aug 2014 11:36:36 AM Alain D. wrote

Re: [R] extract descriptive stats for categorial data from dataframe

2014-08-05 Thread Alain D.
> + - 0 > i1 10 0 0 > i2 10 0 0 > i3 0 10 0 > i4 0 9 1 > i5 10 0 0 > i6 1 9 0 > i7 9 0 1 > i8 4 2 4 > i9 7 1 2 > A.K. > > > > > On Tuesday, August 5, 2014 5:36 AM, Alain D. wrote: > Dear R-List, > > I want to have descrip

Re: [R] recode categorial vars into binary data

2013-05-16 Thread Alain D.
Hi David, [This is a late reaction to a question I posted some time ago...] thanks to your suggestion I found another solution which does carry out the random assignment. df[,2] <- as.numeric( rank(df[,2],ties.method="random") > length(df[,2])/2 ) Maybe this will be of interest to the R-List (a

[R] highest and second highest value in row for each combination

2011-02-10 Thread Alain D.
Dear R-List, I have a dataframe area<-c(rep(1,10),rep(2,10),rep(3,10),rep(4,10),rep(5,10)) type<-c(rep(1:10,5)) a<-rnorm(50) b<-rnorm(50) c<-rnorm(50) d<-rnorm(50) df<-cbind(area,type,a,b,c,d) df area type a b c d [1,]11 0.45608192

[R] fa (psych) output oblique.scores=TRUE vs. FALSE

2011-08-08 Thread Alain D.
Dear R-List, I have carried out a factor analysis using fa (psych) with nfactors=2, rotation="oblimin" and fm="pa". Now I have to report both pattern AND structure matrix. As I have understood R-Documentation, this can be obtained by setting the "oblique.scores" argument TRUE (structure matrix) o

[R] store result of loop in df

2016-07-29 Thread Alain D. via R-help
Dear list, I have a dataframe df: df<-data.frame(x=c(5,32,18,3,17), n=c(11,200,432,20,60)) Now I want to run n=nrow binom.test() with x being the number of success and n the number of trials and then store the results as a new VAR in df. I tried for (i in 1:nrow(df)){ df$VAR<-(binom.test

[R] function to carry out Bootstrap LRT with poLCA results

2016-03-31 Thread Alain D. via R-help
Dear List, I would like to determine the optimal number of latent classes (polytomous data) using Bootstrap LRT. poLCA does not provide such a possibility and I am not enough into programming to modify the code. Is there any other way to do this, e.g. use a poLCA object with some other package?