Look at the "missing" function.
Or set the default value of the arguments to NA.
On Thu, Aug 29, 2013 at 3:23 PM, newruser12345
<smetcalf@gelbergroup.com>wrote:
> 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.
>
> ______________________________________________
> 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.
>
--
Gregory (Greg) L. Snow Ph.D.
538280@gmail.com
[[alternative HTML version deleted]]