[R] Use of parantheses to force order of execution

2013-09-08 Thread Ben Harrison
Hello, I wish to create a copy of a data frame, but with missing values replaced with NAs. I thought I should be able to do it in one step using parentheses to group the statements and force those inside the parens to execute first: df - (BWS6[BWS6 -998] - NA) But all this does is assign NA to

Re: [R] Use of parantheses to force order of execution

2013-09-08 Thread Duncan Murdoch
On 13-09-08 6:46 AM, Ben Harrison wrote: Hello, I wish to create a copy of a data frame, but with missing values replaced with NAs. I thought I should be able to do it in one step using parentheses to group the statements and force those inside the parens to execute first: df - (BWS6[BWS6

Re: [R] Use of parantheses to force order of execution

2013-09-08 Thread peter dalgaard
On Sep 8, 2013, at 16:09 , Duncan Murdoch wrote: On 13-09-08 6:46 AM, Ben Harrison wrote: Hello, I wish to create a copy of a data frame, but with missing values replaced with NAs. I thought I should be able to do it in one step using parentheses to group the statements and force those

Re: [R] Use of parantheses to force order of execution

2013-09-08 Thread Ben Harrison
Thank you all for the replies. BWS6 is a data frame, but actually the main problem in my code as Duncan points out is that the statement inside the parentheses modifies BWS6 anyway. I need to rework my code. I coded my missing values for these data sets as -999.25 (a hangover from another piece