Skip to content

Question on Import

4 messages · Georgina Salazar, Gerrit Eichner, Jim Lemon +1 more

#
Hi!

I have the data in a tab delimited text file titled "ken_data_try_anova." I 
tried to import it into R entering
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
but got the error message
Error: unexpected input in "data<-as.matrix(read.table(C:\"

How do I place the data where the import function can find it? Or, how do I 
correct my use of the import functions?

Thank you for your time and patience! Any guidance toward a solution means a lot 
to me :)
Cheers, 
Georgina To'a Salazar
#
Hi, Georgina,

using quotation marks around the file name like in
might help.

  Hth -- Gerrit
On Mon, 25 Apr 2011, Georgina Salazar wrote:

            
#
On 04/25/2011 05:58 PM, Georgina Salazar wrote:
Try

read.delim("ken_data_try_anova")

If that doesn't work, turn off the "Hide extensions for known file 
types" option in Windows Explorer and find out what the extension for
this file is.
The single backslash doesn't work as a path delimiter in R. Try:

data<-as.matrix(read.table("C:\\Users\\gtsalazar1979\\Documents\\TANOVA_1.0.0\\10423nad.txt"))

or

data<-as.matrix(read.table("C:/Users/gtsalazar1979/Documents/TANOVA_1.0.0/10423nad.txt"))

That is, replace the backslashes with forward slashes (and don't forget 
the quotes)
Jim
#
Am 25.04.2011 09:58, schrieb Georgina Salazar:
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