I have had a similar problem as you before. Based on my response from another post, here's what I would suggest before you run plot
:
Option 1: Use droplevels
mgn_my <- droplevels(data[1:49999,18])
Option 2: Use apply
. This approach seems "friendlier" if you are familiar with apply
-family functions in R. For example:
mgn_my <- data[1:49999,18]
apply(mgn_my,1,plot)