Hello,

I have some data file, say, mydata

1,2,3,4,5,6,7
3,3,4,4,w,w,1
w,3,6,5,7,8,9
4,4,w,5,3,3,0

i want to replace some percentages of "mydata" file in to NAs for those values 
that are NOT w's. I know how to apply the percentage thing here but don't know 
how to select those values that are not "w"s. So far, i was able to do it but 
the result replaces the w's also which i do not want to. 

Here is my code that i tried to exclude those w's(within my short codes)

ifelse(mydata[sample,var] != 'w',mydata[sm,var]<-NA,'w')
Can any one help please?

Thank you

Daniel


      
        [[alternative HTML version deleted]]

______________________________________________
[email protected] 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.

Reply via email to