[R] Reading data with blank elements
ggrothendieck at gmail.com
Fri Jul 21 14:56:07 CEST 2006
See if this works:
read.csv("datafile.csv", row.names = 1, fill = TRUE)
On 7/21/06, Ahamarshan jn <ashgene at yahoo.co.in> wrote:
> I have a dataset saved in *.csv format, that contains
> 13 columns (the first column being the title name and
> the rest experiments) and about 2500 rows.
> Not all columns in the row have data in it
> i.e for eg
> I am using R to perform a correlation, but I am
> getting an error while trying to read the data as
> Error in scan (file = file, what = what, sep = sep,
> quote = quote, dec = dec, :
> line 1919 did not have 13 elements
> Execution halted "
> The error looks as though there is a problem with the
> last element being not read when it is blank. I could
> introduce terms like "na" to the blank elements but I
> donot want to do that because this will hinder my
> future analysis.
> Can some one suggest me a solution to overcome this
> problem while reading the data? , or is there
> something that I have missed to make the data
> Thank you in advance,
> PS: The data was imported from a experiment and saved
> in excel sheet as a *.csv and then used.
> R-help at stat.math.ethz.ch mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help