Displaying 1 result from an estimated 1 matches for "trialchara".
2009 May 23
1
Clean up a complex variable
...[1] 0(a=1) 0(b=1) 0.133(b=1) 0.555(a=1) >5.32(a=1)
what i need to do is to remove the text (a=1) and (b=1) and the ">" in the
V1, and then convert to a numeric variable, and als I am aslo requested that
when the value has a=1, the value needs to be divided by 5.
what I did is:
trialchara<-as.character(trial$V1)
trialnum<-gsub("(a=1)|(b=1)|>","",trialchara)
the result is
[1] "0 ()" "0 ()" "0.133 ()" "0.555 ()" "5.32 ()"
How can I get rid of the () symbol?
How can I do this part "when the value has a=...