search for: var456

Displaying 2 results from an estimated 2 matches for "var456".

2010 Nov 22
2
how to loop through variables in R?
After importing a table with "M" variables and "N" records, I'd like to calculate chi-square statistics, say, between N1, N2; N1, N3, ..., N1, Ni, and then N2, N3, ... N2, Ni, ..., Ni-1, Ni. Two loops should be ok but the manual & online help don't show a systematic way to do so but instead show hard-code examples so users have to type in the names themselves one
2010 Nov 24
0
4. Rexcel (Luis Felipe Parra)-how to run a code from excel
...; To: watashi at post.com Sent: Mon, Nov 22, 2010 4:32 pm Subject: Re: [R] how to loop through variables in R? If you want to have a name-specific loop. Assign names to your variables after inserting them into the data.frame like that: colnames(df) <- c("var1","var23","var456","var44",...) for (nam in colnames(df)) { myfunction(df[[nam]]) } Data.frames support access by names. Unfortunately, in this sense I have to type in 1000 times... isn't there any function that allows retrieving and assigning all columns automatically? read.table in "the...