Re: [R] Problems with reading data by readWorksheetFromFile of XLConnect Package

2013-05-03 Thread jpm miao
Hi Anthony, Thank you very much. It works very well. However, after this line temp - sapply( temp , as.numeric ) the data becomes a series of numbers instead of a matrix. Is there any way to keep it a matrix? Thanks, Miao temp-readWorksheetFromFile(130502temp.xlsx, sheet=1,

Re: [R] Problems with reading data by readWorksheetFromFile of XLConnect Package

2013-05-03 Thread Anthony Damico
sorry, i had assumed readWorksheetFromFile would give you back a data frame. all of the operations i recommended work on data.frame objects at different points in the code, check if it's a data.frame or a matrix.. class( temp ) ..you can check its current class at any point. and if it's a

Re: [R] Problems with reading data by readWorksheetFromFile of XLConnect Package

2013-05-03 Thread David Winsemius
On May 2, 2013, at 11:00 PM, jpm miao wrote: Hi Anthony, Thank you very much. It works very well. However, after this line temp - sapply( temp , as.numeric ) the data becomes a series of numbers instead of a matrix. Is there any way to keep it a matrix? Perhaps (assuming this

Re: [R] Problems with reading data by readWorksheetFromFile of XLConnect Package

2013-05-03 Thread jim holtman
you can also try: temp[] - lapply(temp, as.numeric) On Fri, May 3, 2013 at 11:54 AM, David Winsemius dwinsem...@comcast.netwrote: On May 2, 2013, at 11:00 PM, jpm miao wrote: Hi Anthony, Thank you very much. It works very well. However, after this line temp - sapply( temp ,

Re: [R] Problems with reading data by readWorksheetFromFile of XLConnect Package

2013-05-02 Thread Anthony Damico
try adding colTypes = 'numeric' to your readWorkSheetFromFile() call if that doesn't work, try a few other steps # view what data types your file is being read in as sapply( temp , class ) # convert all fields to character if they're factor variables.. but i don't think you need this,

[R] Problems with reading data by readWorksheetFromFile of XLConnect Package

2013-05-01 Thread jpm miao
Hi, Attached are two datasheet to be read. My raw data 130502temp.xlsx contains numbers with ' symbols, and they can't be read as numbers. Even if I copy and paste as numbers to form a new file 130502temp_number1.xlsx, they could not be read smoothly. 1. How can I read the datasheet as