Do an str() on the data. It looks like temp is a factor and I doubt that factors can be negative.
John Kane Kingston ON Canada > -----Original Message----- > From: svfil...@alaska.edu > Sent: Tue, 28 Feb 2012 22:03:19 -0800 (PST) > To: r-help@r-project.org > Subject: [R] Cannot use negative argument in function > > Hi, > > today i wrote a function in R of the type: > > index.refraction <- function(Temp,Press, RH, CO2) > > When i try to plug a negative number in Temp, i got this type of error: > > " > n <- index.refraction(Temp= -40,100,80,CO2) > Messages d'avis : > 1: In Ops.ordered(left, right) : '-' is not meaningful for ordered > factors > 2: In Ops.factor(left, right) : - not meaningful for factors > 3: In Ops.factor(left, right) : - not meaningful for factors > 4: In Ops.ordered(left, right) : '-' is not meaningful for ordered > factors > 5: In Ops.factor(left, right) : - not meaningful for factors > 6: In Ops.factor(left, right) : - not meaningful for factors > " > > Do you have any idea what can be the reason? > Thanks > Simon > > -- > View this message in context: > http://r.789695.n4.nabble.com/Cannot-use-negative-argument-in-function-tp4430667p4430667.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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. ____________________________________________________________ FREE ONLINE PHOTOSHARING - Share your photos online with your friends and family! Visit http://www.inbox.com/photosharing to find out more! ______________________________________________ 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.