Re: [R] Updata Rdata File

2010-11-18 Thread Jason Kwok
On Thu, Nov 18, 2010 at 6:56 AM, Duncan Murdoch murdoch.dun...@gmail.comwrote: On 18/11/2010 1:49 AM, Jason Kwok wrote: How do I add data to a .rdata file? In my case, I have a time series that needs to get updated every day. Load it, update the variables, save them. Duncan Murdoch

[R] Updata Rdata File

2010-11-17 Thread Jason Kwok
How do I add data to a .rdata file? In my case, I have a time series that needs to get updated every day. Thanks, Jason [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

[R] Plotting 2 Lines on the Same Chart

2010-10-29 Thread Jason Kwok
How do I plot two time series plots on the same chart? Thanks, Jason [[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

Re: [R] Plotting 2 Lines on the Same Chart

2010-10-29 Thread Jason Kwok
: On Fri, Oct 29, 2010 at 1:41 PM, Jason Kwok jayk...@gmail.com wrote: How do I plot two time series plots on the same chart? Try this: example(plot.ts) example(ts.plot) library(zoo) example(plot.zoo) library(lattice) example(xyplot.zoo) -- Statistics Software Consulting GKX Group, GKX

[R] Returning highs and lows in R

2010-10-28 Thread Jason Kwok
I'm having trouble returning a rolling n period highest value for a data set. For each day I want to calculate the highest value over the last 3 days. I am using the following packages: zoo, xts, quantmod and TTR. Thanks, Jason GLD.Close 2010-10-01128.91 2010-10-04128.46

Re: [R] Returning highs and lows in R

2010-10-28 Thread Jason Kwok
values, it may be considerably more difficult. However, offering anything more seems pointless until you have adequately specified what you want. Reproducible data and code for a start. Cheers, Bert On Thu, Oct 28, 2010 at 9:27 AM, Jason Kwok jayk...@gmail.com wrote: I'm having trouble

Re: [R] Returning highs and lows in R

2010-10-28 Thread Jason Kwok
I figured out how to offset my observations by 1 period by using the rollapply(xx,3,max,align=right), which would calculate the mean for (current observation, obs - 1 and obs -2 ). How would I further offset by 1 more period? Thanks, Jason On Thu, Oct 28, 2010 at 1:29 PM, Jason Kwok jayk

Re: [R] Returning highs and lows in R

2010-10-28 Thread Jason Kwok
I was able to get what I wanted using the lag function to offset an addition period. lag(rollapply(xx,3,max),-2) or lag(rollapply(xx,3,max,align=right),-1) Thanks. Jason On Thu, Oct 28, 2010 at 1:49 PM, Jason Kwok jayk...@gmail.com wrote: I figured out how to offset my observations by 1

[R] CRAN vs R-Forge

2010-10-25 Thread Jason Kwok
What's the difference between the packages you get from CRAN and R-Forge? Are the packages you get from CRAN fully developed and R-Forge work-in-progress? Regards, Jason [[alternative HTML version deleted]] __ R-help@r-project.org mailing

[R] Importing CSV File

2010-10-24 Thread Jason Kwok
I'm trying to import a CSV file into R and when it gets imported, the entries get numbered down the left side. How do I get rid of that? Thanks, Jason * read.csv(file=C:\\Program Files\\R\\Test Data\\sales.csv,head=TRUE) Month Sales 1January 422 2 February 151 3 March

Re: [R] Importing CSV File

2010-10-24 Thread Jason Kwok
Thanks for the response Erik. In this case, I would like to keep the row name as the month. How would I do that? Thanks, Jason On Sun, Oct 24, 2010 at 6:20 PM, Erik Iverson er...@ccbr.umn.edu wrote: On 10/24/2010 04:57 PM, Jason Kwok wrote: I'm trying to import a CSV file into R and when

[R] If Statement Help

2010-10-23 Thread Jason Kwok
Price 2010-10-11 99 2010-10-12101 2010-10-13102 2010-10-14103 2010-10-15 99 2010-10-18 98 2010-10-19 97 2010-10-20101 2010-10-21101 2010-10-22101 I have this dataset and I only want to return instances when the Price is 100. If I use

Re: [R] If Statement Help

2010-10-23 Thread Jason Kwok
-10-22 101 On Sat, Oct 23, 2010 at 9:56 PM, Jason Kwok jayk...@gmail.com wrote: Price 2010-10-11 99 2010-10-12101 2010-10-13102 2010-10-14103 2010-10-15 99 2010-10-18 98 2010-10-19 97 2010-10-20101 2010-10-21101 2010

Re: [R] If Statement Help

2010-10-23 Thread Jason Kwok
what you want: subset(x, Price 100) See ?subset for more information. HTH, Jorge On Sat, Oct 23, 2010 at 9:56 PM, Jason Kwok wrote: Price 2010-10-11 99 2010-10-12101 2010-10-13102 2010-10-14103 2010-10-15 99 2010-10-18 98 2010-10-19