[Rd] append within worksheet in write.xls
Hans-Peter
gchappi at gmail.com
Mon Feb 12 10:50:43 CET 2007
Hi,
2007/2/9, Mark W Kimpel <mwkimpel at gmail.com>:
> I can currently append an entire worksheet with write.xls, but would
> also like to be able to append within the same worksheet. Is this
> possible?
Of course. Please see ?xls.open, ?xls.sheet and ?write.xls (note the
'keep' argument!). I give you a short example at the end of the email.
>It doesn't seem to work if I use append = T
I am not aware of an issue. Please post (better email) your code. BTW
the 'append' argument is only meant for single operations (the whole
sheet will be re-read and rewritten each time).
A last thing, such specific xlsReadWrite(Pro) questions are not very
on topic for the the r-devel list. I don't know for sure, but I
strongly suspect that this is not be appreciated here. It is probably
better you just email me.
Cheers,
Hans-Peter
--------
(the example is with read, but write is analogue)
rfile <- "TestReadDataFile.xls"
cat( "### TEST: xls.open and xls.close\n" )
exc <- xls.open( rfile )
res1 <- read.xls( exc,, 1, from = 3, cols = 1 )[[1]]
# switch to character sheet, check and read
xls.sheet( exc, "select", "characterSheet" )
# switch to logical sheet, check and read
xls.sheet( exc, "select", "logicalSheet" )
res1 <- read.xls( exc, type = "logical", from = 3, cols = 1 )
xls.close( exc )
cat( "### TEST: keep\n" )
# read first column from first sheet
res1 <- read.xls( rfile,, 1, from = 3, cols = 1, keep = TRUE )[[1]]
# switch to character sheet, check and read
xls.sheet( rfile, "select", "characterSheet", keep = TRUE )
# switch to logical sheet, check and read
xls.sheet( , "select", "logicalSheet", keep = TRUE )
# with the next command the file will be closed (without saving)
res1 <- read.xls( , type = "logical", from = 3, cols = 1, keep = FALSE )
More information about the R-devel
mailing list