I would like to separate only two types of a column of the data frame (factors and characters) and the following codes results in an error. I wonder what is the correct way to carry out this task.
install.packages("dslabs")
library(dslabs)
data(murders)
names(murders)[sapply(murders, (is.factor | is.character))]
I can use the following code to combine the two, but I wonder what will be the correct format in case I want to use multiple conditions as the code above.
c(names(murders)[sapply(murders, is.factor)],names(murders)[sapply(murders, is.character)])