Skip to content
Back to formatted view

Raw Message

Message-ID: <FED8182A-AC3E-40FC-8DD7-3C88CB01790D@comcast.net>
Date: 2012-08-15T23:34:50Z
From: David Winsemius
Subject: Import Data from Excel
In-Reply-To: <0A83C25F-DC57-40FC-B16D-0A276A79DC77@comcast.net>

On Aug 15, 2012, at 4:07 PM, David Winsemius wrote:

>
> On Aug 15, 2012, at 2:04 PM, li li wrote:
>
>> Dear all,
>>  I want to import just part of an excel data file into R.
>>  I would like to have the data imported without
>> rownames or colume names.
>> I used read.delim("clipboard", header=F).  Somehow even though
>> I added the argument "header=F", I still have the row names V1,  
>> V2, ...,
>> Does anyone know how to fix this?
>>  Thanks very much in advance.
>
> You could use readLines() or you could use scan().
>
> Perhaps:
>
> input <- scan(file="clipboard", what="numeric")
>
> If you know the number of columns, say 10, it could be:
>
> inpmat <- matrix( scan(file="clipboard", what="numeric"), ncol=10)

Or perhaps:

inpmat <- matrix( scan(file="clipboard", what=double() , ncol=10)

Using the first version actually gives you character values, since  
"numeric" is of of type character. Different convention than most  
other reading functions.

-- 
David Winsemius, MD
Alameda, CA, USA