[R] Missing values detected when there are no missing values

Petr Pikal petr.pikal at precheza.cz
Mon Apr 24 09:46:13 CEST 2006


Hi

On 22 Apr 2006 at 23:29, Bob Green wrote:

Date sent:      	Sat, 22 Apr 2006 23:29:02 +1000
To:             	r-help at stat.math.ethz.ch
From:           	Bob Green <bgreen at dyson.brisnet.org.au>
Subject:        	[R] Missing values detected when there are no missing values

> I am hoping for some advice on the following matters.
> 
> I have a csv data file with 153 variables x 92 rows.   To determine
> what the variables looked like I ran the summary command.  One
> variable had a large number of missing values  54/92.  For some
> reason, all subsequent 74 variables are reported as having 92 NA
> values, irrespective of whether the original csv variable was complete
> or not.

I have not seen any answer yet so I try to shot one.

first how do you know there is not any missing value in your csv 
file?

> 
> Below are the commands I ran:
> 
>  > study1dat <- read.csv("c:\\study1r.csv",header=T)
>  > attach(study1dat)
>  > names(study1dat)
>  > summary(study1dat)

You showed what you did but we can not know much about study1r.csv so 
my answer is only guess. Let's assume that csv was constructed from 
Excel, couldn't be a problem in its construction? Some space in some 
columns which are not seen in Excel but are exported to csv and read 
to R as NA values?

What does str(study1dat) say about your data?
And are there really "," vaues separators and "." decimal separators 
as required by read.csv?

> 
> The second puzzling issue, is that one variable with no missing values
> is reported in R as having 3 missing values, whereas there are no
> missing values in the csv file. The only errors in reading the data I
> received were:

Not when reading but when attaching data frame. Names in your data 
frame are same as names of some functions in mentioned packages, 
which is not an error, R just tell you that this had happened and you 
shall be avare of it.

HTH
Petr


> 
>     The following object(s) are masked from package:stats :
>           time
> 
>          The following object(s) are masked from package:graphics :
>           screen
> 
>          The following object(s) are masked from package:datasets :
>           sleep
> 
>          The following object(s) are masked from package:base :
>  pipe
> 
> I am happy to send the csv file if required. Any advice that can
> offered is appreciated,
> 
> Bob
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html

Petr Pikal
petr.pikal at precheza.cz




More information about the R-help mailing list