[R] plotting multiple time series under one panel

2015-02-25 Thread Raghuraman Ramachandran
Dear guRus I have data frame as: str(voldf) 'data.frame': 130 obs. of 8 variables: $ Date: Date, format: "2014-08-01" "2014-08-05" "2014-08-08" ... $ kc : num 0.453 0.424 0.468 0.481 0.485 ... $ sb : num 0.1128 0.123 0.1272 0.1128 0.0949 ... $ qc : num 0.0626 0.0661 0.0777 0.0765 0.0763

Re: [R] Reading in an XLS (really XML) file from website

2015-02-27 Thread Raghuraman Ramachandran
This works: Change the destination directory to suit you. MyURL1 = "http://www.ishares.com/us/239726/fund-download.dl"; download.file(MyURL1,paste("C:/Data/Rtest1",date1,"r.xls",sep=""),method="wget",quiet=TRUE,mode="wb", extra="--header=\"User-Agent: Mozilla/5.0 (X11; Lin

[R] Unable to Scale/Display properly in plotting a xts/timeseries graph in a single plot

2015-04-07 Thread Raghuraman Ramachandran
Dear guRus I have xts data as: str(volsA) An ‘xts’ object on 2014-05-13/2015-04-07 containing: Data: num [1:221, 1:2] 18.8 18.5 18.4 22.2 22 ... - attr(*, "dimnames")=List of 2 ..$ : NULL ..$ : chr [1:2] "vol1" "vol2" Indexed by objects of class: [Date] TZ: UTC xts Attributes: List of 1

Re: [R] Unable to Scale/Display properly in plotting a xts/timeseries graph in a single plot

2015-04-07 Thread Raghuraman Ramachandran
Thanks Josh. I am not sure if I can attach a Jpeg. Please find attached. On Tue, Apr 7, 2015 at 5:47 PM, Joshua Ulrich wrote: > On Tue, Apr 7, 2015 at 11:30 AM, Raghuraman Ramachandran > wrote: >> Dear guRus >> >> I have xts data as: >> str(volsA) >> An ‘

Re: [R] Unable to Scale/Display properly in plotting a xts/timeseries graph in a single plot

2015-04-07 Thread Raghuraman Ramachandran
, Apr 7, 2015 at 5:47 PM, Joshua Ulrich wrote: > On Tue, Apr 7, 2015 at 11:30 AM, Raghuraman Ramachandran > wrote: >> Dear guRus >> >> I have xts data as: >> str(volsA) >> An ‘xts’ object on 2014-05-13/2015-04-07 containing: >> Data: num [1:221,

[R] Help with Time

2014-11-21 Thread Raghuraman Ramachandran
Dear guRus How can I round of time in R to the nearest 30th minute please? For example suppose if >Sys.time() [1] "2014-11-21 22:49:05.59042 GMT" then I would like a function that outputs 22:30:00. if Sys.time is 12:13:22 then I would like to get 12:00:00 etc. Any help would be appreciated. Ma

Re: [R] Help with Time

2014-11-21 Thread Raghuraman Ramachandran
Sorry I forgot to mention it clearly. I like to round it to the nearest 30th minute that is past. So 12:28:59 will be again 12:00:00 and 12:59:59 will be 12:30:00 etc. Apologies for the lack of clarity in the beginning. Many thanks Raghu On Fri, Nov 21, 2014 at 10:52 PM, Raghuraman Ramachandran

Re: [R] Help with Time

2014-11-22 Thread Raghuraman Ramachandran
21, 2014, at 2:55 PM, Raghuraman Ramachandran wrote: >> >>> Sorry I forgot to mention it clearly. I like to round it to the >>> nearest 30th minute that is past. So 12:28:59 will be again 12:00:00 >>> and >>> 12:59:59 will be 12:30:00 etc. Apologies for

[R] MS Access

2013-06-14 Thread Raghuraman Ramachandran
Dear guRus Can I use R inside Microsoft access Macros and programmes? I understand that R-Excel is compatible but wish to know if I can use R inside Access programmes please? Many thanks Raghu [[alternative HTML version deleted]] __ R-help@r-p

[R] Fwd: lm and 450k data

2014-07-12 Thread Raghuraman Ramachandran
Try this: mod = lm(methcol ~ exposure+X1+X2+X3+batch, data = meth_matrix) res=coef(summary(mod))[2,] It will good if you give a subset of data you are working on by dput. Raghu On Sat, Jul 12, 2014 at 3:11 PM, Jessica Timms wrote: > Hi, > > > > I'm quite new to R and currently trying to use

Re: [R] canonical correlation

2014-07-13 Thread Raghuraman Ramachandran
Try package CCA. On Sat, Jul 12, 2014 at 11:13 PM, Monaly Mistry wrote: > Hi, > > I was wondering if it's possible in R to do a canonical correlation with > only one dependent variable and several independent variables. > > I've tried using cc(X,Y) but I got an error message. In this case I had

Re: [R] canonical correlation

2014-07-13 Thread Raghuraman Ramachandran
gt; > >> > Best, >> > John >> > >> > -------- >> > John Fox, Professor >> > McMaster University >> > Hamilton, Ontario, Canada >> > http://socserv.mcmaster.ca/jfox/ >>

Re: [R] Help with Download of a comma separated file in zip format

2014-07-17 Thread Raghuraman Ramachandran
Hi Fabio Can you please reproduce your output? When I tried it curl are the following issues I get: >download.file(" http://www.nseindia.com/content/historical/DERIVATIVES/2014/JUL/fo09JUL2014bhav.csv.zip";, temp, method="curl") Error in download.file(" http://www.nseindia.com/content/historical/

Re: [R] Help with Download of a comma separated file in zip format

2014-07-17 Thread Raghuraman Ramachandran
stall curl(http://curl.haxx.se/) binaries and try the curl > method again. > #! Fábio > > > On Thu, Jul 17, 2014 at 5:26 AM, Raghuraman Ramachandran > wrote: > > Hi Fabio > > > > Can you please reproduce your output? When I tried it curl are the > following > &

Re: [R] Execute Excel-Macro using R

2013-12-21 Thread Raghuraman Ramachandran
Try 'shell'? There must be a workaround to do this. On Fri, Dec 20, 2013 at 9:58 AM, R_Antony wrote: > Hi, > > How to execute ms-Excel Macro(*.xlsm) using R function ? I tried but not > get. There are method to call from R function from Excel macro, but i need > Excel macro to execute from R. I

[R] Contract Work

2013-10-15 Thread Raghuraman Ramachandran
Dear R-users I am looking for a very experienced R developer for a derivatives project in Bangalore. The developer should preferably be well versed in GUI etc. The contract is for 4 to 6 months. Please contact me in this email. Thanks Raghu [[alternative HTML version deleted]]

[R] How to read a file inside a function?

2010-08-06 Thread Raghuraman Ramachandran
Hi I wish to read a file from my local directory from inside a function. I am passing the filename as the argument but this does not work. Say for example function(dat) { dat1=read.csv("D:\\dat.csv",header=TRUE) } If I call funtion(dat) I get the following error. 'Intuitively' i understand this is

[R] How to apply apply?!

2010-08-06 Thread Raghuraman Ramachandran
guRus I have say a dataframe, d and I wish to do the following: 1) For each row, I want to take one particular value of the row and multiply it by 2. How do I do it. Say the data frame is as below: OPEN HIGH LOW CLOSE 1931.2 1931.2 1931.2 1931.2 0 0 0 999.05 0 0 0 1052.5 0 0 0 987.8 0 0 0 925.

Re: [R] Creating timeSeries

2010-08-06 Thread Raghuraman Ramachandran
?xts xts will do what you want. as.xts or xts() are straightforward ways. On Fri, Aug 6, 2010 at 5:11 PM, Serdar Akin wrote: > Hi > > I want to create a TimeSeries object with already defined dates (in the > first vector) so that all the data are coerced as a time series object with > the dates

[R] Profit calculation

2012-06-19 Thread Raghuraman Ramachandran
Dear guRus Say I have a price vector, P which is P = c(20,50,40,50) for four consecutive days. My initial equity is say $100 and I re-invest the profits made in each transaction so my equity curve increases. If I go Long on day 1, short and short on day 2, long and long on day 3 and finally shor

[R] Help in Optimization of a function

2012-07-08 Thread Raghuraman Ramachandran
guRus! I have a function f = exp(x^2-y+(1/z)) Also, x can take values from 1 to 37, y from 2 to 20 and Z from -13 to 51. How can I find the maximum of f using any of the optimization functions please? Is there a way to store the possible values of x, y and Z in a single variable like in a List

[R] Help with vectors and rollapply

2012-07-10 Thread Raghuraman Ramachandran
Hello I have a vector a =(-2,0,0,0,1,0,0,3,0,0,-4) I want to replace all zeros into previous non-zero state. So for instance the above vector should be converted into: a= (-2,-2,-2,-2,1,1,1,3,3,3,-4) I tried many things and finally concluded that probably(?) rollapply may be the best way? I

Re: [R] Help with vectors and rollapply

2012-07-11 Thread Raghuraman Ramachandran
Hi Bill Many thanks for your help. Cheers R -Original Message- From: William Dunlap [mailto:wdun...@tibco.com] Sent: 10 July 2012 17:22 To: Raghuraman Ramachandran; r-help@r-project.org Subject: RE: Help with vectors and rollapply It looks like you already have the zoo package loaded

[R] writing data into files whose names are in a vector

2012-07-14 Thread Raghuraman Ramachandran
GuRus How do I use the write function (or write.table or write.csv) to achieve the following please? age=c(32,37,39) names=c("john","peter","jake") I would like create in a directory 3 files each named as john.csv,peter.csv and jake.csv and each file have data from the age vector. That is jon.cs

Re: [R] writing data into files whose names are in a vector

2012-07-14 Thread Raghuraman Ramachandran
7;cat' Thanks once again. Raghu On Sat, Jul 14, 2012 at 3:22 PM, Raghuraman Ramachandran < optionsra...@gmail.com> wrote: > GuRus > > How do I use the write function (or write.table or write.csv) to achieve > the following please? > > age=c(32,37,39) > names=c("

Re: [R] writing data into files whose names are in a vector

2012-07-14 Thread Raghuraman Ramachandran
rs) .OO#. .OO#. rocks...1k > --- > Sent from my phone. Please excuse my brevity. > > Raghuraman Ramachandran wrote: > > >GuRus > > > >How do I use the write function (or write.tab

[R] Collapsing a vector/data-frame based on the previous values

2012-07-23 Thread Raghuraman Ramachandran
Hello I have a data frame like this: dput(states) structure(list(Date = c("24/07/2012", "25/07/2012", "26/07/2012", "27/07/2012", "28/07/2012", "24/07/2012", "25/07/2012", "26/07/2012", "27/07/2012", "28/07/2012"), State = c(1L, 1L, 1L, 1L, 1L, -1L, -1L, -1L, 1L, -1L)), .Names = c("Date", "State")

Re: [R] Collapsing a vector/data-frame based on the previous values

2012-07-24 Thread Raghuraman Ramachandran
lps, > > Rui Barradas > > Em 24-07-2012 07:40, Raghuraman Ramachandran escreveu: > >> Hello >> >> I have a data frame like this: >> dput(states) >> structure(list(Date = c("24/07/2012", "25/07/2012", "26/07/2012", >> &quo

Re: [R] Collapsing a vector/data-frame based on the previous values

2012-07-24 Thread Raghuraman Ramachandran
+ -10L)) > > # mark the state changes > > states$diff <- c(TRUE, diff(states$State) != 0) > > states[states$diff,] > Date State diff > 1 24/07/2012 1 TRUE > 6 24/07/2012-1 TRUE > 9 27/07/2012 1 TRUE > 10 28/07/2012-1 TRUE > &g

[R] difficulty in Formatting time series data

2012-04-22 Thread Raghuraman Ramachandran
Dear R-Gurus I have a data frame (from CSV file) which has its first column called Date. The Date is in the format mm/dd/. I was trying to get the weekday for these dates and I tried using wday() and day.of.week() functions and both of them gave me precisely the wrong answers. I think the issu

Re: [R] difficulty in Formatting time series data

2012-04-22 Thread Raghuraman Ramachandran
t;13/07/2010", "12/07/2010", "09/07/2010", "08/07/2010", "07/07/2010", "06/07/2010", "05/07/2010", "02/07/2010", "01/07/2010", "30/06/2010", "29/06/2010", "28/06/2010", "25/06/2010

Re: [R] difficulty in Formatting time series data

2012-04-22 Thread Raghuraman Ramachandran
ller wrote: > On Sun, 22 Apr 2012, Hasan Diwan wrote: > > Raghu, >> >> On 22 April 2012 09:53, Raghuraman Ramachandran > >wrote: >> >> I have a data frame (from CSV file) which has its first column called >>> Date. >>> The Date is in the fo