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! ______________________________________________ [email protected] 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.
