I am trying to remove couple elements from a dataset. It has A,B,C,1,2,3,4,5 as its contents:
>dataset
[1] A 4 3 C 3 3 3 C 3 B 3 4 3 3 3 B 3 3 5 3 3 4 A 3 3 5 3 3 4 3 2 3 C 6 A 3 3
[38] 3 A 3 3 A 3 3 3 3 3 A 3 C B 3 B 3 A 3 1 8 1 1 C 1 1 3 3 3 3 B 3 A A 3 5 3
I want to remove all "A"s and "B"s from the dataset. The expected dataset should only have 1,2,3,4,5,C as its elements.
I have tried with following codes but could not succeed:
>rm(dataset$"B") # to remove "B"s
> x.sub <- subset(dataset, "B" > 1) #to remove Bs appearing more than once
Do you know how can I remove them?