Re: [R] Question on Import

From: Alexander Engelhardt <alex_at_chaotic-neutral.de>
Date: Mon, 25 Apr 2011 10:53:26 +0200

Am 25.04.2011 09:58, schrieb Georgina Salazar:
> Hi!
>
> I have the data in a tab delimited text file titled "ken_data_try_anova." I
> tried to import it into R entering
>
>> read.delim(ken_data_try_anova)
>
> but received the error message
>
> Error in read.table(file = file, header = header, sep = sep, quote = quote, :
> object 'ken_data_try_anova' not found
>
> I have another file called 10423nad.txt.
>
> I tried
>> data<-as.matrix(read.table(C:\Users\gtsalazar1979\Documents\TANOVA_1.0.0\10423nad.txt))
>> )

You shall escape filenames with quotes:
read.delim("ken_data_try_anova")

Otherwise R thinks you have a variable named ken_data_try_anova. But you need a string containing the filename (and the difference between strings and variables are the quotes).
The following, for example, would also work:

derp <- "ken_data_try_anova"
read.delim(derp)

What you also want to do, is not only read the table, but also store it in a data frame:

mydata <- read.delim("ken_data_try_anova")

Have fun,
  Alex



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Mon 25 Apr 2011 - 08:58:15 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 25 Apr 2011 - 09:50:32 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive