Re: [R] Strange behavior when sampling rows of a data frame

2020-06-19 Thread Sébastien Lahaie
un 19, 2020 at 7:04 PM Daniel Nordlund wrote: > On 6/19/2020 5:49 AM, Sébastien Lahaie wrote: > > I ran into some strange behavior in R when trying to assign a treatment > to > > rows in a data frame. I'm wondering whether any R experts can explain > > what's

[R] Strange behavior when sampling rows of a data frame

2020-06-19 Thread Sébastien Lahaie
I ran into some strange behavior in R when trying to assign a treatment to rows in a data frame. I'm wondering whether any R experts can explain what's going on. First, let's assign a treatment to 3 out of 10 rows as follows. > df <- data.frame(unit = 1:10) > df$treated <- FALSE > > s <- sampl