Marc, Thanks! x.num <- as.numeric(readClipboard()) works perfect.
  Meanwhile, I have tried to use odbcConnectExcel from RODBC pack. It seems
to work as well. I am able to read in the data, but I need to construct a
sql table from the data, and use sqlFetch to retrieve and assign them to
variable. More steps.

On 10/11/06, Marc Schwartz <[EMAIL PROTECTED]> wrote:
>
> Yulei,
>
> It would appear that the default mechanism for the function (which
> appears to be Windows specific) is to read in the data from the current
> system clipboard as a _character vector_. Thus, perhaps something like:
>
> x.num <- as.numeric(readClipboard())
>
> would be helpful.
>
> With respect to reading in Excel files, you cannot directly import Excel
> files using read.table() and friends. You can export from Excel to an
> ASCII delimited file and then use these functions.
>
> Alternatively, there is the read.xls() function in the 'gdata' CRAN
> package, which can directly read such files.
>
> I would strongly advise reviewing the R Import/Export Manual, which is
> available from the menus in the Windows GUI, as it will provide guidance
> in this area.
>
> HTH,
>
> Marc
>
> On Wed, 2006-10-11 at 14:25 -0400, Yulei Gong wrote:
> > Thanks, Marc,
> > I tried it and it didn't really work.
> > > x.num<-as.numeric(x)
> > > is.numeric(x.num)
> > [1] TRUE
> > > x.num<-readClipboard()
> > > is.numeric(x.num)
> > [1] FALSE
> > > is.character(x.num)
> > [1] TRUE
> >
> > I use readClipboard to take in data, and it seems after the data is
> > taken in, x.num changed to character.
> >
> > I just start using R, not familiar with the data import/export
> > functions...besides of that, I have a question about read.table, can
> > this function read in spreadsheet data? if so, is the excel file
> > supposed to put in the same directory with the R-2.4.0 folder?? Which
> > is what I did, but I got the following error
> > > read.table(bra5y.xls,header = TRUE, row.names = 2)
> > Error in read.table(bra5y.xls, header = TRUE, row.names = 2) :
> >         object "bra5y.xls" not found
> >
> > Pls help.
> >
> > Thanks!
>
>
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to