Skip to content
Prev 318228 / 398503 Next

data.frame and import to xlsx

Hello,

Please keep the discussion on the list, the odds of you getting more and 
better answers is greater. (I'm Cceing to R-Help.)

What package is read_spectra in?
What type of object does it return? Can you post the result of the 
following instruction?

str(SP)  # paste the output of this.


If it's a data.frame then package XLConnect can do the job. The 
following code is the example in ?XLConnect::saveWorkbook adapted to a 
file named etch1.xlsx and to a dataset named SP.


#install.packages('XLConnect')  # do this only once
library(XLConnect)    # load it in the R session

# Create a new workbook 'etch1.xlsx'
# (assuming the file does not exist already)
wb <- loadWorkbook("etch1.xlsx", create = TRUE)

# Create a worksheet called 'SP'
createSheet(wb, name = "SP")

# Write dataset SP to sheet 'SP' created above
writeWorksheet(wb, SP, sheet = "SP")

# Save workbook - this actually writes the file 'etch1.xlsx' to disk
saveWorkbook(wb)



Hope this helps,

Rui Barradas


Em 24-02-2013 17:42, Sihem Ben Zakour escreveu: