The answer was (thanks to Mark Leeds) to do with the use of a factor
instead of a vector.
on [2017-08-05] at 08:57 Myles English writes:
> I am having trouble understanding how the 'by' function works. Using
> this bit of code:
>
> i <- data.frame(x=c(1,2,3), y=c(0,0,0
I am having trouble understanding how the 'by' function works. Using
this bit of code:
i <- data.frame(x=c(1,2,3), y=c(0,0,0), B=c("red","blue","blue"))
j <- data.frame(x=c(1,2,3), y=c(1,1,1), B=c('red','blue','green'))
plot(0, 0, type="n", xlim=c(0,4), ylim=c(0,1))
by(i, i$B, function(s){ point
2 matches
Mail list logo