[Solved] Subset in R producing na [closed]


This is a workaround, a response to your #2

Looking at your code, there is a much easier way of subsetting data. Try this.

Check if this solves your issue.

library(dplyr)

active<- clinic %>% 
filter(Days.since.injury.physio>20,
       Days.since.injury.physio<35, 
       Days.since.injury.F.U.1>27,
       Days.since.injury.F.U.1<63
      )

dplyr does wonders when it comes to subsetting and manipulation of data.

The %>% symbol chains statements together so you don’t ever have to use the $ symbol.

If, for some bizarre reason, you don’t like this, you should look at the subset function in r.

1

solved Subset in R producing na [closed]