r - Subset is not working -
i have dataset called "x" produces following records when head(x, 1)
vrtg_id_nr eeg_vrtg_cat_v gebr_ident_keur pl_keuring naam_vrtg_aanb dat_result_keur tyd_result_keur kl_code_eu_1 kl_code_eu_2 1 vf1ja04n522215749 m1 null null null 20090527 906 6 null res_code_keur kent_land_oors land_herk year 1 gdk me-qt 761 d 2009
i following when show classes of relevant column
$year [1] "numeric"
i want create subset see data years 2009 en 2010. tried
x_subset <- x[x$year >=2009 & <= 2011]
that gives me following error:
data frame 0 columns , 992287 rows
while want overview subset of records between 2009 , 2011...
if year factor variable, first convert numeric:
x$year <- as.numeric(x$year)
i think missing comma:
x_subset <- x[x$year >=2009 & x$year <= 2011,]
Comments
Post a Comment