I have a data frame 'vissim' which has following structure:
> str(vissim)
'data.frame': 480 obs. of 12 variables:
$ Measur. : int 1 2 3 4 5 6 7 8 9 10 ...
$ from : int 100 100 100 100 100 100 100 100 100 100 ...
$ to : int 130 130 130 130 130 130 130 130 130 130 ...
$ Occup..Rate.Trucks : num 2.9 NA NA NA NA 1 NA NA NA NA ...
$ Speed.Mean.Trucks : num 51.4 NA NA NA NA 50.7 NA NA NA NA ...
$ Number.Veh.Trucks : int 2 NA NA NA NA 1 NA NA NA NA ...
$ Occup..Rate.Motorcycles: num NA 0.7 NA NA NA NA NA 0.4 NA NA ...
$ Speed.Mean.Motorcycles : num NA 57.7 NA NA NA NA NA 64.2 NA NA ...
$ Number.Veh.Motorcycles : int NA 2 NA NA NA NA NA 1 NA NA ...
$ Occup..Rate.Car : num 6.8 3.3 NA NA NA 5.6 2.3 1.2 0.4 0.6 ...
$ Speed.Mean.Car : num 58.2 57.5 NA NA NA 60 63.5 64.5 60 55.6 ...
$ Number.Veh.Car : int 12 6 NA NA NA 11 5 2 1 1 ...
When I subset it using 'Measur.' variable along with following criteria, it works fine:
> updatav <- subset(vissim, Measur.==c(1,2,3,4,5))
But when I subset again using the very same variable but different criteria, it gives following error:
> bwdatav <- subset(vissim, Measur.==c(6,7,8,9,10,11))
> head(bwdatav)
[1] Measur. from to Occup..Rate.Trucks
[5] Speed.Mean.Trucks Number.Veh.Trucks Occup..Rate.Motorcycles Speed.Mean.Motorcycles
[9] Number.Veh.Motorcycles Occup..Rate.Car Speed.Mean.Car Number.Veh.Car
<0 rows> (or 0-length row.names)
No idea why it is saying '0 rows' when the data frame 'vissim' clearly has rows for 'Measur.' 6 to 11. Any idea?