Re: [R] unexpected results

From: Marc Schwartz <>
Date: Fri 21 Jul 2006 - 22:26:35 EST

On Fri, 2006-07-21 at 04:36 -0700, nathan wrote:
> Hi,
> I'm just learning R and am encountering some unexpected results following a
> guide on the internet. If anyone can help that would be great - I think it
> is something about the way the data has been read in!
> I've read a coma delimited text data file that was saved from excel:
> > <- read.table("/Users/natha/Desktop/JACSdata2.txt", header=TRUE,
> > sep=",")
> This seemed to work fine, but then I start to get unusual results that don't
> seem right:
> The guide says that names( will give output like "ID" "JURIS"

> The guide says that[5,1] will give me the data for the 5th subject
> but i get:
> VALUE $2000 OR LESS)\ etc - which seems scrambled
> The guide says that[var5>0] will give me the data for all subject
> who meet that condition (ie greater than 0 on var5), but I get:
> Error in "[.data.frame"(, offend > 0) :
> object "offend" not found
> can anyone help? Thanks nathan

It would appear that your data file is NOT comma delimited, but TAB delimited.

The "\t" characters in the output above support this, since you asked for just the first column for the 5th subject and it appears that you got the entire row.

Re-run the import using: <- read.table("/Users/natha/Desktop/JACSdata2.txt",

                        header=TRUE, sep = "\t")

so that you are indicating that the delimiter is a TAB character, not a comma.

HTH, Marc Schwartz mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Fri Jul 21 22:30:31 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sat 22 Jul 2006 - 00:16:13 EST.

Mailing list information is available at Please read the posting guide before posting to the list.