Re: [R] [External] Help with sub-setting

2020-05-26 Thread Burgess, Jamie
ub-group by the two variables I have selected. I was wondering why this new script worked. Kind regards, Jamie From: Bert Gunter Sent: 25 May 2020 18:36:18 To: Richard M. Heiberger Cc: Burgess, Jamie; r-help@r-project.org Subject: Re: [R] [External] Help

Re: [R] [External] Help with sub-setting

2020-05-25 Thread Bert Gunter
Yes. In particular: data$variable==1 & data makes no sense (data is a data frame). A typo perhaps? Or as Richard indicated, consult references/tutorials to learn proper syntax for (vectorized) predicates. Bert Gunter "The trouble with having an open mind is that people keep coming along and

Re: [R] [External] Help with sub-setting

2020-05-25 Thread Richard M. Heiberger
I think the syntax you are looking for is datasubset <- data[ data$A ==1 & data$B == 1 , ] ) This gives the subset of your original data for variable A with value 1 and variable B with value 1. On Mon, May 25, 2020 at 12:57 PM Burgess, Jamie wrote: > > Dear all, > > I hope this message finds