0
votes

I am trying to delete excess columns from a dataframe, where my columns are interpreted as factors. I have been doing this by saying:

a=somedataframe
a[[2]]=NULL

But it gives me the error: target of assignment expands to non-language object

1

1 Answers

0
votes

We can try

i1 <- sapply(df1, is.factor)
df1[i1] <- NULL

data

df1 <- data.frame(v1 = letters[1:3], v2 = 1:3, v3 = letters[4:6])