Skip to content

Help please

2 messages · Jim Lemon, Bert Gunter

#
Hi Rabby,
Before you run your regression, try this:

is.factor(Final$Cor)

If this returns TRUE, then this variable is a factor and it will be
treated as a number of levels rather than a set of numeric values.
This usually happens when a text file is read in and there is at least
one value that cannot be converted to numeric. So if you are doing
something like this:

Final<-read.csv("Final.csv")

Try this:

Final<-read.csv("Final.csv",stringsAsFactors=FALSE)
Final$Cor<-as.numeric(Final$Cor)

If there is at least one NA value in Final$Cor, that is probably what
is causing your problem.

Jim
On Mon, Jun 26, 2017 at 9:38 AM, Sarpong, Rabby <es927716 at ohio.edu> wrote:
#
On Sun, Jun 25, 2017 at 5:29 PM, Jim Lemon <drjimlemon at gmail.com> wrote:
I don't think so. If Final$Cor is numeric to begin with, there should
be no problem with NA's. Commas or other stray characters might be the
problem, however. As always, consulting ?read.csv should be the first
stop.

The OP would probably benefit by spending some time with an R tutorial
or two(there are many good ones on teh web), I think, where such
issues are often discussed.

Cheers,
Bert