[R] package "methods" in options("defaultPackages") was not found

2015-01-13 Thread D. Alain
Dear R-List, I receive a strange error message when starting R. It says: "Warning message: package "methods" in options("defaultPackages") was not found Error in file(filename, "r") : cannot open the connection In addition: Warning message: In file(filename, "r") : cannot open file 'G:/statp

[R] elegant way to remove cases with many different ids

2015-01-23 Thread D. Alain
Dear R-List, I have nested data with cases grouped by IDs and I want to remove all cases with specific IDs. something like df<-data.frame(id=c(1,1,1,2,2,2,3,3,3,4,4,4,5,5,5),var=c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15)) subset(df,id== 1 | id == 3) Having a very large dataset with many IDs to

[R] results of robust regression vs. OLS regression

2013-07-09 Thread D. Alain
Dear R-List, due to outliers in my data I wanted to carry out a robust regression. According to APA standards, reporting OLS regression results should include   1. unstandardized beta coefficients 2. standardized beta coefficients 3. SE 4. t values 5. r squared 6. r squared adjusted 7. F (df.num

[R] weighing proportion of rowSums in dataframe

2013-02-06 Thread D. Alain
Dear R-List, I am sure there must be a very simple way to do this - I just do not know how... This is what I want to do: #my dataframe df<-data.frame(id=c("x01","x02","x03","x04","x05","x06"),a=c(1,2,NA,4,5,6),b=c(2,4,6,8,10,NA),c=c(NA,3,9,12,NA,NA),sum=c(3,9,15,24,15,6))    id    a     b  

Re: [R] weighing pro​portion of rowSums i​n dataframe

2013-02-06 Thread D. Alain
"x03","x04","x05","x06"),a=c(1,2,NA,4,5,6),b=c(2,4,6,8,10,NA),c=c(NA,3,9,12,NA,NA)) > > (df$wSum<-apply(sweep(df[,-1],1,rowSums(df[,-1],na.rm=T),"/"),1,function(x)sum(x*w,na.rm=T))) > > hth. > > Am 06.02.2013 14:17, schrieb D. A

[R] recode data according to quantile breaks

2013-02-19 Thread D. Alain
Dear R-List, I would like to recode my data according to quantile breaks, i.e. all data within the range of 0%-25% should get a 1, >25%-50% a 2 etc. Is there a nice way to do this with all columns in a dataframe. e.g. df<- f<-data.frame(id=c("x01","x02","x03","x04","x05","x06"),a=c(1,2,3,4,5,

[R] recode categorial vars into binary data

2013-05-07 Thread D. Alain
Dear R-List, I would like to recode categorial variables into binary data, so that all values above median are coded 1 and all values below 0, separating each var into two equally large groups (e.g. good performers = 0 vs. bad performers =1). I have not succeeded so far in finding a nice solut

[R] many-facet rasch analysis in R

2012-10-05 Thread D. Alain
Dear R-list, is there any R-package that I can use to carry out a many-facet rasch analysis in R? Thank you. Best wishes Alain [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/

[R] mirt vs. eRm vs. ltm vs. winsteps

2012-11-08 Thread D. Alain
Dear R-List, I tried to fit a partial credit model using the "pcmdat" from eRm-package comparing the results of mirt, eRm, ltm and winsteps. The results where quite different, though. I cannot figure out what went wrong and I do not know which result I can rely on. This is what I did in R

[R] Logical operator fails to recognize vector element

2010-10-06 Thread D. Alain
year 2010 month 05 day 31 svn rev 52157 languageR version.string R version 2.11.1 (2010-05-31) Thanks D. Ala

[R] routine for dependent correlation test with stratified random sample

2011-05-13 Thread D. Alain
Dear R-List,   I would like to have a large number of stratified random subsamples drawn from my dataframe and automatically test for correlation differences in every subsample.   Let this be my dataframe   df<-data.frame(group=c(rep(1,5),rep(2,5),rep(3,5)),a=c(3,4,5,6,3,4,5,4,5,4,1,2,1,2,1),b=c

[R] error in model specification for cfa with lavaan-package

2011-06-01 Thread D. Alain
Dear R-List, (I am not sure whether this list is the right place for my question...) I have a dataframe df.cfa df.cfa<-data.frame(x1=c(5,4,1,5,5,NA,4,NA,NA,5),x2=c(2,3,3,3,NA,1,2,1,2,1),x3=c(5,3,4,1,5,5,5,5,5,5),x4=c(5,3,4,5,5,5,5,5,5,5),x5=c(5,4,3,3,4,4,4,5,NA,5),x6=c(3,5,2,1,4,NA,NA,5,3,4),x7=

[R] recode according to specific sequence of characters within a string variable

2011-02-04 Thread D. Alain
Dear R-List, I have a dataframe with one column "name.of.report" containing character values, e.g. >df$name.of.report "jeff_2001_teamx" "teamy_jeff_2002" "robert_2002_teamz" "mary_2002_teamz" "2003_mary_teamy" ... (i.e. the bit of interest is not always at same position) Now I want to recode

[R] Subset according to groups NA proportion within specific variables

2011-02-21 Thread D. Alain
  2     5 3     -0.67463191   1    NA 3 -0.66410552   2 7 3     -0.02543358   1 8 Please excuse me if the problem has already been treated somewhere, but so far I was not able to find the right threat for my question in RSeek. Can anyone help? Thanks in advance!

[R] R crash when using pan for multiple imputation

2011-06-21 Thread D. Alain
Dear R-List, I apologize for not posting a reproducible example - the reason is that I actually do not succeed in reproducing my specific problem with generated data. Let me still describe the problem: I want to impute missing data using the "pan" package. a) It works, when I use a fractio