An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20090304/5538b48e/attachment-0002.pl>
Eliminate Factors from Data Frame
2 messages · Bob Roberts, David Winsemius
It's in the R-FAQ. I can't remember it's 7.20 or 7.35 but it's in that general area.
David Winsemius On Mar 4, 2009, at 3:38 PM, Bob Roberts wrote: > Hi, > I formed a 49 by 3 data frame by reading in a text file using > read.table(), and combining it with a matrix that I made by using > unlist() on a list of character strings. I would like to do some > simple arithmetic operations on the elements in the data frame > columns (e.g. column 3/column2) but the values in the data frame are > stored as factors and using stringsAsFactors=FALSE did not work. I > get this error when doing arithmetic operations: > In Ops.factor(dataframe$col3, dataframe$col2) : / not meaningful for > factors > Is there a way to store these values not as factors or convert them > to numeric values? Or a way to do operations on factors in data > frames? I know R has I() but that didn't help in this case. Thanks > so much. > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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.