I used read_excel to import my data and filter the table for a value out of a column. So far so good.
Next, to be able to work with the values from a different column (I think?), the person that wrote this code used as.factor as follows:
filtered_table$column<-as.factor(filtered_table$column, levels = c("name1", "name2",...))
after running, this returns
"Error in as.factor((filtered_table$column, levels = c("name1",.... : unused argument (levels = c("name1", "name2", ...)
None of the names I entered are being recognized as arguments, they're very simple and I checked the spelling. I'm not looking to drop unused levels, since there are none, to begin with. The names that were in their place originally were also strings. How do I fix this?
From the help page?as.factor
it shows that the function only takes one argument (in your case the filtered_table$column
), and therefore the error message indicates that there's not another argument to match up with the second one you've specified in the function call. To specify the levels explicitly, you may need to use the factor()
function.