[R] Splitting strings

2007-08-23 Thread Gary Collins
I'm having a Thursday morning mental block, any suggestions on the following would be most appreciated... I have (as an example) surgery = c("d48", "d67", "dnc37", "a75", "d10", "a78", "d31", "d55", "d1") before each number part the possibilities are c("a", "d", "dnc"), I'm trying to spli

[R] passing an argument to a function which is also to be a dataframe column name

2006-12-03 Thread Gary Collins
any suggestions on the following gratefully welcome, I have a dataframe, which I am subsetting via labels atpi[, creativity] where (for example) atpi = as.data.frame(matrix(1:50, ncol = 5, nrow = 10)) names(atpi) = c("Q1", "Q2", "Q3", "Q4", "Q5") and creativity = c("Q1", "Q3", "Q4") I want t

Re: [R] Tetrachoric correlation in R vs. stata

2006-06-25 Thread Gary Collins
looking at the help page/code in STATA for tetrachoric, it says it estimates the tetrachoric correlation via the approximation suggested by Edwards & Edwards (1984), "Approximating the tetrachoric correlation", Biometrics, 40(2): 563. that is, (alpha (pi/4) - 1) / (alpha^(pi/4)+1), where alpha is

[R] problem rbind after lapply (difference between 2.2.1 and 2.3.0)

2006-05-10 Thread Gary Collins
Any help on the following would be appreciated... > R.version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major2 minor2.1 year 2005 month12 day 20 svn rev 36812 > language R > set.seed(2) > x=matrix(ncol=4, nrow=10) > for(i