I need to clean/modify the data, but I am interested in data where var1=0 only. Can I 'permanently' remove the data where var1=0 or is missing, so that I can simplify my codes. For example,for summary statistics i have mytable <- xtabs(~var1+ var2+var3, data = mydata), but i would like to cross tab with only two variables (var2 and var3)where var1=0.
Asked
Active
Viewed 58 times
1 Answers
1
Maybe you can try something:
mydata_clean <- mydata[mydata$var1 !=0,] # to remove rows data where var1 = 0
mytable <- xtabs(~var2+var3, data = mydata_clean) # to perform xtabs on var2 and var3 only
If it does not work, you should put a reproducible example of your data, it will make things easier for people trying to help you.

dc37
- 15,840
- 4
- 15
- 32
-
@Beata, glad to hear ;) – dc37 Nov 18 '19 at 05:36