Re: [R] Value-at-Risk Portfolio(both equity and option)

2010-03-31 Thread Cedrick Johnson
One thing that comes to mind immediately is the 'blotter' package
which I believe is designed to handle and track multiple instruments.

A sloppy temporary solution I guess would be to do some type of lookup
or a flag that denotes which instrument is an option and apply the VaR
methodology appropriately. I am not in front of my desktop for now,
else I would dig around the blotter code to evaluate a proposal to
handle the scenario you mention.

Perhaps some people who have done more work with these types of issues
can shed more light on this.

Hth
-c

On 3/31/10, zhang yn19...@msn.com wrote:

 Thank you very much. It is very helpful. As far as I understand, not easy to
 have a function to combine both the equity part and the option part?
 --
 View this message in context:
 http://n4.nabble.com/Value-at-Risk-Portfolio-both-equity-and-option-tp1745179p1746520.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 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.


-- 
Sent from my mobile device

__
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] time series datasets

2010-03-31 Thread Cedrick Johnson
What kind of time series data? Finance? Econometrics?

The 'quantmod' package allows for downloading of stock and FRED data
online for analysis. I believe PerformanceAnalytics also has some
datasets as well.

-c

On 3/31/10, vibha patel vibhapatel...@gmail.com wrote:
 Hello,

 I am searching large multivariate time series datasets to use with R.

 Can any one help me???


 Regards,
 Vibha

   [[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.


-- 
Sent from my mobile device

__
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] Value-at-Risk Portfolio(both equity and option)

2010-03-30 Thread Cedrick Johnson
Check out this discussion on r-sig-finance regarding VaR for options.
Quite informative and should be a good starting point.

-c

On 3/30/10, zhang yn19...@msn.com wrote:

 Hello All,

 I am working on the risk measures for a portfolio, which contain both equity
 futures, equity options and currency options. There are many packages
 related with the portoflio which only contain the equities,I wonder whether
 there is any avaible package that could include the option.

 Thank you.
 --
 View this message in context:
 http://n4.nabble.com/Value-at-Risk-Portfolio-both-equity-and-option-tp1745179p1745179.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 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.


-- 
Sent from my mobile device

__
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] Value-at-Risk Portfolio(both equity and option)

2010-03-30 Thread Cedrick Johnson
It would help if I included the link:

http://n4.nabble.com/VaR-for-path-dependent-option-portfolio-td1676787.html

-c

On 3/30/10, Cedrick Johnson cedr...@cedrickjohnson.com wrote:
 Check out this discussion on r-sig-finance regarding VaR for options.
 Quite informative and should be a good starting point.

 -c

 On 3/30/10, zhang yn19...@msn.com wrote:

 Hello All,

 I am working on the risk measures for a portfolio, which contain both
 equity
 futures, equity options and currency options. There are many packages
 related with the portoflio which only contain the equities,I wonder
 whether
 there is any avaible package that could include the option.

 Thank you.
 --
 View this message in context:
 http://n4.nabble.com/Value-at-Risk-Portfolio-both-equity-and-option-tp1745179p1745179.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 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.


 --
 Sent from my mobile device


-- 
Sent from my mobile device

__
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] Forecast

2010-03-10 Thread Cedrick Johnson
?forecast
Maybe ?xts or ?timeSeries if you need to adjust dates, etc.

On 3/11/10, chinna durgache...@gmail.com wrote:

 sample report data that i want to forecast

 quarter quarter_index Revenue
 2007 Q1   1  $3,856,799
 2007 Q2   2  $4,243,328
 2007 Q3   3  $4,930,369
 2007 Q4   4  $5,443,579
 2008 Q1   5  $5,164,830
 2008 Q2   6  $5,104,413
 2008 Q3   7  $5,713,240
 2008 Q4   8  $6,509,331
 2009 Q1   9  $6,271,951
 2009 Q2   10$6,657,190
 2009 Q3   11$6,979,821
 2009 Q4   12$7,581,619


 (Using the first report i want to generate the below report using R) is it
 possible?
 forecasted report for the year 2010

 quarter  Revenue  Revenue Predictor
 2007 Q1 $3,856,799   $4,032,525
 2007 Q2 $4,243,328   $4,032,525
 2007 Q3 $4,930,369   $4,032,525
 2007 Q4 $5,443,579   $4,032,525
 2008 Q1 $5,164,830   $4,032,525
 2008 Q2 $5,104,413   $4,032,525
 2008 Q3 $5,713,240   $4,032,525
 2008 Q4 $6,509,331   $4,032,525
 2009 Q1 $6,271,951   $4,032,525
 2009 Q2 $6,657,190   $4,032,525
 2009 Q3 $6,979,821   $4,032,525
 2009 Q4 $7,581,619   $4,032,525
 2010 Q1   $4,032,525
 2010 Q2   $4,032,525
 2010 Q3   $4,032,525
 2010 Q4   $4,032,525

 This is the forecasted report that i get using the reporting tool cognos(BI
 Reporting Tool).
 is this is possible with the R project.
 If possible can u please tell me the way.


 Thanks in advance
 chinna.
 --
 View this message in context:
 http://n4.nabble.com/Forecast-tp1588501p1588501.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 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.


-- 
Sent from my mobile device

__
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] Three most useful R package

2010-03-02 Thread Cedrick Johnson
I think it depends on your particular domain, mine is in finance:

Quantmod
PerformanceAnalytics
And Diethelm Wuertz's collection of packages (fOptions, fPortfolio,etc)

Rgds,
C

On 3/2/10, Ralf B ralf.bie...@gmail.com wrote:
 Hi R-fans,

 I would like put out a question to all R users on this list and hope
 it will create some feedback and discussion.

 1) What are your 3 most useful R package? and

 2) What R package do you still miss and why do you think it would make
 a useful addition?

 Pulling answers together for these questions will serve as a guide for
 new users and help people who just want to get a hint where to look
 first. Happy replying!

 Best,
 Ralf

 __
 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.


-- 
Sent from my mobile device

__
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] Quantmod error

2010-01-20 Thread Cedrick Johnson

Can you ping the host 'finance.google.com' ??

The error msg is right there, Unable to Resolve

-c

I just tried it now:
 getSymbols(GOOG, src=google)
[1] GOOG
 head(GOOG)
  GOOG.Open GOOG.High GOOG.Low GOOG.Close GOOG.Volume
2007-01-03466.00476.66   461.11 467.59 7527500
2007-01-04469.00483.95   468.35 483.26 7787700
2007-01-05482.50487.50   478.11 487.19 6769400




Jose Narillos de Santos wrote:

Hi all I have installed quantmod package but when I try to obtain GOOG data
appers this message: Can anyone inform why itappears?

I type getSymbols(GOOG,src=google)
Thanks and Best Regards for all

Error en download.file(paste(google.URL, q=, Symbols.name, startdate=,
:
  no fue posible abrir la URL '
http://finance.google.com/finance/historical?q=GOOGstartdate=Jan+01,+2007enddate=Jan+20,+2010output=csv
'
In download.file(paste(google.URL, q=, Symbols.name, startdate=,  :
  unable to resolve 'finance.google.com'

[[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.



__
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] Java to R interface.

2009-09-25 Thread Cedrick Johnson

You could also try Rserve

http://www.rforge.net/Rserve/

-cj


vikrant S wrote:

I want to call R functions from Java. I read a couple of forums that said to
install package rJava in R.
However I am not able to install rJava package in linux Ubuntu.I tried with
two commands.
One is
install.packages(rJava)

and another I downloaded the rJava_0.7-0.tar.gz file from R site.
and gave the command R CMD INSTALL rJava_0.7-0.tar.gz.
 I got the followin Errors :- 



Warning in install.packages(rJava) :
  argument 'lib' is missing: using
'/home/vikrant/R/i486-pc-linux-gnu-library/2.9'
trying URL 'http://cran.uk.r-project.org/src/contrib/rJava_0.7-0.tar.gz'
Content type 'application/x-gzip' length 249486 bytes (243 Kb)
opened URL
==
downloaded 243 Kb

* Installing *source* package ‘rJava’ ...
mv: cannot move `/home/vikrant/R/i486-pc-linux-gnu-library/2.9/rJava' to
`/home/vikrant/R/i486-pc-linux-gnu-library/2.9/00LOCK/rJava': Permission
denied
checking for gcc... gcc -std=gnu99
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o

checking whether we are using the GNU C compiler... yes
checking whether gcc -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -std=gnu99 -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for string.h... (cached) yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for unistd.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking whether time.h and sys/time.h may both be included... yes
configure: checking whether gcc -std=gnu99 supports static inline...
yes
checking Java support in R... present:
interpreter : '/usr/bin/java'
archiver: '/usr/bin/jar'
compiler: '/usr/bin/javac'
header prep.: '/usr/bin/javah'
cpp flags   : '-I/usr/lib/jvm/java-6-openjdk/jre/../include'
java libs   : '-L/usr/lib/jvm/java-6-openjdk/jre/lib/i386/client
-L/usr/lib/jvm/java-6-openjdk/jre/lib/i386
-L/usr/lib/jvm/java-6-openjdk/jre/../lib/i386 -L
-L/usr/java/packages/lib/i386 -L/lib -L/usr/lib -L/usr/lib/jni -ljvm'
checking whether JNI programs can be compiled... yes
checking JNI data types... configure: error: One or more JNI types differ
from the corresponding native type. You may need to use non-standard
compiler flags or a different compiler in order to fix this.
ERROR: configuration failed for package ‘rJava’

Please Help me to install rJava. and anyone Could u suggest Is there any
better way to call R from Java
And provide me the tutorial for the same ?
Thanks in Advance




__
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] run R script automatically by double-clicking WinXP desktop icon

2009-09-22 Thread Cedrick Johnson

Here's something I use (in a batch file):

Rterm --no-restore --file=EveningStartup.r


Change EveningStartup.r to your particular file. When you create the 
shortcut, make sure to set the working directory to where your R script 
is located. Then in your file, you could have the graphs write out to a 
png file in a specified directory.


hth
c




cr...@binghamton.edu wrote:

I've written a simple script that does some surveillance analysis on daily 
counts of walk-in clinic visits, for our county health department. (Actually, 
Michael Hohle's surveillance package does all the work; I just customized it a 
little to work with the way our data are recorded.) The output consists of a 
graph and a little table.

My colleague will run it once in a while, on continuously updated data. She knows nothing 
about R, at least not yet. I want to make it as simple as possible. Rather than have her 
open R and type source(filename), I want to be able to put an icon on her 
WinXP desktop, so that when she double-clicks it, R will open, run the script, and up 
pops the graph.

I've been trying to learn about R CMD BATCH, playing with the dialogue boxes 
for WinXP desktop shortcuts, etc, but no luck so far. I guess I don't know 
enough about Windows.

Can anyone tell me how to do this?  Thanks.

--Chris Ryan

__
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@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] Which one shall I use? '=' or '-'?

2009-09-16 Thread Cedrick Johnson
I don't have the link off the top of my head, but if you search the 
archives and look for 'R Google Style Guide' or 'Google R Style' there 
was quite an interesting conversation thread regarding the use of the 
two, mostly for readability purposes...


-cj

Peng Yu wrote:

Hi,

I was told to use  - instead of = in the mailing list. I am
wondering what the difference between them?

Regards,
Peng

__
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@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] cluster-lite

2009-09-15 Thread Cedrick Johnson
perhaps a long shot but maybe the package 'nws' could handle some of it. 
I've recently begun looking into something similar lately as well.


-c

ivo welch wrote:

I am about to write a cluster-lite R solution for myself.  I wanted to
know whether it already exists.  If not, I will probably write up how I do
this, and I will make the code available.

Background: we have various linux and OSX systems, which are networked, but
not set up as a cluster.  I have no one here to set up a cluster, so I need
a hack that facilitates parallel programming on standard networked
machines.   I have accounts on all the machines, ssh access (of course
password-less), and networked file directory access.

what I am ultimately trying to accomplish is built around a simple
function, that my master program would invoke:

master.R:
   multisystem( c(R slv.R 1 20 file1.out, R slv.R 21 40 file2.out, ssh
anotherhost R slv.R 41 80 file3.out), announce=300)

multisystem() should submit all jobs simultaneously and continue only after
all are completed.  it should also tell me every 300 seconds what jobs it is
still waiting for, and which have completed.

with basically no logic in the cluster, my master and slv programs have to
make up for it.  master.R must have the smarts to know where it can spawn
jobs and how big each job should be.  slv.R must have the smarts to place
its outputs into the marked files on the networked file directory.  master.R
needs the smarts to combine the outputs of all jobs, and to resubmit jobs
that did not complete successfully.  again, the main reason for doing all of
this is to avoid setting up a cluster across OSX and linux system, and still
to make parallel processing across linux/osx as easy as possible.  I don't
think it gets much simpler than this.

now, I know how to write the multisystem() in perl, but not in R.  so, if I
roll it myself, I will probably rely on a mixed R/perl system here.  This is
not desirable, but it is the only way I know how to do this.  if something
like multisystem() already exists in R native, please let me know and save
me from reinventing the wheel.  if it does not, some perl/R combo for this
soon will.

regards,

/iaw





__
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] Insall package

2009-09-10 Thread Cedrick Johnson
Try downloading the rscproxy-.ZIP file on windows. Extension tar.gz 
is used (mostly) on linux


or

install.packages('rscproxy')

-c


wesley mathew wrote:

Dear Sir

Subject: - *Install  rscproxy_1.3-1.tar.gz *

 I am working in Windows system.  I was try  to install *rscproxy* package
in  two way.
 *1.* install.packages (rscproxy_1.3-1.tar.gz),  It shows the Warning:
unable to access index for repository
http://cran.pt.r-project.org/bin/windows/contrib/2.9
 *2. * install.packages(C:/Program Files/R/rscproxy_1.3-1.tar.gz, repos =
NULL) It also show warning ( Error in gzfile(file, r) : cannot open the
connection In addition: Warning   messages: 1: In unzip(zipname, exdir =
dest) : error 1 in extracting from zip file 2: In gzfile(file, r) :
cannot open compressed file 'rscproxy_1.3-1.tar.gz/DESCRIPTION', probable
reason 'No such file or directory'  )

 Could you please suggest, how to solve this problem,











__
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] Saving plots to file

2009-08-10 Thread Cedrick Johnson

Try this:

png(file=Desktop/hist1.png)
plot(glm1$residuals,gain,main =  Hist of residuals and gain)
dev.off()

-c

Sean MacEachern wrote:

Appologies if this has been addressed before, but I can't seem to find it in
the help archives.

I'm looking to do something like the following but it looks like save.plot
is deprecated.

save.plot(plot(glm1$residuals,gain,main = Hist of residuals and
gain),file=Desktop/hist1.png)


Thanks in advance,

Sean

Session Info:

R version 2.9.1 (2009-06-26)
i386-apple-darwin8.11.1

locale:
en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

loaded via a namespace (and not attached):
[1] tools_2.9.1

__
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@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] Multiple graphs

2009-07-27 Thread Cedrick Johnson

Try dev.new() after each graph is generated.

Example code from my setup (adapted a bit to fit your situation):

Alternate Method 1: Generate images and insert into PPT

png(file = chart1.png, width=800, height=800)
#do something pretty
dev.off()


Alternate Method 2: Generate images with new windows
dev.new()
#do something pretty


Check out the library R2PPT to answer your question about interaction 
with PPT.


Also, don't know if you're using the new Offce 2007, the default fonts 
with Calibri, etc. will be different (R generates them in the default 
font Arial). You can set it so that you match Office2K7 (or any other 
font of your choice) for consistency with the graphs generated in R and 
the rest of your presentation by doing the following:


windowsFonts(calibri = windowsFont(Calibri))
windowsFonts(consolas = windowsFont(Consolas))
dev.new()
par(family=calibri)  #Office 2K7 default font
#do something pretty

HTH,
Cedrick


Data Analytics Corp. wrote:

Hi,

I wrote a simple master function, run(), that has inside six qplot 
functions.  The goal is to type run() and have all six graphs appear 
as separate windows so that I can copy them into PowerPoint for a 
client. When I type run(), only the last graph appears, the first five 
apparently being overwritten.  How do I get all six in separate 
windows, ready for copying?


By the way, is the a way to create a PowerPoint deck directly in R the 
way you can in S-Plus?


Thanks,

Walt





__
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] RMySQL Error

2009-07-23 Thread Cedrick Johnson

   Make a copy of the libmySQL.dll and put it in your R_HOME\bin directory and
   try again..
   Just to be on the safe side, I created an env variable called R_HOME and
   added R_HOME\bin to my path.
   HTH
   -c
   Brock Tibert wrote:

Hi Everyone,
I am relatively new to R, but I want to try to learn how to use it and
potentially replace the other commercial packages I have learned to use over
the years.  That said, I need to get at data in databases, more
specifically, MySQL.

I installed the RMySQL package without error, but when I try to load it, I
get the following error:

  

library(RMySQL)


Loading required package: DBI
Error in fun(...) :
  A MySQL Registry key was found but the folder C:\Program Files\MySQL\MySQL
Tools for 5.0\/. doesn't contain a bin or lib/opt folder. That's where we
need to find libmySQL.dll.
Error : .onLoad failed in 'loadNamespace' for 'RMySQL'
Error: package/namespace load failed for 'RMySQL'


I am stumped, because the libmySQL.dll does exist in the path outlined.

Any help will be greatly appreciated!

Regards,

Brock

[[alternative HTML version deleted]]

__
[1]r-h...@r-project.org mailing list
[2]https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide [3]http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

References

   1. mailto:R-help@r-project.org
   2. https://stat.ethz.ch/mailman/listinfo/r-help
   3. http://www.R-project.org/posting-guide.html
__
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] remote database queries

2009-07-18 Thread Cedrick Johnson

Here's my MYSQL setup for retrieving data:

library(RMySQL)
channel - dbConnect(MySQL(), user=xx, password=xx, 
dbname=HistData, host=nomnom.cvgrllc.com)
EDM1 = dbGetQuery(channel, paste(select Date, o, h, l, c, v, a from 
HistBondData Where Symbol = 'EDM1' AND a != 0 ORDER BY Date ASC))


Another poster posted something for ODBC which works well for MSSQL 
servers (and could work for mysql, if you have a odbc dsn setup to work 
with mysql)


HTH...

-c



David Lubbers wrote:

With good and faithful python remote database queries look something
like this:

url.urlopen(username/pssw...@host,query)

where query is something like select * from table where 

Does R support queries on remote hosts with username and password?

What does a simple example look like?

Thank you.

__
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@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] how to run the R script in background in Windows XP?

2009-07-18 Thread Cedrick Johnson
Jie-

This is what I use (contained within a batch file and runs using windows
scheduler every day at 4AM):

Rscript --verbose MorningStartup.r  morningsummary-log.txt

HTH,
c

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Jie TANG
Sent: Friday, July 17, 2009 10:15 PM
To: r-help@r-project.org
Subject: [R] how to run the R script in background in Windows XP?

Hello ,everyone.

 I am a fresh user of R. I wrote several several R script in   R with the
version 2.9.1 in Windows XP. But I only can run these scrpit via R-GUI.

 Can anyone tell me how to run the scripts in background  without openning
R-gui.In another word, run the R-script and get the result via

some batch proceesing files or shell scripts directly?

Thanks.
 .

-- 
TANG Jie
Email: totang...@gmail.com
Tel: 0086-2154896104
Shanghai Typhoon Institute,China

[[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.

__
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] POSIX, timezones and R-ODBC

2009-07-14 Thread Cedrick Johnson
Howdy-

I recently upgraded to R 2.9.1 and did the updates for all of my packages. A
few of them now *suggest* the TZ variable to be set, which I did:

 Sys.getenv(TZ)
TZ 
 
 Sys.setenv(TZ=America/New_York)
 Sys.getenv(TZ)
TZ 
America/New_York

Next up:

library(RODBC)
library(quantmod)
channel - odbcConnect(mylovelydb)
 GS = sqlQuery(channel, paste(select Date, o, h, l, c, v from GS ORDER BY
Date ASC))
Error in as.POSIXlt.character(x, tz, ...) : 
  character string is not in a standard unambiguous format
In addition: Warning messages:
1: In structure(.Internal(as.POSIXct(x, tz)), class = c(POSIXt,
POSIXct),  :
  unknown timezone 'merica/New_York'


Strange thing: I set up the same thing with R2.9.0 (and as expected, I got
warnings when loading libraries that were built on 2.9.1, but that's ok) --
everything above works with 2.9.0 fine and dandy.

I am wondering how could the TZ, which is America/New_York become a
malformed character ('A'). It seems to be either a RODBC issue or something
more sinister under the hood with retrieving the TZ environment variable?

Note, this all works in 2.9.1 if the TZ variable is set to GMT. I can live
with that for the time being as a workaround. To further aid in debugging,
I've attached my sessionInfo output:

 sessionInfo()
R version 2.9.1 (2009-06-26) 
i386-pc-mingw32 

locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
States.1252;LC_MONETARY=English_United
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252

attached base packages:
[1] stats graphics  grDevices datasets  tcltk utils methods
base 

other attached packages:
 [1] quantmod_0.3-10 TTR_0.2 Defaults_1.1-1  xts_0.6-6
zoo_1.5-6  
 [6] RODBC_1.2-6 svSocket_0.9-43 svMisc_0.9-48   TinnR_1.0.3
R2HTML_1.59-1  
[11] Hmisc_3.6-0 rcom_2.1-3  rscproxy_1.3-1 

loaded via a namespace (and not attached):
[1] cluster_1.12.0  grid_2.9.0  lattice_0.17-25 tools_2.9.0

Any help would be much appreciated.

Regards,
CJ

--
Cedrick W. Johnson
aim) cedrickjcvgr
www.cedrickjohnson.com

__
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] Standalone program from R script

2009-07-14 Thread Cedrick Johnson
You could perhaps try Rserve (I'm not sure of your level of familiarity with
Java, and the full functionality required of your application) or .

From Gabor's link:

Take a look at Rwui: http://rwui.cryst.bbk.ac.uk/

Or, my roundabout way of solving problems like this suits you:
Basically if all you need to do is have coordinates sent to this R
app/formula/script and then output spit out via either an image or textual
format, that should be pretty easy to do with Rserve and a few hours with
Java and an applet. Have the applet accept inputs (coordinates?) and then
send them to Rserve. Once Rserve/R is done, pickup the image or text
generated and have it display in the applet.

HTH,
cj

--
Cedrick W. Johnson
aim) cedrickjcvgr
www.cedrickjohnson.com


-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Gabor Grothendieck
Sent: Tuesday, July 14, 2009 11:37 PM
To: Tanmoy Talukdar
Cc: r-help@r-project.org
Subject: Re: [R] Standalone program from R script

Some of the possibilities are listed here:
http://tolstoy.newcastle.edu.au/R/e6/help/09/03/8967.html

On Tue, Jul 14, 2009 at 11:26 PM, Tanmoy
Talukdartanmoy.taluk...@gmail.com wrote:
 I have written a program which deals with median in 2-D plane and the
 property of it under rotation. The program takes the co-ordinates
 through mouse-click at any point of the co-ordinate plane and then
 does the necessary computations. But the guys for whom I wrote the
 program , are now demanding a standalone program, ie they don't want
 their users to install R first to use this facility.

 So is there any way, without switching over to any other language, to
 change a R-script to a standalone program , it 'll be great even if a
 web-application is possible, I mean, the client will send the
 co-ordinates, R 'll be installed at server side and after the
 computation the results will be sent back to the client.

 So please tell me, if anyone of this two(standalone desktop program or
 web application) is possible.

 Any kind of help will be greatly appreciated.

 __
 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@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@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.