Stringsasfactors doesn't work!

data<-import("billingerrors.xls", sheet = 1, header = TRUE, StringsAsFactors = FALSE)

and this is what I get

Stratum Sampled NotAllowed
Small 57 12
Medium 17 10
Large 5 2

This is the data I'm using

How do I overcome this issue?

Please help

Hi @VirginTechnician! Welcome to RStudio Community :slight_smile:

We need a bit more information to help you with this. When you say, "This is the data I'm using," what do you mean? What sort of data were you expecting to see?

If you can turn this into a reprex, it'll help us get to the bottom of this faster :slight_smile:

1 Like

what I meant was 'billingerrors.xls' that I imported in the R code is 2

sorry for the confusion

1 Like

Is import() a function you wrote, or one from some package you’re using? Based on the error message, it seems to be using read_xls() under the hood — if that’s readr::read_xls() then it doesn’t take an argument called stringsAsFactors. See here: https://readxl.tidyverse.org/reference/read_excel.html

(If none of my guesses were right then the best way to clear up the confusion will definitely be a reprex!)

2 Likes

Ah, so the error is what you're getting and the table is how the data looks in Excel? I think @jcblum is putting you on the right track :slight_smile:

I've also never seen a StringsAsFactors argument where the S was capitalized. Everywhere I've seen it used, it is stringsAsFactors.

Of course, that won't help with read_xls, but it was the other thing I noticed.

2 Likes