Hi,
I've completely forgotten how to do R, and it seems I can't even load
simple files correctly.
I have two tab deliminated text files (attached, these were test files
of the larger data files I'm trying to work with) that I am trying to
load into R so that I can merge them. They were originally excel files
but I used "saved as" to reformat to text. I don't know if
it's
relevant, but I use a mac.
These are the error messages I get:
> source("/Users/jiayingmei/Desktop/R/Testdate.txt")
Error in eval.with.vis(expr, envir, enclos) : object "Date" not found
Error in source("/Users/jiayingmei/Desktop/R/Testinput.txt") :
/Users/jiayingmei/Desktop/R/Testinput.txt: unexpected symbol at
1: Date France
I'm sure its something simple that is causing this, but I've been away
from R very long, and I've been trying to pick it up today, sorry if
this is a stupid post. I even tried to shift through some of the guides
and manuals out there, but I can't seem to find help regarding loading a
file (or placing them in some directory so that R can find them). I know
I've been taught this most simplest of things, but obviously I've
forgotten just about everything.
Jia Ying Mei
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Testdate.txt
URL:
<https://stat.ethz.ch/pipermail/r-help/attachments/20080722/12d546ff/attachment.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Testinput.txt
URL:
<https://stat.ethz.ch/pipermail/r-help/attachments/20080722/12d546ff/attachment-0001.txt>
setwd("c:\\temp")
#you need to insert a ENTER after your last value> df1<-read.table("testinput.txt", head=T, sep="\t")
> df1
Date France Germany
1 3/15/07 1 2
2 3/10/07 2 4
> df2<-read.table("testdate.txt", head=T, sep="\t")
> df2
Date
1 3/15/07
2 3/14/07
3 3/13/07
4 3/12/07
5 3/11/07
6 3/10/07
and don“t forgot to include and ENTER after last value.
Hope this helps,
Miltinho Astronauta
brazil
On 7/23/08, Jia Ying Mei <jiamei@princeton.edu>
wrote:>
> Hi,
>
> I've completely forgotten how to do R, and it seems I can't even
load
> simple files correctly.
>
> I have two tab deliminated text files (attached, these were test files of
> the larger data files I'm trying to work with) that I am trying to load
into
> R so that I can merge them. They were originally excel files but I used
> "saved as" to reformat to text. I don't know if it's
relevant, but I use a
> mac.
>
> These are the error messages I get:
> > source("/Users/jiayingmei/Desktop/R/Testdate.txt")
> Error in eval.with.vis(expr, envir, enclos) : object "Date" not
found
>
> Error in source("/Users/jiayingmei/Desktop/R/Testinput.txt") :
> /Users/jiayingmei/Desktop/R/Testinput.txt: unexpected symbol at
> 1: Date France
>
> I'm sure its something simple that is causing this, but I've been
away from
> R very long, and I've been trying to pick it up today, sorry if this is
a
> stupid post. I even tried to shift through some of the guides and manuals
> out there, but I can't seem to find help regarding loading a file (or
> placing them in some directory so that R can find them). I know I've
been
> taught this most simplest of things, but obviously I've forgotten just
about
> everything.
>
> Jia Ying Mei
>
> Date
> 3/15/07
> 3/14/07
> 3/13/07
> 3/12/07
> 3/11/07
> 3/10/07
> Date France Germany
> 3/15/07 1 2
> 3/10/07 2 4
> ______________________________________________
> R-help@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<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>
>
>
[[alternative HTML version deleted]]
Jia Ying Mei If I understand you correctly I think you need read.table(). Try: ?read.table and note the sep argument (sep='\t') HTH ..... Peter Alspach> -----Original Message----- > From: r-help-bounces at r-project.org > [mailto:r-help-bounces at r-project.org] On Behalf Of Jia Ying Mei > Sent: Wednesday, 23 July 2008 3:43 p.m. > To: r-help at r-project.org > Subject: [R] Can't Load Text Files > > Hi, > > I've completely forgotten how to do R, and it seems I can't > even load simple files correctly. > > I have two tab deliminated text files (attached, these were > test files of the larger data files I'm trying to work with) > that I am trying to load into R so that I can merge them. > They were originally excel files but I used "saved as" to > reformat to text. I don't know if it's relevant, but I use a mac. > > These are the error messages I get: > > source("/Users/jiayingmei/Desktop/R/Testdate.txt") > Error in eval.with.vis(expr, envir, enclos) : object "Date" not found > > Error in source("/Users/jiayingmei/Desktop/R/Testinput.txt") : > /Users/jiayingmei/Desktop/R/Testinput.txt: unexpected symbol at > 1: Date France > > I'm sure its something simple that is causing this, but I've > been away from R very long, and I've been trying to pick it > up today, sorry if this is a stupid post. I even tried to > shift through some of the guides and manuals out there, but I > can't seem to find help regarding loading a file (or placing > them in some directory so that R can find them). I know I've > been taught this most simplest of things, but obviously I've > forgotten just about everything. > > Jia Ying Mei >The contents of this e-mail are privileged and/or confidential to the named recipient and are not to be used by any other person and/or organisation. If you have received this e-mail in error, please notify the sender and delete all material pertaining to this e-mail.