[R] Problem:: Passing r list to java method as parameter
Hi Simon, I have some doubts in the function calling R. I am using the R 2.9.1 with window XP. I am passing the r list to the java method as a parameter. And then try to read this r list from java code. Is it possible that we can read the r list into the java code? My script and code are given below. setBTE<- function(...) { propString=match.call(expand.dots=F); propList=propString$...; propList library(rJava) .jinit(classpath="BTEApp.jar", parameters="-Xmx1100m") .jaddClassPath("/lib/commons-lang-2.0.jar") .jaddClassPath("/lib/jcommon-1.0.10.jar") .jaddClassPath("lib/jfreechart-1.0.6.jar") .jaddClassPath("/lib/jtds-1.2.jar") .jaddClassPath("/lib/log4j.jar") .jaddClassPath("/lib/util.jar") .jaddClassPath("/lib/JRI.jar") ss<-.jnew("com/bte/gui/HomePageBTE") .jcall(ss, "V", "initBTE", propList, check=FALSE) } My Java code is like: public void initBTE(RList propertyList) { bteLog.info("Calling The initBTECall method:"); String[] k = propertyList.keys(); if (k!=null) { int i=0; while (ihttps://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.
[R] FW: Qury Related With R
Hi, I am using the R-2.9.1 with Window XP. Queries: 1. I am running the java application which needs to load property file in R. So can you please tell me how I can load my property file in R session so that my application can find that property file? Attached is my property file for sample. 2. Is there any directory structure required for java application in R format? Thanks & Regards, Bed Singh From: ericdov...@gmail.com [mailto:ericdov...@gmail.com] On Behalf Of Eric Doviak Sent: Friday, July 24, 2009 8:42 PM To: bed.si...@oracle.com Subject: Re: Qury Related With R Hi Bed, I'm sorry. I simply don't know. Your best bet would be to ask on R-help: r-help@r-project.org Good luck, - Eric bed.si...@oracle.com wrote: Hi Eric, I am using the R-2.9.1 with Window XP. Queries: I am running the java application which needs to load app.property file in R. So can you please tell me how I can load my property file in R session so that my application can found that property file? Attached is my property file. Is there any directory structure required for java application in R format? Please help me. Thanks in Advance Eric. Regards, Oracle logo.gif Bed Singh | Associate Consultant | +91 22 6718 4955 (O) Oracle Financial Services PrimeSourcing Mumbai, India Oracle Financial Services Software Limited was formerly i-flex solutions limited. __ R-help@r-project.org 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: [R] FW: Qury Related With R
Hi Romain, Attached is my R script that script I put into the R work space and through source("RScriptToCallJava.R") command I call the script and my java application is execute. Is it the proper way to call the java application? If not, then please can you explain the directory structure that needs for java application? In java I used the property file. but when I load the property file using .jaddClassPath("D:/R_BTE_Jar/BTE/app.properties") command, it is not load. Thanks Romain for your response. Bed Singh -Original Message- From: Romain Francois [mailto:romain.franc...@dbmail.com] Sent: Saturday, July 25, 2009 6:32 PM To: bed.si...@oracle.com Cc: r-help@r-project.org Subject: Re: [R] FW: Qury Related With R Hi, The file did not make it through the mailing list. Maybe you are looking for ?read.dcf Can you describe the way your application interacts with R. Romain On 07/25/2009 10:35 AM, bed.si...@oracle.com wrote: > Hi, > > I am using the R-2.9.1 with Window XP. > Queries: > 1. I am running the java application which needs to load property file > in R. > So can you please tell me how I can load my property file in R > session so that my application can find that property file? > Attached is my property file for sample. > 2. Is there any directory structure required for java application in R > format? > > Thanks& Regards, > Bed Singh > > From: ericdov...@gmail.com [mailto:ericdov...@gmail.com] On Behalf Of Eric > Doviak > Sent: Friday, July 24, 2009 8:42 PM > To: bed.si...@oracle.com > Subject: Re: Qury Related With R > > > > Hi Bed, > > I'm sorry. I simply don't know. > Your best bet would be to ask on R-help: r-help@r-project.org > > > > Good luck, > - Eric > > bed.si...@oracle.com wrote: > > Hi Eric, > > I am using the R-2.9.1 with Window XP. > > Queries: > > I am running the java application which needs to load app.property file in R. > > So can you please tell me how I can load my property file in R session so > that my application can found that property file? > > Attached is my property file. > > Is there any directory structure required for java application in R format? > Please help me. Thanks in Advance Eric. > Regards, > > Oracle logo.gif > Bed Singh > Oracle Financial Services PrimeSourcing > Mumbai, India > Oracle Financial Services Software Limited was formerly i-flex solutions > limited. Romain Francois Independent R Consultant +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr |- http://tr.im/tlNb : RGG#155, 156 and 157 |- http://tr.im/rw0p : useR! slides `- http://tr.im/rw0b : RGG#154: demo of atomic functions __ R-help@r-project.org 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: [R] FW: Qury Related With R
Hi Romain, Exactly this is the script which I need. Thanks a lot for helping. Romain, Is there any way to modified a particular line in the property file through R script? If yes then please explain how. Cheers! BS -Original Message- From: Romain Francois [mailto:romain.franc...@dbmail.com] Sent: Monday, July 27, 2009 12:53 PM To: bed.si...@oracle.com Cc: r-help@r-project.org Subject: Re: [R] FW: Qury Related With R Hi, I think you can just do something like read the parameters into R, and then use the "parameters" argument of the .jinit function. Something like this perhaps: props <- readLines( "app.properties" ) props <- strsplit( gsub( "\\\t", "", grep( "=", props, value = TRUE ) ), "=" ) params <- sapply( props, function(x){ sprintf( "-D%s=%s", x[1], x[2] ) } ) library(rJava) .jinit(classpath="D:/R_BTE_Jar/BTE/BackTestingApp.jar", parameters= c( "-Xmx512m", params ) ) Let me know if this works. Romain On 07/27/2009 06:02 AM, bed.si...@oracle.com wrote: > Hi Romain, > > Attached is my R script that script I put into the R work space and > through source("RScriptToCallJava.R") command I call the script and my > java application is execute. > > Is it the proper way to call the java application? If not, then please > can you explain the directory structure that needs for java application? > > In java I used the property file. but when I load the property file > using .jaddClassPath("D:/R_BTE_Jar/BTE/app.properties") command, it is > not load. > > Thanks Romain for your response. > > Bed Singh > > -Original Message- > From: Romain Francois [mailto:romain.franc...@dbmail.com] > Sent: Saturday, July 25, 2009 6:32 PM > To: bed.si...@oracle.com > Cc: r-help@r-project.org > Subject: Re: [R] FW: Qury Related With R > > Hi, > > The file did not make it through the mailing list. Maybe you are looking > > for ?read.dcf > > Can you describe the way your application interacts with R. > > Romain > > On 07/25/2009 10:35 AM, bed.si...@oracle.com wrote: > > > Hi, > > > > > > I am using the R-2.9.1 with Window XP. > > > Queries: > > > 1. I am running the java application which needs to load property > file in R. > > > So can you please tell me how I can load my property file in R > session so that my application can find that property file? > > > Attached is my property file for sample. > > > 2. Is there any directory structure required for java application in > R format? > > > > > > Thanks& Regards, > > > Bed Singh > > > > > > From: ericdov...@gmail.com [mailto:ericdov...@gmail.com] On Behalf Of > Eric Doviak > > > Sent: Friday, July 24, 2009 8:42 PM > > > To: bed.si...@oracle.com > > > Subject: Re: Qury Related With R > > > > > > > > > > > > Hi Bed, > > > > > > I'm sorry. I simply don't know. > > > Your best bet would be to ask on R-help: r-help@r-project.org > > > > > > > > > > > > Good luck, > > > - Eric > > > > > > bed.si...@oracle.com wrote: > > > > > > Hi Eric, > > > > > > I am using the R-2.9.1 with Window XP. > > > > > > Queries: > > > > > > I am running the java application which needs to load app.property > file in R. > > > > > > So can you please tell me how I can load my property file in R > session so that my application can found that property file? > > > > > > Attached is my property file. > > > > > > Is there any directory structure required for java application in R > format? > > > Please help me. Thanks in Advance Eric. > > > > > Regards, > > > > > > Oracle logo.gif > > > Bed Singh > > > Oracle Financial Services PrimeSourcing > > > Mumbai, India > > > Oracle Financial Services Software Limited was formerly i-flex > solutions limited. > > Romain Francois > > Independent R Consultant > > +33(0) 6 28 91 30 30 > > http://romainfrancois.blog.free.fr > > |- http://tr.im/tlNb : RGG#155, 156 and 157 > > |- http://tr.im/rw0p : useR! slides > > `- http://tr.im/rw0b : RGG#154: demo of atomic functions > -- Romain Francois Independent R Consultant +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr |- http://tr.im/tlNb : RGG#155, 156 and 157 |- http://tr.im/rw0p : useR! slides `- http://tr.im/rw0b : RGG#154: demo of atomic functions __ R-help@r-project.org 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.
[R] Help ::Not able to Connect R to SQL Server 2000
Hi Simon, I am using the R 2.9.1 with Window XP. I have one query related with R to the database. I have successfully connected R to MS-Access. But when I tried to connect R to SQL Server 2000 then it throwing some class not found error. I tried the below script for R and try to connect to SQL Server 2000. > library(rJava) > library(DBI) > library(RJDBC) > drv<-JDBC("com.microsoft.jdbc.sqlserver.SQLServerDriver") Error in .jfindClass(as.character(driverClass)[1]) : class not found Can you please help me in this? Thanks to you. Regards. BS [[alternative HTML version deleted]] __ R-help@r-project.org 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: [R] Help ::Not able to Connect R to SQL Server 2000
Hi Simon, Now I am able to connect my SQL Server2000 from R using RODBC as you told me in the last line of your mail. Thanks a lot to you Simon for helping. Now I feel better than before. J Cheers!! BS -Original Message- From: Simon Urbanek [mailto:simon.urba...@r-project.org] Sent: Thursday, August 06, 2009 10:40 PM To: bed.si...@oracle.com Cc: r-help@r-project.org Subject: Re: Help ::Not able to Connect R to SQL Server 2000 On Aug 6, 2009, at 10:36 , bed.si...@oracle.com wrote: > Hi Simon, > > I am using the R 2.9.1 with Window XP. > I have one query related with R to the database. I have successfully > connected R to MS-Access. > But when I tried to connect R to SQL Server 2000 then it throwing some class > not found error. > I tried the below script for R and try to connect to SQL Server 2000. > library(rJava) > library(DBI) > library(RJDBC) > drv<-JDBC("com.microsoft.jdbc.sqlserver.SQLServerDriver") > Error in .jfindClass(as.character(driverClass)[1]) : class not found > Can you please help me in this? Thanks to you. I suspect that you'll need to load the corresponding drivers. The message essentially tells you that the driver (class) you're trying to load is not known. I don't use Windows (and even less so SQL Server), so I'd suggest you search for JDBC and MS SQL Server and/or ask on the SIG-DB mailing list (although this is technically not an R question). With some luck there may be some MS SQL users on this list as well.. However, if you are on Windows, you may want to go directly to ODBC using RODBC instead of going through JDBC. Cheers, Simon [[alternative HTML version deleted]] __ R-help@r-project.org 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.