Re: [R] Removing named objects using rm(..)

2012-12-10 Thread Worik R
On Tue, Dec 11, 2012 at 7:49 PM, Jeff Newmiller wrote: > What about putting your objects in a list, which does not have the search > through parents semantics? > --- > > >> >> You may find it more reliable to define an enviro

Re: [R] Removing named objects using rm(..)

2012-12-10 Thread Worik R
<- new.env() get("USDCHF", env=PAIR.ENV) returns trhe USDCHF defined in timeSeries This is very hard! Worik Bill Dunlap > Spotfire, TIBCO Software > wdunlap tibco.com > > > > -Original Message- > > From: r-help-boun...@r-project.org [mailto:r-help-

Re: [R] Removing named objects using rm(..)

2012-12-10 Thread Worik R
On Tue, Dec 11, 2012 at 2:27 PM, Duncan Murdoch wrote: > On 12-12-10 7:33 PM, Worik R wrote: > >> Let me restate my question. >> >> Is there a straightforward way of ensuring I can use the variable name >> USDCHF? >> > > You can use any legal vari

Re: [R] Removing named objects using rm(..)

2012-12-10 Thread Worik R
-12-10 4:40 PM, Worik R wrote: > >> When I import the library timeSeries I get (at least) the variable USDCHF >> imported too. >> >> I would like to delete it, but I cannot. As you can see below. >> > > You didn't import timeSeries, you attached it. It

[R] Removing named objects using rm(..)

2012-12-10 Thread Worik R
When I import the library timeSeries I get (at least) the variable USDCHF imported too. I would like to delete it, but I cannot. As you can see below. Clearly I am doing something wrong. What is it? > library(timeSeries) Loading required package: timeDate > class(USDCHF) [1] "timeSeries" attr(

Re: [R] Weird POSIXct behaviour

2012-12-10 Thread Worik R
led time zone is set OK but the time is wrong. The date string was generated in Perl as... DB<7> p scalar(localtime(1351927518)) Sat Nov 3 20:25:18 2012 Using gmtime in Perl... DB<8> p scalar(gmtime(1351927518)) Sat Nov 3 07:25:18 2012 cheers Worik On Fri, Mar 30, 2012 at 3:

[R] Making fifo work (Linux)

2012-12-09 Thread Worik R
Friends I need to get R reading from a fifo. I want it to block till there is some data in the fifo, consume what input it gets there, do some thing with it then loop back and block again. Very simple. Yes? No. The example in the documentation works OK.. zz <- fifo("foo-fifo", "w+")

Re: [R] Line numbers with errors and warnings?

2012-12-05 Thread Worik R
honey...@gmail.com> wrote: > Hi, > > On Thu, Dec 6, 2012 at 12:01 AM, Worik R wrote: > > > > > >> If you `source("test.R", keep.source=FALSE)`, you will see that the > >> line number is not reported. > >> > > > > Not al

Re: [R] Line numbers with errors and warnings?

2012-12-05 Thread Worik R
If you `source("test.R", keep.source=FALSE)`, you will see that the > line number is not reported. > > Not always. I have code that uses sapply to call another function and all I get back is the line of the sapply. Useful but in the 21st century I do think I could get more aid from the runtime an

Re: [R] Line numbers with errors and warnings?

2012-12-02 Thread Worik R
lot of time chasing down errors in mine and others code... Worik On Sat, Dec 1, 2012 at 1:47 PM, Duncan Murdoch wrote: > On 12-11-30 7:15 PM, Worik R wrote: > >> How? >> >> This is a script I am running under ess on Emacs >> >> > I've never used ESS.

Re: [R] Line numbers with errors and warnings?

2012-11-30 Thread Worik R
How? This is a script I am running under ess on Emacs (Useful information optuion(error=recover) cheers Worik On Sat, Dec 1, 2012 at 12:34 PM, Duncan Murdoch wrote: > On 12-11-30 4:22 PM, Worik R wrote: > >> Is it possible to get a line number with an error report? >> >

[R] Line numbers with errors and warnings?

2012-11-30 Thread Worik R
Is it possible to get a line number with an error report? I have a long script and an error: Error in `[.xts`(x, xsubset) : subscript out of bounds It would be very helpful, and save a lot of time, if there was some indication in the error message which line the error was. I can find it using

[R] System problem: Sys.time() returns GMT, says NZDT

2012-11-12 Thread Worik R
When I say: > Sys.time() [1] "2012-11-12 21:30:14 NZDT" > But that is not what my clock on the wall and my system say. Cannot show you my clock but... worik@lemy:/tmp$ date Tue Nov 13 10:32:20 NZDT 2012 Sys.time() is returning GMT $version.string [1] "R version 2.14.1 (2011-12-22)" > Sys.ti

[R] Strange compiling behaviour

2012-10-31 Thread Worik R
Compiling this little function gets me some strange behaviour .initDataDir <- function(){ if(file.exists(LOCATION)) { if(as.logical(file.info(LOCATION)["isdir"]))return stop(LOCATION, " exists but is not a directory") } Z <- dir.create(LOCATION) if(!Z){ stop(geterrmessage()) ##

[R] Modern Symbolic debugger for R programmes?

2012-10-08 Thread Worik R
t "No source refs found.". I am starting to loose my mind! A debugger where I could set breakpoints with a little more granularity than the function level and a little more accessible than the trace function. What I ideally want is GDB for R. Does that exist

Re: [R] Trouble with [sv]apply

2012-04-20 Thread Worik R
           O.O#.       #.O#.  with > /Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k > ------- > Sent from my phone. Please excuse my brevity. > > Worik R wrote: > >>Friends >

[R] Trouble with [sv]apply

2012-04-19 Thread Worik R
: values must be length 7, but FUN(X[[2]]) result is length 14 > Calling S.f() returns a list. Do I have to accept I am going to be getting a list and I have to assemble a matrix in a loop? cheers Worik __ R-help@r-project.org mailing list https:

Re: [R] Can a matrix have 'list' as rows/columns?

2012-04-18 Thread Worik R
gt;> From: Worik R [mailto:wor...@gmail.com] >> Sent: Wednesday, April 18, 2012 5:05 PM >> To: William Dunlap >> Cc: r-help >> Subject: Re: [R] Can a matrix have 'list' as rows/columns? >> >> [snip] >> > >> > sapply.  In this ca

Re: [R] Can a matrix have 'list' as rows/columns?

2012-04-18 Thread Worik R
[1]][[1]] [1] TRUE [[1]]$ABC [1] 3.141593 > V2[2] [[1]] [1] "asd" That is astonishing to me! I had no way to predict what would happen. 5 days ago I would have expected the statement "as.vector(L)" to produce an error. "V[2] <- list()" did. cheers Wori

Re: [R] Can a matrix have 'list' as rows/columns?

2012-04-17 Thread Worik R
On Tue, Apr 17, 2012 at 11:52 PM, David Winsemius wrote: > > On Apr 17, 2012, at 12:13 AM, Worik R wrote: > > After a lot of processing I get a matrix into M. I expected each row and >> column to be a vector. But it is a list. >> > > This behavior is not the r

[R] Can a matrix have 'list' as rows/columns?

2012-04-16 Thread Worik R
After a lot of processing I get a matrix into M. I expected each row and column to be a vector. But it is a list. R-Inferno says... "Arrays (including matrices) can be subscripted with a matrix of positive numbers. The subscripting matrix has as many columns as there are dimensions in the array

Re: [R] Matrix problem

2012-04-10 Thread Worik R
sume... M[M[,"a"]==1000,] (from my example below) would return NULL, which has class "NULL" rather than a matrix with zero rows. thanks Worik On Wed, Apr 11, 2012 at 11:54 AM, David Winsemius wrote: > > On Apr 10, 2012, at 7:33 PM, Worik R wrote: > > Friends >

[R] Matrix problem

2012-04-10 Thread Worik R
Friends I am extracting sub-sets of the rows of a matrix. Generally the result is a matrix. But there is a special case. When the result returned is a single row it is returned as a vector (in the example below an integer vector). If there are 0, or more than 1 rows returned the result is a ma

Re: [R] Weird POSIXct behaviour

2012-03-29 Thread Worik R
On Fri, Mar 30, 2012 at 2:53 PM, Joshua Ulrich wrote: > On Thu, Mar 29, 2012 at 3:56 PM, Worik R wrote: > > > I removed the (not so minimal) reproducible example because you can > get the same behavior via: > > (s <- Sys.time()) > [1] "2012-03-29 20:43:35

Re: [R] Weird POSIXct behaviour

2012-03-29 Thread Worik R
I have a reproducible example of my problem below On Mon, Mar 26, 2012 at 9:22 AM, Joshua Ulrich wrote: > > Given two identical string representations of POSIXct objects, can the > two > > objects represent different times? > > > Yes. Here's an example (from my Ubuntu machine) of one way: > > >

Re: [R] Weird POSIXct behaviour

2012-03-25 Thread Worik R
My bad. I should be clearer about the source of my confusion. Given two identical string representations of POSIXct objects, can the two objects represent different times? > > Where has it gone? > > > It's hard to say, especially since you give no indication how you > assigned the value to Time

[R] Weird POSIXct behaviour

2012-03-25 Thread Worik R
Friends I have an xts that I wish to access. Browse[2]> DATA.ba[[p]]["2012-03-20 00:59:57","bid"] bid 2012-03-20 00:59:57 1.4993 So far so good. Now putting the index into a variable: Browse[2]> Time [1] "2012-03-20 00:59:57 NZDT" Browse[2]> DATA.ba[[p]][Time, "bid"]

[R] Looking for package 'rgp'

2011-12-17 Thread Worik R
I am interested in the package 'rgp' But > install.packages("rgp") Installing package(s) into ‘/home/worik/R/x86_64-pc-linux-gnu-library/2.12’ (as ‘lib’ is unspecified) Warning message: In getDependencies(pkgs, dependencies, available, lib) : package ‘rgp’ is not av

Re: [R] simple lm question

2011-12-03 Thread Worik R
> > Please note that your "df" and "M" are undoubtedly different > objects by now: > > Right. Not my most coherent day. thanks W > > M <- matrix(runif(5*20), nrow=20) > > colnames(M) <- c('a', 'b', 'c', 'd', 'e') > > l1 <- lm(e~., data=as.data.frame(M)) > > l1 > > Call: > lm(formula = e ~ .,

Re: [R] simple lm question

2011-12-02 Thread Worik R
Duh! Silly me! But my confusion persits: What is the regression being done? See below On Sat, Dec 3, 2011 at 5:10 PM, R. Michael Weylandt < michael.weyla...@gmail.com> wrote: > In your code by supplying a vector M[,"e"] you are regressing "e" > against all the variables provided in the da

Re: [R] simple lm question

2011-12-02 Thread Worik R
> > Use `lm` the way it is designed to be used, with a data argument: > > > l2 <- lm(e~. , data=as.data.frame(M)) > > summary(l2) > > Call: > lm(formula = e ~ ., data = as.data.frame(M)) > > And what is the regression being done in this case? How are the independent variables used? It looks like

[R] simple lm question

2011-12-01 Thread Worik R
I really would like to be able to read about this in a document but I cannot find my way around the documentation properly Given the code... M <- matrix(runif(5*20), nrow=20) colnames(M) <- c('a', 'b', 'c', 'd', 'e') ind <- c(1,2,3,4) dep <- 5 I can then do... l2 <- lm(M[,dep]~M[,ind]) ## Clearl

Re: [R] Why does length("") == 1?

2011-11-10 Thread Worik R
Thanks. Thinking like a C programmer again W On Fri, Nov 11, 2011 at 1:27 PM, Peter Langfelder < peter.langfel...@gmail.com> wrote: > On Thu, Nov 10, 2011 at 4:17 PM, Worik R wrote: > > It seems obvious to me that the empty string "" is length 0. > > You

[R] Why does length("") == 1?

2011-11-10 Thread Worik R
It seems obvious to me that the empty string "" is length 0. cheers Worik [[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-proje

[R] Getting Rcpp SEXP data in C++

2011-09-12 Thread Worik R
Friends I am looking at Rcpp and I am a bit stuck on a simple matter. (I am calling R from c++, if there is a better way...) Given this simple example using the TTR package and the SMA function which returns a simple moving average Rcpp::NumericVector rv; for(int i = 0; i < 100; i++){

[R] Advice on large data structures

2011-09-01 Thread Worik R
Friends I am starting on a (section of the) project where I need to build a matrix with on the order of 5 million rows and 200 columns I am wondering if I can stay in R. I need to do rollapply type operations on the columns, including some that will be functions of (windows of) two columns. I h

[R] Finding row in matrix with minimum column

2011-05-18 Thread Worik R
Friends If I have a matrix such as... [,1] [,2] [1,]77 [2,]79 [3,]9 2 [4,]79 And I want to find the row number that has the minimum value of column 2 (row 3 in this case) how can I do it? Is there a simple way? cheers Worik [[alternative HTML versio

Re: [R] Pretty printing numbers

2011-05-08 Thread Worik R
On Mon, May 9, 2011 at 12:06 PM, David Winsemius wrote: > > On May 8, 2011, at 8:02 PM, Worik R wrote: > > formatC(round(2189.745, 2), big.mark=",",format="f") >>> >> [1] "2,189.7400" >> >> Unfortunately this does not work &

Re: [R] Pretty printing numbers

2011-05-08 Thread Worik R
> formatC(round(2189.745, 2), big.mark=",",format="f") [1] "2,189.7400" Unfortunately this does not work Worik On Mon, May 9, 2011 at 11:45 AM, Peter Langfelder < peter.langfel...@gmail.com> wrote: > On Sun, May 8, 2011 at 4:41 PM, Worik R wrote: &

[R] Pretty printing numbers

2011-05-08 Thread Worik R
Friends I am trying to format a number to a string so 2189.745 goes to "2,189.35" and 309283.929 goes to "309,283.93" I have tried to use formatC(X, big.mark=",",drop0trailing=FALSE, format="f") but it does not get the number of decimals correct. Specifying digits does not work as that is signif

[R] Looking for equivalent for "strstr"

2011-05-05 Thread Worik R
Friends This is an elementary question. Is there is a built in R function for finding a sub-string in another string? Like strstr in C. I can easily roll my own, but if there is a built in that is one less thing I can do wrong! cheers Worik [[alternative HTML version deleted]] __

[R] Hash table...

2011-04-13 Thread Worik R
To improve the efficiency of a process I am writing I would like to cache results. So I would like a data structure like a hash table. So if I call Z <- f(Y) I can cache Z associated with Y: CACHE[Y] <- Z I am stumped. I expected to be able to use a list for this but I cannot figure how c

[R] Avoiding a loop

2011-04-07 Thread Worik R
Friends. I cannot simplify this much, and I think the loop is unavoidable. As a recovering C programmer I want to avoid loops and in cases like this I almost allways can by using an apply function. But I suspect in this case there is nothing I can do. It is a finance example where a price serie

[R] Odd results with lag

2011-04-07 Thread Worik R
Given a vector: > S <- c(1,1,0,0,1,1,-1,-1,-1,0,1) Then I expected lag(S) to give... c(1,0,0,1,1,-1,-1,-1,0,1) but instead... > S [1] 1 1 0 0 1 1 -1 -1 -1 0 1 > lag(S) [1] 1 1 0 0 1 1 -1 -1 -1 0 1 attr(,"tsp") [1] 0 10 1 > This is very odd. What is happening? I get what

[R] Modifying values outside a function using "apply".

2010-12-14 Thread Worik R
I am sure this si a simple problem but the solution is evading me. I have a list of matrices all with the same number of columns but different number of rows. The first two columns label the row. The labels are allways the same for the same row numbers, just some matricies have more rows. For e

[R] Putting legend *outside* plotting area

2010-08-29 Thread Worik R
Is there a simple way to put a legend outside the plot area for a simple plot? I found... (at http://www.harding.edu/fmccown/R/) # Expand right side of clipping rect to make room for the legend *par(xpd=T, mar=par()$mar+c(0,0,0,4))* # Graph autos (transposing the matrix) using heat colors, # pu

[R] Wilcox.test U values

2010-07-13 Thread Worik R
I have been examining the Mann-Whitney test closely. And there are two features of the R implementation that puzzles me. The test statistic is reported as "W" and depends on the order of the arguments to the function. > x <- c(1,3,5,7,9) > y <- x-1 > x [1] 1 3 5 7 9 > y [1] 0 2 4 6 8 > wilcox.t

Re: [R] t-test problem

2010-06-17 Thread Worik R
d Harding wrote: > On 16-Jun-10 22:30:39, Worik R wrote: > > I have two pairs of related vectors > > x1,y1 > > and > > x2,y2 > > > > I wish to do a test for differences in means of x1 and y1, > > ditto x2 and y2. > > > > I am getting odd r

Re: [R] t-test problem

2010-06-17 Thread Worik R
> Sorry, I realized that is is fairly easy to test that it is an issue > with which tail of the distribution you use. This should show what is > going on better than my prior message. > > 1.353946/2 = 0.676973 > 1 - 0.676973 = 0.323027 > 0.323027 * 2 = 0.646054 > > in pt(), the default is lower.ta

Re: [R] t-test problem

2010-06-16 Thread Worik R
More: When the t-stat is > 0 should I use 'pt' differently? I have been checking my results and (except for the example I posted) all the inconsistencies occur when t>0 Worik On Thu, Jun 17, 2010 at 10:30 AM, Worik R wrote: > I have two pairs of related vectors > x

Re: [R] t-test problem

2010-06-16 Thread Worik R
If it were not for the fact that I get inconsistent results I would be sure that I need... 2*pt(stat, df) Section 8.1 of R-intro.pdf is explicit. Problem is it gives inconsistent results Worik On Thu, Jun 17, 2010 at 10:30 AM, Worik R wrote: > I have two pairs of related vectors >

[R] t-test problem

2010-06-16 Thread Worik R
I have two pairs of related vectors x1,y1 and x2,y2 I wish to do a test for differences in means of x1 and y1, ditto x2 and y2. I am getting odd results. I am not sure I am using 'pt' properly... I have not included the raw vectors as they are long. I am interested if I am using R properly..

Re: [R] Scope and sapply

2010-06-12 Thread Worik R
I was careless. Here is a better example of what I am trying to. With the '<<-' you offered. ?<<- That was exactly what I needed, thankyou. cheers Worik N <- 10 ## x simulate a return series x <- runif(N)-.5 ## Build an array of cumulative returns of a portfolio starting with $1 as it chan

[R] Scope and sapply

2010-06-12 Thread Worik R
I am puzzled by the scope rules that apply with sapply. If I want to modify a vector with sapply I tried... N <- 10 vec <- vector(mode="numeric", length=N) test <- function(i){ vec[i] <- i } sapply(1:N, test) vec but it not work. How can this be done? Worik [[alternative HTML versio

[R] Logical vector question

2010-06-08 Thread Worik R
If I create a vector thusly > v1 <- runif(20, min=0, max=1) > v1 [1] 0.9754443 0.6306228 0.3238158 0.3175769 0.6791534 0.6956507 0.3840803 [8] 0.1421328 0.8592398 0.4388306 0.9472040 0.4727435 0.5645302 0.7391616 [15] 0.6116199 0.2727754 0.2657867 0.5261744 0.8764804 0.2032126 And I want to cre

[R] Efficiency question

2010-06-08 Thread Worik R
Given the following snippet m.nf.xts <- xts(rep(0, length(index(m.xts))), order.by=index(m.xts)) Does R know to cache the index(m.xts) or is it more efficient to say... m.i <- index(m.xts) m.nf.xts <- xts(rep(0, length(m.i)), order.by=index(m.i)) ? cheers Worik [[alternative HTML

[R] Why does 'apply(.., 1, .., ..)' transpose result

2010-04-22 Thread Worik R
I am sorry if this is documented in apply's dcumentation or completely obvious, I could not find or work it out. Given an matricies Q: 2x3, R:1x3 and S:1x2 apply(Q, 1, '-', R) is 3x2 and apply(Q, 2, '-', S) is 2x3 Why? cheers Worik > Q [,1] [,2] [,3] [1,]123 [2,] 10 11 1

Re: [R] Locating an error

2010-03-18 Thread Worik R
Thank you everybody for your help. I am sure using the information you provided I'll be able to do better than my current approach of using "cat" to trace my programmes! cheers Worik [[alternative HTML version deleted]] __ R-help@r-project.org

Re: [R] Locating an error

2010-03-17 Thread Worik R
2010 at 2:58 PM, Worik R wrote: > I have a large programme that after running half an hour or so fails with > an error > > Error in x[value] <- NA : only 0's may be mixed with negative subscripts > > How can I find out where that error occurs? > > If I have to

[R] Locating an error

2010-03-17 Thread Worik R
I have a large programme that after running half an hour or so fails with an error Error in x[value] <- NA : only 0's may be mixed with negative subscripts How can I find out where that error occurs? If I have to do a binary search using error messages it will take a long time! Is there some wa

Re: [R] "recursive default argument" error

2010-03-16 Thread Worik R
I do not understand this. I have the same problem and I tried to reproduce it thusly Q <- 3 test <- function(q=Q){ cat(q, "\n") } > test() 3 Q <- 3 test <- function(q=Q){ test2(q, "\n") } test2 <- function(q, a){ cat(q, a) } > test() 3 Q <- 3 test <- function(q=Q){ z <- paste(q, "\n")

[R] Indexing zoo objects

2010-03-02 Thread Worik R
I have a zoo object z z Value 2003-11-15 2.22 2003-11-17 2.26 2003-11-19 2.28 2003-11-22 2.54 2003-11-26 2.55 I wish to find the entry 2 entries before "2003-11-26". How do I do this? I thought I might be able to say index(z["2003-11-26"]) and have it return 5 so I could then s

[R] Stack type

2010-03-01 Thread Worik R
How can I implement a stack in R? I want to push and pop. Every thing I push and pop will be the same type, but not necessarily an atomic type. cheers Worik __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do

Re: [R] Expanding a data structure

2010-02-28 Thread Worik R
> change <- c(NA, diff(q1$..1)) > will be 1 when ..1 goes from FALSE > to TRUE, -1 for TRUE to FALSE, 0 for no change, and NA > for the first element. You may find it convenient to > change that NA to something else or to not deal with > the first element after computing the diff. > > This is ve

[R] Expanding a data structure

2010-02-28 Thread Worik R
I have a xts object with logical data . > tail(q1) ..1 2010-02-19 TRUE 2010-02-22 FALSE 2010-02-23 FALSE 2010-02-24 FALSE 2010-02-25 FALSE 2010-02-26 FALSE > I want to build a xts that records the dates that there is a change. If TRUE -> FALSE it is "down" if FALSE -> TRUE it is "u

[R] hist - unevenly spaced bars

2010-01-28 Thread Worik R
I am sure this is trivial, but I cannot solve it. I make a histogram. There are 5 categories "1",...,"5" and 80 values and the histogram does not evenly space the bars. Bars "1" and "2" have no space between them and the rest are evenly spaced. How can I get all bars evenly spaced? The code:

[R] Date formats in as.Date

2009-09-24 Thread Worik R
I have trouble with this: as.Date("Sep-1981", format="%b-%Y") Returns "NA" >From documentation for strftime '%b' Abbreviated month name in the current locale. (Also matches full name on input.) '%Y' Year with century. What am I doing wrong? cheers Worik [[alternative H

[R] Collecting data in a data structure

2009-09-16 Thread Worik R
Friends I cannot find this documented anyplace. I have a data frame with, say, 2 cols d<-data.frame(x=c(1:5), y=seq(from=2, to=10, by=2)) > d x y 1 1 2 2 2 4 3 3 6 4 4 8 5 5 10 And I want to collect each row where the first col is prime. To this end I have a function is.prime() I want

Re: [R] Help with sub-setting data.frame

2009-09-02 Thread Worik R
Thanks. I have no idea how I did not try that. Sigh! all good now! Worik On Wed, Sep 2, 2009 at 7:04 PM, Stefan Grosse wrote: > On Wed, 2 Sep 2009 17:12:18 +1200 Worik R wrote: > > WR> I have a data frame, df that I want to extract some rows from > > What you need is sub

[R] Help with sub-setting data.frame

2009-09-01 Thread Worik R
Friends I have a data frame, df that I want to extract some rows from Here is a sample of the data > head(df) TDate Expiry Underlie Strike CSettle PSettle Futures ExDate TTE 1 20080102 200801 200803 0.840 0. 0 0.9207 20080104 0.005479452 2 20080102 200801 200803 0.850 0

[R] Is this a bug?

2009-08-31 Thread Worik R
This programme for(T in 1:3){ for(j in 1:(5-1)){ for(k in (j+1):5){ for(l in (j+2):5){ print(paste("1 JKL:", j,k,l,sep=" ")) } } } } Prints out (among other things) [1] "1 JKL: 4 5 6" That is for(l in (j+2):5) sets l to 6 one more than the upper limit. cheers Wor

[R] Creating data.frames dynamically

2008-05-10 Thread Worik R
I have time series data in named vectors. They are all the same length for the same dates. The dates are in a separate vector. I want to create a vector of numeric data for every named series, associated with the dates in a data.frame. So if... Names <- c("a", "b", "c") d <- data.frame(dates=

[R] Lists of data.frame

2008-04-26 Thread Worik R
I cannot find out how to build data structures as lists of data structures. I want to do... r-help@r-project.org d1 <- data.frame(x=1, y=2) d2 <- data.frame(x=1, y=3) d3 <- data.frame(x=21, y=3) q1 <- data.frame(q=d1, n="a") q2 <- data.frame(q=d2, n="a") q3 <- data.frame(q=d3, n="a") v <-

[R] Time arithmetic

2008-04-23 Thread Worik R
I am a bit worried I am reinventing the wheel. Isn't there a calendar system in R? I have written a function to add months to a date and return the number of days resulting. I am newish to R so I am hoping there is a package that can do this sort of date arithmetic for me... Worik DaysInMonth

[R] difftime result in years?

2008-04-22 Thread Worik R
I would like to know how many years (including partial years) are between two dates. So difftime("20/11/1962", "20/5/1964", units="years") would be about 1.5 But units of years are not available. cheers Worik [[alternative HTML version deleted]]

[R] Incrementing Dates

2008-04-22 Thread Worik R
How can I increment the value of a Date class? I want to add a day, month or year to a date. cheers Worik [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the