[R] Omitted/blank variables in R function

newruser12345 smetcalf at gelbergroup.com
Thu Aug 29 23:23:23 CEST 2013


Hi All,

I'm very green user and have little programming background, but appreciate
any and all help/direction.  I have a spreadsheet that successfully sends
values from Excel cells to R as variables for a function, which then runs
and generates a plot.  I cannot figure out how to make R recognize those
variables as NA if one of the cells in Excel is blank - or, for that matter,
I don't know how to get an R function  to recognize variables as NA if no
value is assigned to that variable.

I have unsuccessfully tried using :

if(is.na(four)) return(NA)

My function is very simple: 

mtmatches <- c(one,two,three,four)

Everything runs smoothly if the four variables have values assigned to them. 
Any advice on how to get it to run when one of the variables has no value? 
No worries about the Excel element...figure I can decipher that puzzle
later!


Thanks!



--
View this message in context: http://r.789695.n4.nabble.com/Omitted-blank-variables-in-R-function-tp4674931.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list