Re: [R] Cannot use negative argument in function

2012-02-29 Thread David Winsemius
On Feb 29, 2012, at 7:05 PM, lidaky wrote: the "*" character in front of the Temp variable is there because i just wanted to bold the variable in the threade that you can see where it is used. I just restart my computer and R. Now the function is working great. No clue what was happenin

Re: [R] Cannot use negative argument in function

2012-02-29 Thread lidaky
the "*" character in front of the Temp variable is there because i just wanted to bold the variable in the threade that you can see where it is used. I just restart my computer and R. Now the function is working great. No clue what was happening, but now everything works. Sorry for the false notic

Re: [R] Cannot use negative argument in function

2012-02-29 Thread David Winsemius
On Feb 29, 2012, at 2:14 PM, lidaky wrote: index.refraction <- function(Temp,Press, RH, CO2) { #define constant lambda <- 531 #nm Co <- 299792458 #m/s ww <- c(295.235,2.6422,-0.03238,0.004028) kk <- c( 238.0185 ,5792105 ,57.362 ,167917) aa <- c( 1.58123 * 10^(-6) , -2.9331 * 10^(-8)

Re: [R] Cannot use negative argument in function

2012-02-29 Thread Richard M. Heiberger
This line TT <- *Temp*+273.15 makes it unexecutable. that is not the error you mentioned. should that be TT <- "Temp"+273.15 or TT <- Temp+273.15 or something else? On Wed, Feb 29, 2012 at 2:14 PM, lidaky wrote: > here is the code: > > index.refraction <- function(Temp,Press, RH, CO2) > {

Re: [R] Cannot use negative argument in function

2012-02-29 Thread lidaky
here is the code: index.refraction <- function(Temp,Press, RH, CO2) { #define constant lambda <- 531 #nm Co <- 299792458 #m/s ww <- c(295.235,2.6422,-0.03238,0.004028) kk <- c( 238.0185 ,5792105 ,57.362 ,167917) aa <- c( 1.58123 * 10^(-6) , -2.9331 * 10^(-8) , 1.1043 * 10^(-10))

Re: [R] Cannot use negative argument in function

2012-02-29 Thread John Kane
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] Cann

Re: [R] Cannot use negative argument in function

2012-02-29 Thread Berend Hasselman
On 29-02-2012, at 07:03, lidaky wrote: > 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 :

[R] Cannot use negative argument in function

2012-02-28 Thread lidaky
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 ord