Displaying 20 results from an estimated 300 matches similar to: "tkrplot Newbie"
2008 Nov 19
2
do.call and plotting functions ...
I'm trying to write a simple wrapper for plotting functions to make
them print to postscript, something like
ploteps <- function(file, plotFunction, ...) {
args <- list(bquote(...))
# prepare postscript device
do.call(plot, args)
# close postscript device
}
I have inserted the bquote otherwise I get a lot of numbers in the
plot when I plot/hist something. But if I invoke
2008 Jun 19
1
How can I shade the background area of a zoo time series object between specific dates?
Dear list members,
How can I shade the background area of a zoo time series object between
specific dates?
eg.
library(tseries)
library(zoo)
SP500<-get.hist.quote("^GSPC", start = "1990-01-01", quote =
"Close")
plot(SP500)
How can I produce the same plot but with a (say) red background between
2007-04-12
and
2008-05-14
?
2008 Nov 01
1
lapply item names
Dear all,
I am using lapply to generate plots by applying a plot function to a list of
dataframes. e.g.
lapply(dataSet, FUN = plotFunction)
Is there a way to call the list item number inside the plot function so that
I can identify each graph?
Thanks
Chibisi
[[alternative HTML version deleted]]
2009 Apr 14
1
using Sweave, how to save a plot in a given size
Hi,
I'm trying to realise a repport with R and Latex (TeXnicCenter and Miktex for Windows) using Sweave().
I'd like to save my plots in a given size. How can I do that ? The code is :
\SweaveOpts{prefix.string = figs/plot, eps = FALSE, pdf = TRUE}
<<partI, echo=FALSE ,fig=TRUE, include=FALSE>>=
plotFunction()
@
\includepdf[pages=-]{figs/plot-partI}
When I use
2011 May 05
1
quantmod's addTA plotting functions
Hi,
I'm having trouble with quantmod's addTA plotting functions. They seem to
work fine when run from the command line. But when run inside a function,
only the last one run is visible. Here's an example.
test.addTA <- function(from = "2010-06-01") {
getSymbols("^GSPC", from = from)
GSPC.close <- GSPC[,"GSPC.Close"]
GSPC.EMA.3
2009 Aug 03
3
Help with data type
Hi there,
Using a quantmod function, I calculate the daily change between two points
in a time series. However, I don't think I am using the data correctly.
Code:
getSymbols("^GSPC", src="yahoo")
CloseData <- Cl(GSPC)
Delta <- diff(CloseData, lag=1)
for (i in 3:length(Delta)) {
if (Delta[i]>Delta[i-1]) sum <- sum + Delta
}
I can't seem to use the Delta
2010 Mar 16
1
Simple for-loop runs out of memory
I have the following simple for-loop, which makes R crash every time. The
length of the vectors is about 1200 rows, 1 column.
n = max(length(GSPC),length(FTSE))
for(i in 1:1000)
{
if (row.names(GSPC)[i]==row.names(FTSE)[i]){
} else {
if (row.names(GSPC)[i]>row.names(FTSE)[i]){
GSPC<-rbind(GSPC[1:(i-1),],GSPC[(i-1):length(GSPC),])
row.names(GSPC)[i]=row.names(FTSE)[i]
} else {
2012 Dec 06
1
Fuction Error
I'm calling a list of symbols and then using a function to build a data
frame from that symbol list. It works great until I introduce this index
symbol from yahoo '^GSPC'. When and index symbol is introduced I get and
error which is below.
> Data <- symbolFrame(symbols)
Error in get(S) : object '^GSPC' not found
Since R does not like the ^ in front of a name it
2011 May 07
2
Convenience-at-the-expense-of-clarity (was: quantmod's addTA plotting functions)
Thanks, Writing plot(addTA()) worked fine.
I find myself with such mixed feelings about R. After finding that addTA
worked fine at the command line but not in a function, I puzzled for a long
time about what kind of virtual machine structure could possibly account for
that. I couldn't think of any.
It turns out that this isn't due to an R virtual machine structure. The
reason addTA adds
2011 Apr 29
3
why doesn't ifelse work ?
I have the following lines of code:
ind <- rollapply(GSPC, 200, mean)
signal <- ifelse(diff(ind, 5) > 0 , 1 , -1)
signal[is.na(signal)] <- 0
I never get a value of -1 for signal even though I know diff(ind , 5) is
less than zero frequently. It looks like when diff(ind , 5) is less than
zero, signal gets set to 0 instead of - 1. Any ideas why ? Here's some
information on ind and
2010 Aug 15
2
Adding colored background area to a time series plot
Hi,
I am trying to add a rectangular colored background area to a plot of a time series of relative price changes. I believe that what I'm trying to do is very similar to the question and example given here:
http://www.mail-archive.com/r-help at stat.math.ethz.ch/msg73948.html
http://www.mayin.org/ajayshah/KB/R/html/g5.html
My problem/difference is that my time series looks like so:
>
2005 Jan 11
2
Changing the ranges for the axis in image()
Dear all,
I can not find/understand the solution to this from the help pages:
Say we have the following script:
x<-matrix(c(1,1,0,1,0,1,0,1,1),3,3)
image(x)
How can I change the ranges on the vertical and horizontal axis to a
range of my own or at least place a box frame around the image if I
choose to use "axes=FALSE"?
Apologies for such a bsic question and thanks beforehand
2010 Mar 22
4
Playwith on Mint
Hello,
I am having trouble installing the package playwith on the latest Mint
"helena",
running R version 2.10.1 (2009-12-14).
I suspect it has to do with the GTK library but as far as I can tell there
is nothing wrong with it.
Any help extremely appreciated.
I include the output:
> install.packages("playwith")
Warning in install.packages("playwith") :
2011 Nov 10
2
Error in axis ????
I did an update of both rstudio and my packages. I had some trouble but was
able to move a lot of the packages so most troubles seem to be behind me.
But having a problem with code that previously ran fine. See below:
require(quantmod)
Loading required package: quantmod
Loading required package: Defaults
Loading required package: xts
Loading required package: zoo
Attaching package: ?zoo?
The
2011 Dec 04
3
Vectorization instead of loops problem
Hello,
I am having problems vectorizing the following (i/o using a for/next/while
loop):
I have 2 sequences such as:
x, y
1, 30
2, -40
0, 50
0, 25
1, -5
2, -10
1, 5
0, 40
etc etc
The first sequence (x) takes integer numbers only: 0, 1, 2
The sequence y can be anything...
I want to be able to retrieve (in a list if possible) the 3 last values of
the y sequence before a value of 1 is
2010 Dec 02
1
Downloading quote data from yahoo finance
Hi R users,
Thanks in advance.
I am using R 2.12.0 on Windows XP.
May I request you to assist me in the following please.
1. I am getting error while downloading quote data from yahoo finance.
The example code is below (taken from tseries help):
library(tseries)
con <- url("http://quote.yahoo.com")
if(!inherits(try(open(con), silent = TRUE), "try-error")) {
2012 Nov 28
2
hhmm time format, strptime and %k
Hello,
I am having trouble with the conversion specifications as described in
the strptime help page.
> head(dat)
Date Time Open High Low Close Up Down Volume
1 11/19/2012 935 137.89 138.06 137.82 138.05 3202541 3013215 0
2 11/19/2012 940 138.04 138.40 138.02 138.38 2549660 2107595 4657255
3 11/19/2012 945 138.38 138.40 138.18 138.19 1627379 1856318 3483697
4
2007 Jun 14
1
names() after library(RDCOMClient) problem(?)
Hello,
Try example(names) in R 2.5.0 after library(RDCOMClient) and you get
> example(names)
names> # print the names attribute of the islands data set
names> names(islands)
Error in names(islands) : no applicable method for "names"
>
Is this normal? Any way round it???
Best regards,
Costas
----------------------------------
Costas Vorlow
2011 Feb 24
0
rpanel rp.tkrplot: x&y when using layout
Hi all,
I wish to use rp.tkrplot from the rpanel package with subplots produced
by layout or split.screen. My problem is that I want to use a click
function, but I can't work out how to convert the x and y values it
produces into the values on the plots as unlike for a single plot they
don't match. For example in the following code the (0,0) and (1,1)
corners of the bottom left plot
2011 Apr 10
3
open.exe Virus W32.ATRAPS
Hello,
I am not sure if this is the correct mailing list to send this email...
I was trying to install on windows XP latest R-2.12.2 and my unvirus program
(Immunet 3.0) reports a virus at open.exe while this is unpacked:
W32.ATRAPS
Has anyone come across the same problem?
Best,
Costas
[[alternative HTML version deleted]]