Change stringsAsFactors settings for data.frame

Viewed 67836

I have a function in which I define a data.frame that I use loops to fill with data. At some point I get the Warning message:

Warning messages: 1: In [<-.factor(*tmp*, iseq, value = "CHANGE") : invalid factor level, NAs generated

Therefore, when I define my data.frame, I'd like to set the option stringsAsFactors to FALSE but I don't understand how to do it.

I have tried:

DataFrame = data.frame(stringsAsFactors=FALSE)

And also:

options(stringsAsFactors=FALSE)

What is the correct way to set the stringsAsFactors option?

1 Answers
Related