i am trying to generate 0 and 1 for absence and presence. my data is line segments and i have to plot 0 or 1 at and interval of 0.1 for points that lie within the segment or points outside the segment.
V1 V2 V3 V4 V5 V6 V7
3 17 26.0 26.0 0 12-Jun-84 1 0
4 17 48.0 48.0 1 12-Jun-84 3 0
5 17 56.7 56.7 0 12-Jun-84 1 0
143 17 16.3 16.3 0 19-Jun-84 1 8
144 17 17.7 17.7 0 19-Jun-84 1 8
145 17 22.0 22.0 0 19-Jun-84 1 8
v2
and v3
are the start and endpoints and v4
is the separation between them.
i have tried
tran17 <- seq(0, 80, by=0.1)
tran17.date1 <- rep(0, length(tran17))
##
sub1 <-which(tran17 >= c$V2[i] & tran17 <= c$V3[i])
tran17.date1[sub1] <- 1
thankyou