Hi David,
Thanks for the prompt answer. In this file, I have cut the data to the first 15 columns. Here is the code: t2 <- read.csv('Test2.csv', sep=",", header=TRUE) > Test2[2,2] [1] 18.72 1994 Levels: 0.24 0.33 0.49 0.53 0.65 0.67 0.72 0.76 0.88 0.9 0.94 ... 98.88 > Test2[2,2]+1 [1] NA Warning message: In Ops.factor(Test2[2, 2], 1) : + not meaningful for factors The funny thing is that the same commands work normally for a shorter matrix â just the 1st 6 rows and columns. Which led me to think it had to do with the blank cells. But typing : Test2 <- read.csv('Test2.csv', sep=",", header=TRUE, na.strings=" ") does not help. Your help is infinitely appreciated. -------------------------------------------- Vincent Deluard <mailto:vincent.delu...@trimtabs.com> vincent.delu...@trimtabs.com Global Equity Strategist, CFA Charter Award Pending TrimTabs Investment Research 40 Wall Street, 28th Floor New York, NY 10005 Phone: (+1) 646-512-5616 From: David Winsemius [via R] [mailto:ml-node+2124710-750256529-90...@n4.nabble.com] Sent: Monday, May 03, 2010 6:35 PM To: vincent.deluard Subject: Re: / Operator not meaningful for factors On May 3, 2010, at 6:22 PM, vincent.deluard wrote: > > Hi there, > > This will sound very stupid because I just started using R but I see > you had > similar problems. > > I just loaded a very large dataset (2950*6602) from csv into R. The > format > is ticker=row, date=column. Not a particularly precise description of what is in the data. > Every time I want to compute basic operations, R returns "In > Ops.factor: not > meaningful for factors" Code .... we want to see code. All of it. > > I believe it is because R does not read the data as numbers Probably true. Were they dates or numbers? > but I am not > sure. Can anybody help? I generally read in my data with read.table( ,,,,, as.is=TRUE, stringsAsFactors=FALSE, ....) and then convert the columns that I know should be numeric with as.numeric. If all of your columns should have been numeric, you might use the colClasses argument, perhaps along these lines: rd.obj <- read.csv(file="something", colClasses= rep("numeric", <number-of-columns>) ) -- David Winsemius, MD West Hartford, CT ______________________________________________ [hidden email] 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. _____ View message @ http://r.789695.n4.nabble.com/Operator-not-meaningful-for-factors-tp791563p2124710.html To unsubscribe from Re: / Operator not meaningful for factors, click < (link removed) AwNTU4Mzk3> here. -- View this message in context: http://r.789695.n4.nabble.com/Operator-not-meaningful-for-factors-tp791563p2124747.html Sent from the R help mailing list archive at Nabble.com. [[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.