-4

I am trying to adapt someone else's R code for my needs.

I do not know what this line does:

names(train_clean) %in% names(test_clean)

I understand names(train_clean). I understand names(test_clean).

I do not know what %in% is? Looking for help with ? is not helpful in the instance.

?%in% 

yields Error: unexpected SPECIAL in "?%in%"

A. Suliman
  • 12,923
  • 5
  • 24
  • 37
user2502904
  • 179
  • 4
  • 13

1 Answers1

0

Try ?'%in%'.

It returns a logical vector, telling you wether a vector contains one or more of a following vector. As an example:

c(1:10) %in% c(1,5)
#>  [1]  TRUE FALSE FALSE FALSE  TRUE FALSE FALSE FALSE FALSE FALSE
Max Teflon
  • 1,760
  • 10
  • 16