Hello,
three commands might do the job (NOTE: df=your data frame,
obser=Observation, var1=Variable 1 [TYPE: string], var1flag=Variable 1
flag [TYPE: string])
1. df$var1flag<-NA
2. df$var1flag[ is.na(as.numeric(df$var1)) ]<-df$var1[
is.na(as.numeric(df$var1)) ]
3. df$var1<-as.numeric(df$var1
To whom it may concern,
I am a new user to R and I need help in my if and for statements as I need a
place marker.
I would like to convert the following table:
Observation | Variable 1
|-
1 | 1
2 | A
3 | 631
Into :
Observation| Variable 1 | Variable 1 Flag
-
2 matches
Mail list logo