Greetings again. I'm still trying to coerce a pile of data into a frequency table format. I've managed to do so using perl, so I now have a tab-delimited file that contains the contingency table I'm trying to use: Group var1 var2 ... varn B 42 11 3 C 44 1 12 ... X 12 0 19 I can read the table in using read.table(), but I end up with a data frame, and when I try to use as.table() it says: Error in as.table.default(df) : cannot coerce into a table What I need is a table object upon which I can perform a chi-square analysis. Any help will be very much appreciated! ---------------------------------------------------------------------- Andrew J Perrin - Ph.D. Candidate, UC Berkeley, Dept. of Sociology (Soon: Asst Professor of Sociology, U of North Carolina, Chapel Hill) andrew_perrin at unc.edu - http://www.unc.edu/~aperrin -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Still need help w/ making a table
3 messages · Andrew Perrin, Griffith Feeney, Kurt Hornik
Use data.matrix(). From help(data.matrix):
data.matrix package:base R Documentation
Data Frame to Numeric Matrix
Description:
Return the matrix obtained by converting all the variables in a
data frame to numeric mode and then binding them together as the
columns of a matrix. Factors and ordered factors are replaced by
their codes.
At 11:28 AM 4/3/01 -0500, you wrote:
Greetings again. I'm still trying to coerce a pile of data into a frequency table format. I've managed to do so using perl, so I now have a tab-delimited file that contains the contingency table I'm trying to use: Group var1 var2 ... varn B 42 11 3 C 44 1 12 ... X 12 0 19 I can read the table in using read.table(), but I end up with a data frame, and when I try to use as.table() it says: Error in as.table.default(df) : cannot coerce into a table What I need is a table object upon which I can perform a chi-square analysis. Any help will be very much appreciated!
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
3 days later
Andrew Perrin writes:
Greetings again. I'm still trying to coerce a pile of data into a frequency table format. I've managed to do so using perl, so I now have a tab-delimited file that contains the contingency table I'm trying to use:
Group var1 var2 ... varn B 42 11 3 C 44 1 12 ... X 12 0 19
I can read the table in using read.table(), but I end up with a data frame, and when I try to use as.table() it says: Error in as.table.default(df) : cannot coerce into a table
What I need is a table object upon which I can perform a chi-square analysis.
Any help will be very much appreciated!
I am not sure about the above ``contingency'' table (does var_i mean that the corresponding column holds the counts for variable i or do the columns correspond to levels?). In any case, pls have a look at the documentation for xtabs and read.ftable. The latter is meant for reading in contingency tables in various ``flat'' formats. -k -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._