[R] R import glitch "missing data"

David Winsemius dwinsemius at comcast.net
Thu May 26 20:06:10 CEST 2011


On May 26, 2011, at 1:59 PM, Peter Langfelder wrote:

> On Thu, May 26, 2011 at 10:03 AM, StatBat2
> <NStruckmeier at harryanddavid.com> wrote:
>> Hello!
>>
>> I am trying import data into R and im running into a snag.
>>
>> GOAL:
>> Import a 4 column, 8,000 row table into R including headers.
>>
>> WHAT I'VE ATTEMPTED:
>> Original data was in Excel format.
>> Converted data to both a .txt and .csv (to see which worked better)
>> Imported data into R via commands as object "demand" (see below)
>>
>> Please excuse the long file path.
>> demand=read.delim("C:\\Documents and Settings\\E066582\\My
>> Documents\\R\\R-2.13.0\\bin\\demand.txt")
>>
>> demand=read.csv(("C:\\Documents and Settings\\E066582\\My
>> Documents\\R\\R-2.13.0\\bin\\demand.csv", header=True)

>>
>> In both cases, about half to three fourths of my data shows up as  
>> object
>> "demand". My headers also fail to appear.

True != TRUE    .... and  the default for read.csv is header =TRUE


>> I get about 4000 lines of my table
>> as well as missing headers. I've tried different variations on the  
>> synatx of
>> how i go about importing, with or without headers designated, with or
>> without .csv ',' designation, but nothing changes. I'm at a loss as  
>> to what
>> is incorrect.
>
> Do you  get any error or warning messages?
>
> Are there any apostrophes (') in your data? These can cause mayhem. If
> you have any, use the argument
> quote = "\"".

Any "#" characters may mess things up, too.
>
> HTH,
>
> Peter


David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list