I need to get all the different variables (picking and choosing from one data set) into a new data set.
I have used subset and now it is saying it has 0 observations for 102 variables. Where have the observations gone? (I have tried all other things, "c", cbind, merge, data.frame. They all say that values must be logical or for data.frame, lengths don't match).
So if I do this:
prevsex1<-subset(hhmemshp2,((hhmemshp2$commun)&(hhmemshp2$hhnum)&
(hhmemshp2$surveyyr)& (hhmemshp2$surveypl)&
year& (hhmemshp2$yrborn)& (hhmemshp2$usyr1)&
(hhmemshp2$hhmemshp)& (hhmemshp2$sex)&
(hhmemshp2$allmig1)& (hhmemshp2$manmig1)&
(hhmemshp2$femmig1)& (hhmemshp2$allage)&
(hhmemshp2$manage)& (hhmemshp2$femage1)&
(hhmemshp2$alllive)& (hhmemshp2$manlive)&
(hhmemshp2$femlive)& (hhmemshp2$weight)))
I get:
Error in (hhmemshp2$commun) & (hhmemshp2$hhnum) & (hhmemshp2$surveyyr) & :
operations are possible only for numeric, logical or complex types
In addition: Warning message:
In (hhmemshp2$commun) & (hhmemshp2$hhnum) & (hhmemshp2$surveyyr) & :
longer object length is not a multiple of shorter object length
hhmemshp2$commun)&(hhmemshp2$hhnum)&....doesn't look right. Are these all logical columns? - akrundplyr::select(hhmemshp2, commun, hhnum, ...)- scoais.logical, but I am not sure what you are doing with all these&. If you want to select the columnssubset(hhmemshp2, select=c(...))- akrun