R-2.9.1, Windows7 Dear list,
I have a question to you that seems very simple to me, but I just can't figure it out. I have a dataframe called "ratings" which contains the following variables: evalR1, evalR2, evalR3, evalR4, scoreR1, scoreR2, scoreR3, scoreR4, opinionR1, opinionR2, opinionR3, opinionR4. (there are more variables, but this gives an idea of the data structure). What I want is run several analyses on all 3 or 4-combinations of a given variable. So, for example, I want to compute the following ICC's (function from the psych package): ICC(cbind(evalR1,evalR2, evalR3)) ICC(cbind(evalR1,evalR2, evalR4)) ICC(cbind(evalR1, evalR3, evalR4)) ICC(cbind(evalR2, evalR3, evalR4)) ICC(cbind(evalR1, evalR2, evalR3, eval4)). I create a matrix containing the 3-combinations by combn(4,3). Now I need to call the variables into the function. First, I tried paste as follows: combis <- combn(4,3) # this gives the 3-combinations attach(ratings) eval <- paste("evalR",combis[1,1],",evalR",combis[2,1],",evalR","combis[3,1],sep ="") (this is of course just for 1 combination, as an example) the output of this is "evalR1,"evalR2,evalR3", but when I run ICC(cbind(eval)), an error message is given which is not given when I enter ICC(cbind(evalR1,evalR2, evalR3)) manually. The function appears not to recognize the variable names. It also does not work to type ICC(cbind(unquote(eval))). Alternatively, I have tried the cat function, but also here ICC does not recognize the input as variable names. What am I doing wrong? How can I automatically construct the set of variable names such that a function recognizes them as variable names? ICC is one example, but there are also other computations to be run and the set of variables is pretty large, so typing the combinations of variable names manually is really unattractive. What am I missing? It seems to me that there probably is a very simple solution in R, but which? Thank you, Peter Verbeet [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.