[R] if function and apply
Gregor Gorjanc
gregor.gorjanc at bfro.uni-lj.si
Tue Aug 1 12:20:02 CEST 2006
John Kane <jrkrideau <at> yahoo.ca> writes:
> I have a dataset just imported from SPSS. It has any
> number of 99's as missing data and it looks like the
> next dataset will have custom missing codes. I have
> abouat 120 variables and an N of 2000.
>
...
>
> # define function
> fn <- function (x a) {
you need comma between x and a i.e. (x, a)
^
> if (x==a)return (b) else x
> }
How can you return b, if b was not defined before
Gregor
More information about the R-help
mailing list