[Solved] Replace Values in a column wiht NA if values from another column are not 1 [closed]

Try library(sp) S@coords[,’roadtype’][S@coords[,’jointcount’]!=1] <- NA S # SpatialPoints: # jointcount roadtype #[1,] 1 3 #[2,] 4 NA #[3,] 3 NA #[4,] 1 1 #[5,] 1 4 data jointcount = c(1,4,3,1,1) roadtype = c(3,2,5,1,4) S <- SpatialPoints(data.frame(jointcount,roadtype)) solved Replace Values in a column wiht NA if values from another column are not 1 [closed]

[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 … Read more

[Solved] strptime returning NA values [closed]

The format argument you give should reflect the format that the data is currently in, not the format that you want to convert it to, so you would have to set format = “%Y-%m-%d”. Read the documentation on strptime again and it should make sense. 1 solved strptime returning NA values [closed]