I think you can use package animation. See http://animation.yihui.name/
.
HTH,
David L. Reiner
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On Behalf Of Flana
Sent: Friday, March 12, 2010 12:14 PM
To: r-help@r-project.org
Subject: [R] Exportin
The indexing in xts is very nice; it may do what you want.
library(xts)
x.xts <- as.xts(x)
plot(x.xts)
plot(x.xts['2005::2006-10'])
HTH,
David Reiner
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On Behalf Of Erin Hodgess
Sent: Tuesday, March
and it can be done analytically: = -(1 + log(2 pi)) / 2
-- David L. Reiner
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On Behalf Of Greg Snow
Sent: Thursday, February 11, 2010 11:58 AM
To: Trafim Vanishek; Peter Dalgaard
Cc: r-help@r-project
Possibly just a typo:
> gsub('\\[.*\\]', '', myCharVec)
^^
[1] """(the rain in spain)"
HTH,
-- David
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On Behalf Of Mark Kimpel
Sent: Thursday, August 20, 2009 10:31 A
Thanks to Hadley (shortest and sweetest), Eric and Gabor.
I was _so_ close.
Now I think I've learned some things about the reshape function and package!
(Also transform and interaction.)
Thanks to you all,
-- David
-Original Message-
From: hadley wickham [mailto:h.wick...@gmail.com]
Sent
I'm having trouble reshaping a data.frame from long to wide.
(I think that's the right terminology; feel free to educate me.)
I've looked at the reshape function and package and plyr package,
but I can't quite figure out how to do this after a dozen variations.
I have a data.frame with more level
How's this?
f2 <- function(v) {
n <- length(v)
s <- matrix(0,n,n)
for(i in 1:n)
for(j in 1:i)
s[j,i] <- ifelse(i>1, s[j,i-1]+v[i]*ifelse(j>1, s[j-1,i-1], 1),
v[i])
c(1,s[,n])
}
> system.time(f2.result <- f2(1:20))
user system elapsed
0 0 0
> system.time(f
I removed all of the objects that were from the examples I tried, saved,
and quit.
R starts up cleanly now. Yeah!
That was annoying behavior, and I would recommend that the authors
change it, please.
Thank you for your to-the-point advice, Professor Ripley!
-- David
ps - Sorry for the lengthy dis
I wanted to try out package distrMod, so I did
> install.packages('distrMod')
> library(distrMod)
and played around, saved and quit.
Now whenever I start up in this directory, I get distr and lots of other
stuff loaded and lots of messages.
How do I keep it from automatically loading, other tha
Jason,
Just to answer your direct question, there is Mathowrld.wolfram.com,
where there are 87 continuous distributions listed.
I have also used the book Statistical Distributions, 2nd ed, Merran Evans, et
al.
which has most of the usual distributions with pictures and relationships.
Of course al
My original message referred to the double slash and using grep.
The particular behavior on C: wasn't the issue. For example,
> list.files("C:/test1", full.names=TRUE)
[1] "C:/test1/file1" "C:/test1/file2"
> list.files("C:/test1/", full.names=TRUE)
[1] "C:/test1//file1" "C:/test1//file2"
> # Note
The lines below made me understand clearly. Maybe they are already in
some documentation,
but if not, it might help others to avoid my misunderstanding.
Thanks to all for the clarifications.
-- David
-Original Message-
From: Duncan Murdoch [mailto:murd...@stats.uwo.ca]
Sent: Thursday, Ja
I apologize for posting a wrong opinion; I should of course have checked
before posting.
Henrik's examples illustrate something I had never realized before, and
it really surprised me!
Where can I read the technical details of this scoping aspect of 'for'
as it still presents
some subtle puzzles f
Well, maybe you are just bad at typing then ;-)
The lines rr==ii, pp==pp+1, etc. are not setting rr and pp but comparing
them.
Probably you want rr <- ii and pp <- pp+1, etc.
And the last line of your loop 'ii=ii+1' means that,
since the for statement is already incrementing ii,
you are incrementi
Hmm. I get exactly the same files and directories with "C:" and "C:/",
except for the double slashes now.
Previously the two calls to list.files gave exactly the same results.
My current directory (getwd()) is not C:. I'm puzzled by your output.
-- David
-Original Message-
From: henrik.be
I just noticed a change in the behavior of list.files from 2.6.1pat to
2.7.0
(I noticed it in 2.8.1 and traced back.)
Previously, if the directory ended with a slash, and full.names=TRUE,
the names
returned had a single slash at the end of the directory,
but now there are two. I noticed since I
There is also a symmetric set difference = union(setdiff(x, y),
setdiff(y, x))
denoted x \Delta y
-- David
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On Behalf Of Juliet Hannah
Sent: Tuesday, January 13, 2009 9:41 AM
To: r-help@r-project.o
sample(1:100)
-- David
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Stuart Leask
Sent: Wednesday, November 12, 2008 2:24 PM
To: [EMAIL PROTECTED]
Subject: [SPAM] - [R] How can I generate a random order? - Found word(s)
remove list in the Text body
F
How about
> x <- c("2E","5W","12H")
> substr(x, nchar(x), nchar(x))
[1] "E" "W" "H"
>
> substr(x, 1, nchar(x)-1)
[1] "2" "5" "12"
-- David
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Erin Hodgess
Sent: Wednesday, October 29, 2008 3:58 PM
To: [EMA
Try adding ret="raw" and leaving off start= since that is not supported
for data set requests.
You'll just have to format the returned nested lists yourself. Looking
at the RBloomberg code should give you hints.
(Also I think that field is deprecated - at least I can't find it in my
version, but it
Depending on what you want your covariance matrices to be like, you
could form
random symmetric matrices with positive diagonals and then use nearPD
{Matrix}
to make them positive definite, but the resulting distribution of
covariance
matrices would be hard to guess. And giving a diagonal matrix
If one looks at the other is.* functions or ?mode, one will quickly see
that
each is.* function does something specific and not 'what one would
expect'.
For example, is.real and is.complex do not tell you whether the argument
has
a zero complex part or not.
Another example is all.equal. If one
Yahoo and OandA provide only daily data, but the history goes back quite a ways:
> msft <- get.hist.quote(instrument="MSFT", start="1986-03-31",
> end="2008-09-10", quote=c("O","H","L","C","A","V"), provider="yahoo",
> retclass="zoo")
> NROW(msft)
[1] 5663
That's 22 years of data.
Not sure what y
I think I just remembered that in a melted data.frame the values have to
be called 'value' and tried renaming my third column so. Now it works
(without add.missing).
Thanks for this powerful piece of software!
-- David
(I was trying to convert a set of data in 'long' format to 'wide'
format. Basic
I have a data.frame which I believe is melted already and am having
trouble casting it to 'wide' format.
It looks something like
> (x <- data.frame(ticker=c(rep("A",5),rep("B",6)), date=c(1:5, 1:6),
value=c(NA,100*exp(rnorm(10,0,.1)
> cast(x, date ~ ticker) # this does what I want with to
There's a pretty thorough discussion on Wikipedia
http://en.wikipedia.org/wiki/Two_envelopes_problem
Suffice it to say that not everyone agrees.
-- David
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Deepayan Sarkar
Sent: Monday, August 25, 2008 4:35 PM
I get 5/36 + log(2)/6, not 1/9.
David L. Reiner, PhD
Head Quant
Rho Trading Securities, LLC
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Alberto Monteiro
Sent: Wednesday, August 20, 2008 7:56 AM
To: Van Wyk, Jaap; r-help@r-project.org
Subject: Re: [R]
Well, if you think about the geometry, all correlations equal usually
won't work. Think of the SDs as the sides of a simplex and the
correlations as the cosines of the angles between the sides (pick one
variable as the 'origin'.) Only certain values will give a valid
covariance or correlation matri
I do this all the time. See
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/105099.html
(Vista is a bit harder than XP, but similar.)
As far as determining when to proceed with the script,
you could have your db updater create a semaphore file your batch or R
script could wait for.
HTH,
David L.
Jonas,
Take a look at CRRBinomialTreeOption{fOptions} in which Diethelm Wuertz
uses a double loop,
but of course, he's optimized it to use only a vector instead of a
matrix!
David L. Reiner, PhD
Head Quant
Rho Trading Securities, LLC
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EM
I guess I would create a mapping table to convert between the symbols
from Bloomberg and from Yahoo.
You should be able to just create it once and add to it as new symbols
appear on your screens. Most of the symbols should be the same so you
could omit those. If it all has to be automated, you coul
That did it, Gabor.
Thanks! I didn't think chron would be involved.
-- David
-Original Message-
From: Gabor Grothendieck [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 11, 2008 11:39 AM
To: David Reiner <[EMAIL PROTECTED]>
Cc: r-help@r-project.org
Subject: Re: [R] plot.zoo warnings - ig
I'm getting warnings when I plot a zoo object:
> dts <- chron(rep("2007-09-10", 5), paste("00:0", 0:4, ":00", sep=""),
c("y-m-d", "h:m:s"))
> dat.zoo <- zoo(1:5, dts)
> plot(dat.zoo)
Warning messages:
1: In v[[perm[1]]] : partial match of 'm' to 'month'
2: In v[[perm[2]]] : partial match of 'd' to
Well, it turns out to be very simple - just insert a Vectorize between
integrate and function(x).
However, the special cases where C[i,j]==1 make the actual code quite
messy.
It matches pmvnorm {mvtnorm} and pmnorm {mnormt} quite well.
And the recursive method is incredibly slow for higher dimensio
I'm trying to implement a recursive function using integrate, and I
suspect I need a Vectorize somewhere,
but I can't suss it out. Any help would be appreciated. I've tried
traceback() and various debugging ideas to no avail (most likely due to
my inexperience with these tools.)
Here's what I have
I've found the O'Reilly pocket reference "Regular Expression" (about USD
10.00) quite handy.
It covers Perl, C, PHP, Python, Java, and .Net.
David L. Reiner
Rho Trading Securities, LLC
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Christos Hatzis
Sent:
I'd guess start and end are confusing the bulk data call (it doesn't
take those params). This works for me:
div <- blpGetData(con, "IBM Equity", "EQY_DVD_HIST", retval="raw")
You need the "raw" retval when anything is not numeric; then you need to
extract the bits you want from the nested list re
You can try
> blpGetData(conn, "US912828HA15 Govt",
c("ticker", "cpn", "maturity", "market_sector_des"), retval="raw")
and paste together the parts.
HTH,
David L. Reiner
Rho Trading Securities, LLC
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of
This came up last week on r-sig-finance:
https://stat.ethz.ch/pipermail/r-sig-finance/2007q3/001686.html
David L. Reiner
Rho Trading Securities, LLC
550 W. Jackson Blvd #1000
Chicago, IL 60661-5704
312-244-4610 direct
312-244-4500 main
312-244-4501 fax
-Original Message-
From: [EMAIL
39 matches
Mail list logo