0

I have following data frame using R.

 x1=c("57134967","57165081", "57217613" ,"57218874","57134965","57165061", "57218613" ,"57258874")
        x2=rnorm(8,0,1)
        data=data.frame(x1,x2)
    > data
        x1         x2
1 57134967 -3.0263640
2 57165081  1.7009238
3 57217613 -1.3100084
4 57218874 -1.6156933
5 57134965  0.1192811
6 57165061 -0.8933975
7 57218613 -0.3558627
8 57258874  0.5548350

I have another variable x3 that contains a subset of values of x1 in data

x3=c("57165081","57218874","57165061")

Now I need to get a subset from data such that the values of x1 in data not equal to x3.

I tried the following, but it is not working.

data[which(data$x1!=x3)]

Can anybody help me to figure out how to do this correctly ?

Thank you

student_R123
  • 962
  • 11
  • 30

0 Answers0