Help with basic subsetting

Welcome to the forum

I think you have given us a pretty clear exposition of the problem but dealing with it would be much easier with some sample data. For all sorts of reasons a screenshot of the data is not very useful.

A handy way to supply sample data is to use the dput() function. See ?dput. At a quick guess something like head(dput(myfile), 400) will likely supply enough data for us to work with. That's a bit more than I would normally suggest but it looks like you have a lot of conditions in there.

For some useful information on generally asking questions and general formatting I'd suggest having a look at FAQ: How to do a minimal reproducible example ( reprex ) for beginners

1 Like