Re: [R] replace NA into - for specific column

2021-06-03 Thread konstantinos christodoulou
Hi Kai, You can also try this: proband_crc2 %>% mutate(MMR = replace(MMR, MMR =="NA", "-")) Thanks, Kostas On Wed, Jun 2, 2021 at 11:59 AM Jim Lemon wrote: > Hi Kai, > Maybe this will help: > > proband_crc2<-data.frame(MMR=rep(c(NA,"+"),3)) > proband_crc2 > proband_crc2$MMR[is.na(proband_cr

Re: [R] replace NA into - for specific column

2021-06-02 Thread Kai Yang via R-help
Hello Jim,Your example works well.Thank you for your help,Kai On Tuesday, June 1, 2021, 04:59:09 PM PDT, Kai Yang via R-help wrote: Hi List, I have a column MMR in a data frame proband_crc2. The column contents missing value and + (means positive).  I need to replace all missing value

Re: [R] replace NA into - for specific column

2021-06-02 Thread Jim Lemon
Hi Kai, Maybe this will help: proband_crc2<-data.frame(MMR=rep(c(NA,"+"),3)) proband_crc2 proband_crc2$MMR[is.na(proband_crc2$MMR)]<-"-" proband_crc2 Jim On Wed, Jun 2, 2021 at 9:59 AM Kai Yang via R-help wrote: > > Hi List, > I have a column MMR in a data frame proband_crc2. The column content

Re: [R] replace NA into - for specific column

2021-06-01 Thread Jeff Newmiller
A unary negative sign with no number is not a number, so it has to be character. If you are done with computations you can format your numbers as character data and set the NA to "-", but such a conversion will prevent you from performing computations so it is only useful for creating report tab

[R] replace NA into - for specific column

2021-06-01 Thread Kai Yang via R-help
Hi List, I have a column MMR in a data frame proband_crc2. The column contents missing value and + (means positive).  I need to replace all missing value into - (means negative) I did try with difference ways.  Below are my testing, but not any one works. Can someone help me? Thanks, Kai proband_