Hi John,

 

Thanks for responding so quickly. 

 

So I tried:

 

Test2[1:3,1:3])

'data.frame':   3 obs. of  3 variables:

 $ Date      : Factor w/ 2480 levels "A UN Equity",..: 1033 2396 613

 $ X4.20.2010: Factor w/ 1994 levels "0.24","0.33",..: 953 497 1814

 $ X4.19.2010: Factor w/ 1957 levels "0.24","0.33",..: 933 486 1779

 

But I am not sure how to interpret it.

 

The stringAsFactors = False option did not work either.

 

> Test2 <- read.table('Test2.csv', sep=",", header=TRUE, stringAsFactors=FALSE)

Error in read.table("Test2.csv", sep = ",", header = TRUE, stringAsFactors = 
FALSE) : 

  unused argument(s) (stringAsFactors = FALSE)

 

If you want to look at it, I attach a section of my data. 

 

Right now if I type:

> Test2[2,2]+1

Which should return 19.72

 

I get 

[1] NA

Warning message:

In Ops.factor(Test2[2, 2], 1) : + not meaningful for factors

 

Your help is SO 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: John Kane-2 [via R] 
[mailto:ml-node+2124731-1168690456-90...@n4.nabble.com] 
Sent: Monday, May 03, 2010 6:51 PM
To: vincent.deluard
Subject: Re: / Operator not meaningful for factors

 

 I think that you are correct.  R has the annoying habit of converting 
character data to factors when you don't want it
to while it is importing data.  This is because the in the option 
"stringsAsFactors" is set to TRUE for some weird
historical reasons. 

Try the command str(insert name of data) and see what happens.  It should show 
you which columns of data are being
treated as factors. 

You can convert the back to character or to numeric.  See the FAQ Part 7 "How 
do I convert factors to numeric? " or you
can use the String as options command in the read.table to FALSE 

Something like this should work, I think, but it's not tested 
read.table("C:/rdata/trees.csv", stringsAsFactors=FALSE) 





--- On Mon, 5/3/10, vincent.deluard <[hidden email]> wrote: 


> From: vincent.deluard <[hidden email]> 
> Subject: Re: [R] / Operator not meaningful for factors 
> To: [hidden email] 
> Received: Monday, May 3, 2010, 6:22 PM 
> 
> 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. 
> Every time I want to compute basic operations, R returns 
> "In Ops.factor: not 
> meaningful for factors" 
> 
> I believe it is because R does not read the data as numbers 
> but I am not 
> sure. Can anybody help? 
> 
> Thanks! 
> -- 
> View this message in context: 
> http://r.789695.n4.nabble.com/Operator-not-meaningful-for-factors-tp791563p2124697.html
> Sent from the R help mailing list archive at Nabble.com. 
> 
> ______________________________________________ 
> [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. 
> 


______________________________________________ 
[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-tp791563p2124731.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-tp791563p2124759.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.

Reply via email to