Re: [R] Replace NaN with value from the same row

2015-10-18 Thread Jonathan Reardon
Ok, i will do, thanks for your help. J > Subject: RE: [R] Replace NaN with value from the same row > From: jdnew...@dcn.davis.ca.us > Date: Sun, 18 Oct 2015 12:55:14 -0700 > To: jonathanrear...@outlook.com > CC: r-help@r-project.org > > You should (re-)read the intro docum

Re: [R] Replace NaN with value from the same row

2015-10-18 Thread Jeff Newmiller
is making a new >column called 'idx', finds the NaN values and inserts the boolean TRUE >in the respective cell. >df[ idx, "mean" ] <- df[ idx, "offset" ] << i am unsure what this >is doing exactly. >Jon > > >> Subject: RE: [R] Rep

Re: [R] Replace NaN with value from the same row

2015-10-18 Thread Jeff Newmiller
ctor) of type >'NULL' >Jon > >> Subject: Re: [R] Replace NaN with value from the same row >> From: jdnew...@dcn.davis.ca.us >> Date: Sun, 18 Oct 2015 11:06:44 -0700 >> To: jonathanrear...@outlook.com; r-help@r-project.org >> >> Next time send your e

Re: [R] Replace NaN with value from the same row

2015-10-18 Thread Jeff Newmiller
Next time send your email using plain text format rather than HTML so we see what you saw. Try idx <- is.na( df$mean ) df[ idx, "mean" ] <- df[ idx, "offset" ] BTW there is a commonly-used function called df, so you might improve clarity by using DF for your temporary data frame name. ---

[R] Replace NaN with value from the same row

2015-10-18 Thread Jonathan Reardon
Hi everyone, A simple question, but i cannot figure this out. I have a data-frame with 4 columns (onset, offset, outcome, mean): onset offset outcome mean8 72071 72503 1 7244615 142598 143030 1NaN30 293729 294161 1 294080 For each 'NaN' in the mean column, i want to r