|
View:
New views
8 Messages
—
Rating Filter:
Alert me
|
|
|
RDCOMClient: how to close Excel process?Hi,
I’m using R package RDCOMClient (http://www.omegahat.org/RDCOMClient/) to retrieve data from MS Excel workbook. I’m using the code below to count the number of sheets in the workbook and then loop the data from sheets in to a list. ############# R code ################### library(gdata) library(RDCOMClient) xl <- COMCreate("Excel.Application") sh <- xl$Workbooks()$Open(normalizePath("sample_file.xls"))$Sheets()$Count() DF.list <- list() for (i in 1:sh) { DF.list[[i]] <- read.xls("sample_file.xls", sheet=i, stringsAsFactors = FALSE) } ###################################### COMCreate opens Excel process and it can be seen from Windows Task Manager. When I try to open sample_file.xls in Excel, it just flashes in the screen and shuts down. When I kill (via task manager) the Excel process COMCreate started, sample_file.xls will open normally. The question is, how can I close the Excel process COMCreate started. xl$Close() doesn’t seem to work. The same problem have been presented in this post to R-help: http://tolstoy.newcastle.edu.au/R/help/06/04/25990.html -L ______________________________________________ R-help@... 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. |
|
|
Re: RDCOMClient: how to close Excel process?Try this:
xl$Quit() On Wed, Jul 8, 2009 at 10:06 AM, Lauri Nikkinen <lauri.nikkinen@...>wrote: > Hi, > > Im using R package RDCOMClient (http://www.omegahat.org/RDCOMClient/) > to retrieve data from MS Excel workbook. Im using the code below to > count the number of sheets in the workbook and then loop the data from > sheets in to a list. > > ############# R code ################### > library(gdata) > library(RDCOMClient) > > xl <- COMCreate("Excel.Application") > sh <- > xl$Workbooks()$Open(normalizePath("sample_file.xls"))$Sheets()$Count() > > DF.list <- list() > for (i in 1:sh) { > DF.list[[i]] <- read.xls("sample_file.xls", sheet=i, > stringsAsFactors = FALSE) > } > ###################################### > > COMCreate opens Excel process and it can be seen from Windows Task > Manager. When I try to open sample_file.xls in Excel, it just flashes > in the screen and shuts down. When I kill (via task manager) the Excel > process COMCreate started, sample_file.xls will open normally. > > The question is, how can I close the Excel process COMCreate started. > xl$Close() doesnt seem to work. The same problem have been presented > in this post to R-help: > http://tolstoy.newcastle.edu.au/R/help/06/04/25990.html > > -L > > ______________________________________________ > R-help@... 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. > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O [[alternative HTML version deleted]] ______________________________________________ R-help@... 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. |
|
|
Re: RDCOMClient: how to close Excel process?Thanks but that did not work. xl$Quit() does not kill the Excel
process and sample_file.xls will not open. I'm using Windows XP SP2 and R 2.8.1 -L 2009/7/8 Henrique Dallazuanna <wwwhsd@...>: > Try this: > > xl$Quit() > > On Wed, Jul 8, 2009 at 10:06 AM, Lauri Nikkinen <lauri.nikkinen@...> > wrote: >> >> Hi, >> >> I’m using R package RDCOMClient (http://www.omegahat.org/RDCOMClient/) >> to retrieve data from MS Excel workbook. I’m using the code below to >> count the number of sheets in the workbook and then loop the data from >> sheets in to a list. >> >> ############# R code ################### >> library(gdata) >> library(RDCOMClient) >> >> xl <- COMCreate("Excel.Application") >> sh <- >> xl$Workbooks()$Open(normalizePath("sample_file.xls"))$Sheets()$Count() >> >> DF.list <- list() >> for (i in 1:sh) { >> DF.list[[i]] <- read.xls("sample_file.xls", sheet=i, >> stringsAsFactors = FALSE) >> } >> ###################################### >> >> COMCreate opens Excel process and it can be seen from Windows Task >> Manager. When I try to open sample_file.xls in Excel, it just flashes >> in the screen and shuts down. When I kill (via task manager) the Excel >> process COMCreate started, sample_file.xls will open normally. >> >> The question is, how can I close the Excel process COMCreate started. >> xl$Close() doesn’t seem to work. The same problem have been presented >> in this post to R-help: >> http://tolstoy.newcastle.edu.au/R/help/06/04/25990.html >> >> -L >> >> ______________________________________________ >> R-help@... 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. > > > > -- > Henrique Dallazuanna > Curitiba-Paraná-Brasil > 25° 25' 40" S 49° 16' 22" O > ______________________________________________ R-help@... 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. |
|
|
Re: RDCOMClient: how to close Excel process?Then, you can try this:
xl <- COMCreate("Excel.Application") wk <- xl$Workbooks() sh <- wk$Open(normalizePath("sample_file.xls"))$Sheets()$Count() wk$Close() xl$Quit() On Wed, Jul 8, 2009 at 10:19 AM, Lauri Nikkinen <lauri.nikkinen@...>wrote: > Thanks but that did not work. xl$Quit() does not kill the Excel > process and sample_file.xls will not open. > > I'm using Windows XP SP2 and R 2.8.1 > > -L > > 2009/7/8 Henrique Dallazuanna <wwwhsd@...>: > > Try this: > > > > xl$Quit() > > > > On Wed, Jul 8, 2009 at 10:06 AM, Lauri Nikkinen <lauri.nikkinen@...> > > wrote: > >> > >> Hi, > >> > >> Im using R package RDCOMClient (http://www.omegahat.org/RDCOMClient/) > >> to retrieve data from MS Excel workbook. Im using the code below to > >> count the number of sheets in the workbook and then loop the data from > >> sheets in to a list. > >> > >> ############# R code ################### > >> library(gdata) > >> library(RDCOMClient) > >> > >> xl <- COMCreate("Excel.Application") > >> sh <- > >> xl$Workbooks()$Open(normalizePath("sample_file.xls"))$Sheets()$Count() > >> > >> DF.list <- list() > >> for (i in 1:sh) { > >> DF.list[[i]] <- read.xls("sample_file.xls", sheet=i, > >> stringsAsFactors = FALSE) > >> } > >> ###################################### > >> > >> COMCreate opens Excel process and it can be seen from Windows Task > >> Manager. When I try to open sample_file.xls in Excel, it just flashes > >> in the screen and shuts down. When I kill (via task manager) the Excel > >> process COMCreate started, sample_file.xls will open normally. > >> > >> The question is, how can I close the Excel process COMCreate started. > >> xl$Close() doesnt seem to work. The same problem have been presented > >> in this post to R-help: > >> http://tolstoy.newcastle.edu.au/R/help/06/04/25990.html > >> > >> -L > >> > >> ______________________________________________ > >> R-help@... 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. > > > > > > > > -- > > Henrique Dallazuanna > > Curitiba-Paraná-Brasil > > 25° 25' 40" S 49° 16' 22" O > > > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O [[alternative HTML version deleted]] ______________________________________________ R-help@... 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. |
|
|
Re: RDCOMClient: how to close Excel process?Thanks again. That did not work either. I get
> library(RDCOMClient) > xl <- COMCreate("Excel.Application") > wk <- xl$Workbooks() > sh <- wk$Open(normalizePath("sample_file.xls"))$Sheets()$Count() > > wk$Close() [1] TRUE > xl$Quit() NULL > and there is still Excel process open in the Task manager (and sample_file.xls won't open). -L 2009/7/8 Henrique Dallazuanna <wwwhsd@...>: > Then, you can try this: > > xl <- COMCreate("Excel.Application") > wk <- xl$Workbooks() > sh <- wk$Open(normalizePath("sample_file.xls"))$Sheets()$Count() > > wk$Close() > xl$Quit() > > > > On Wed, Jul 8, 2009 at 10:19 AM, Lauri Nikkinen <lauri.nikkinen@...> > wrote: >> >> Thanks but that did not work. xl$Quit() does not kill the Excel >> process and sample_file.xls will not open. >> >> I'm using Windows XP SP2 and R 2.8.1 >> >> -L >> >> 2009/7/8 Henrique Dallazuanna <wwwhsd@...>: >> > Try this: >> > >> > xl$Quit() >> > >> > On Wed, Jul 8, 2009 at 10:06 AM, Lauri Nikkinen <lauri.nikkinen@...> >> > wrote: >> >> >> >> Hi, >> >> >> >> I’m using R package RDCOMClient (http://www.omegahat.org/RDCOMClient/) >> >> to retrieve data from MS Excel workbook. I’m using the code below to >> >> count the number of sheets in the workbook and then loop the data from >> >> sheets in to a list. >> >> >> >> ############# R code ################### >> >> library(gdata) >> >> library(RDCOMClient) >> >> >> >> xl <- COMCreate("Excel.Application") >> >> sh <- >> >> xl$Workbooks()$Open(normalizePath("sample_file.xls"))$Sheets()$Count() >> >> >> >> DF.list <- list() >> >> for (i in 1:sh) { >> >> DF.list[[i]] <- read.xls("sample_file.xls", sheet=i, >> >> stringsAsFactors = FALSE) >> >> } >> >> ###################################### >> >> >> >> COMCreate opens Excel process and it can be seen from Windows Task >> >> Manager. When I try to open sample_file.xls in Excel, it just flashes >> >> in the screen and shuts down. When I kill (via task manager) the Excel >> >> process COMCreate started, sample_file.xls will open normally. >> >> >> >> The question is, how can I close the Excel process COMCreate started. >> >> xl$Close() doesn’t seem to work. The same problem have been presented >> >> in this post to R-help: >> >> http://tolstoy.newcastle.edu.au/R/help/06/04/25990.html >> >> >> >> -L >> >> >> >> ______________________________________________ >> >> R-help@... 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. >> > >> > >> > >> > -- >> > Henrique Dallazuanna >> > Curitiba-Paraná-Brasil >> > 25° 25' 40" S 49° 16' 22" O >> > > > > > -- > Henrique Dallazuanna > Curitiba-Paraná-Brasil > 25° 25' 40" S 49° 16' 22" O > ______________________________________________ R-help@... 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. |
|
|
Re: RDCOMClient: how to close Excel process?Lauri Nikkinen wrote:
> Thanks again. That did not work either. I get > >> library(RDCOMClient) >> xl <- COMCreate("Excel.Application") >> wk <- xl$Workbooks() >> sh <- wk$Open(normalizePath("sample_file.xls"))$Sheets()$Count() >> >> wk$Close() > [1] TRUE >> xl$Quit() > NULL > > and there is still Excel process open in the Task manager (and > sample_file.xls won't open). > > -L In my experience, the Excel process will not go away if any Excel-related object has been created but not destroyed. I suggest that you explictly remove all Excel objects with rm() and run gc() at the end to clean up: library(RDCOMClient) xl <- COMCreate("Excel.Application") wk <- xl$Workbooks() sh<-wk$Open(normalizePath("sample_file.xls"))$Sheets()$Count() wk$Close() xl$Quit() rm(sh) rm(wk) rm(xl) gc() J. R. M. Hosking ______________________________________________ R-help@... 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. |
|
|
Re: RDCOMClient: how to close Excel process?This solution worked:
nBooks <- xl[["Workbooks"]]$Count(); for (i in seq_len(nBooks)) xl[["Workbooks"]]$item(i)$Close(SaveChanges=FALSE); from http://www.mail-archive.com/r-help@.../msg61498.html Thanks! -L 2009/7/9 Lauri Nikkinen <lauri.nikkinen@...>: > Thanks again. That did not work either. I get > >> library(RDCOMClient) >> xl <- COMCreate("Excel.Application") >> wk <- xl$Workbooks() >> sh <- wk$Open(normalizePath("sample_file.xls"))$Sheets()$Count() >> >> wk$Close() > [1] TRUE >> xl$Quit() > NULL >> > > and there is still Excel process open in the Task manager (and > sample_file.xls won't open). > > -L > > 2009/7/8 Henrique Dallazuanna <wwwhsd@...>: >> Then, you can try this: >> >> xl <- COMCreate("Excel.Application") >> wk <- xl$Workbooks() >> sh <- wk$Open(normalizePath("sample_file.xls"))$Sheets()$Count() >> >> wk$Close() >> xl$Quit() >> >> >> >> On Wed, Jul 8, 2009 at 10:19 AM, Lauri Nikkinen <lauri.nikkinen@...> >> wrote: >>> >>> Thanks but that did not work. xl$Quit() does not kill the Excel >>> process and sample_file.xls will not open. >>> >>> I'm using Windows XP SP2 and R 2.8.1 >>> >>> -L >>> >>> 2009/7/8 Henrique Dallazuanna <wwwhsd@...>: >>> > Try this: >>> > >>> > xl$Quit() >>> > >>> > On Wed, Jul 8, 2009 at 10:06 AM, Lauri Nikkinen <lauri.nikkinen@...> >>> > wrote: >>> >> >>> >> Hi, >>> >> >>> >> I’m using R package RDCOMClient (http://www.omegahat.org/RDCOMClient/) >>> >> to retrieve data from MS Excel workbook. I’m using the code below to >>> >> count the number of sheets in the workbook and then loop the data from >>> >> sheets in to a list. >>> >> >>> >> ############# R code ################### >>> >> library(gdata) >>> >> library(RDCOMClient) >>> >> >>> >> xl <- COMCreate("Excel.Application") >>> >> sh <- >>> >> xl$Workbooks()$Open(normalizePath("sample_file.xls"))$Sheets()$Count() >>> >> >>> >> DF.list <- list() >>> >> for (i in 1:sh) { >>> >> DF.list[[i]] <- read.xls("sample_file.xls", sheet=i, >>> >> stringsAsFactors = FALSE) >>> >> } >>> >> ###################################### >>> >> >>> >> COMCreate opens Excel process and it can be seen from Windows Task >>> >> Manager. When I try to open sample_file.xls in Excel, it just flashes >>> >> in the screen and shuts down. When I kill (via task manager) the Excel >>> >> process COMCreate started, sample_file.xls will open normally. >>> >> >>> >> The question is, how can I close the Excel process COMCreate started. >>> >> xl$Close() doesn’t seem to work. The same problem have been presented >>> >> in this post to R-help: >>> >> http://tolstoy.newcastle.edu.au/R/help/06/04/25990.html >>> >> >>> >> -L >>> >> >>> >> ______________________________________________ >>> >> R-help@... 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. >>> > >>> > >>> > >>> > -- >>> > Henrique Dallazuanna >>> > Curitiba-Paraná-Brasil >>> > 25° 25' 40" S 49° 16' 22" O >>> > >> >> >> >> -- >> Henrique Dallazuanna >> Curitiba-Paraná-Brasil >> 25° 25' 40" S 49° 16' 22" O >> > ______________________________________________ R-help@... 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. |
|
|
SSOAP failureHi, Im using R package SSOAP to retrieve data from web services. Im using the code below to > >> >> ############# R code ################### library(SSOAP) then I call the nwis.R which exists in SSOAP example folder. However system gives me following errors: Error in parse (text=paste(text, collapse=\n)): Unexpected input in function (x ,obj=new( I could not understand why I get this error. I am very appreciate anybody help me. nermin _________________________________________________________________ [[alternative HTML version deleted]] ______________________________________________ R-help@... 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. |
| Free embeddable forum powered by Nabble | Forum Help |