Re: [R] count data without NA in certain time intervals and plot it

2012-06-16 Thread arun
Hi, Not quite understand the question. Do you want to select only certain columns or rows without NAs? Suppose, I have a dataset such as the one below: dattrial<-data.frame(a=c(1,NA,rnorm(4,10)),b=c(NA,NA,NA,3,4,6),c=c(sample(LETTERS[1:3],replace=TRUE), sample(LETTERS[3:5],3,replace=TRUE)),d

Re: [R] Temporal disaggregation

2012-06-16 Thread Jeff Newmiller
stop repeating yourself. and stop asking us to do your work. Try reading the posting guide. Give us an example of the output you DO want. Show us the code you already have. Use the dput function to give us example data to work with. Learn to use the str function so you know what data you are re

Re: [R] How do anova() and Anova(type="III") handle incomplete designs?

2012-06-16 Thread John Fox
Dear Justin, anova() and Anova() are entirely different functions; the former is part of the standard R distribution and the second part of the car package. By default, Anova() produces an error for type-III tests conducted on rank-deficient models because the hypotheses tested aren't generally

Re: [R] noob requesting help

2012-06-16 Thread R. Michael Weylandt
On Jun 16, 2012, at 1:56 PM, capital_P wrote: > > David Winsemius wrote >> >>> Try >>> >>> dat2 <- data.frame(do.call(cbind, dat), stringsAsFactors=FALSE) >> >> Use instead: >> >> dat2 <- data.frame( dat, stringsAsFactors=FALSE) >> > > Both do not seem to work: > >> dat2 <- data.frame(d

[R] count data without NA in certain time intervals and plot it

2012-06-16 Thread Tagmarie
Hello, I'm quite new to R and still spend hours trying to figure out single things so I hope nobody rolls his eyes over my question. I have a data set over time and converted it to the POSTIXct format. I added a column in the data set for the week and the month. I try to get a plot which shows

Re: [R] noob requesting help

2012-06-16 Thread capital_P
David Winsemius wrote > >> Try >> >> dat2 <- data.frame(do.call(cbind, dat), stringsAsFactors=FALSE) > > Use instead: > > dat2 <- data.frame( dat, stringsAsFactors=FALSE) > Both do not seem to work: > dat2 <- data.frame(do.call(cbind, dat), stringsAsFactors=FALSE) Error: cannot allocate vect

Re: [R] How to specify "newdata" in a Cox-Modell with a time dependent interaction term?

2012-06-16 Thread Jürgen Biedermann
Dear John, Thank you very much for the quick answer. I will use the mentioned citation of your book in the future. However: The Id argument is necessary for the function to know that the different rows belong to one individual. Or how the Help-File says: id: optional variable name of subje

Re: [R] Replication of linear model/autoregressive model

2012-06-16 Thread Miguel Manese
Hi Al, Michael, On Sat, Jun 16, 2012 at 11:01 AM, R. Michael Weylandt wrote: > On Fri, Jun 15, 2012 at 6:56 AM, Al Ehan wrote: >> Hi, >> >> I would like to make a replication of 10 of a linear, first order >> Autoregressive function, with respect to the replication of its innovation, >> e. for e

[R] Bootstrapping

2012-06-16 Thread Skorp
hello, I am trying to implement the bootstrapping to a set of insurance claim data in triangular form using the ChainLadder package. I want to obtain the prediction errors of the reserve estimate using the result from bootstrapping, here is the output: >BootChainLadder(Triangle = incr2cum(data)

Re: [R] strang behaviour of mice package

2012-06-16 Thread b04877054
I have the same problem. How did you end up solving yours? -- View this message in context: http://r.789695.n4.nabble.com/strang-behaviour-of-mice-package-tp3679224p4633609.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-proje

[R] How to specify "newdata" in a Cox-Modell with a time dependent interaction term?

2012-06-16 Thread Jürgen Biedermann
Dear Mr. Therneau, Mr. Fox, or to whoever, who has some time... I don't find a solution to use the "survfit" function (package: survival) for a defined pattern of covariates with a Cox-Model including a time dependent interaction term. Somehow the definition of my "newdata" argument seems to

Re: [R] DEoptim example illustrating use of fnMap parameter for enforcement of cardinality constraints

2012-06-16 Thread David-Michael Lincke
Hi Joshua, Thank you very much for the comprehensive response. In the meantime, I had taken a look at the source code of function DEoptim() and your example below confirms the conclusions that I have arrived at from that review as to the expected nature of the function passed as fnMap. What I

Re: [R] Loop Help

2012-06-16 Thread @ngel
Hello again and thank you all so much for the help. Well, I tried and did it myself, here's what I wrote: library(tnet) net <- read.table("data.txt") net <- as.tnet(net, type="longitudinal tnet") loop <- range(net[,1]) net.static <- vector(length=as.integer(loop[2]-loop[1])+1, mode="list") j <- 1

Re: [R] Cholesky decomposition error

2012-06-16 Thread Kjetil Halvorsen
see below. On Fri, Jun 15, 2012 at 11:53 PM, wrote: > Dear Mr.Kjetil, > > Thanks for your comment. You have already pointed me the article in reply to > one of my earlier post to this list and I am following the paper. Now I am > checking for condition for positive definiteness for original ma

[R] Temporal disaggregation

2012-06-16 Thread stef salvez
Dear R users, I have a panel data set (in MS excel) on prices across countries and time countrytime price 1 "23/11/08"2 1 "28/12/08" 3 1"25/01/09" 4 1 "22/02/09" 5 1"29/03/09"

Re: [R] DEoptim example illustrating use of fnMap parameter for enforcement of cardinality constraints

2012-06-16 Thread Joshua Ulrich
David, On Sat, Jun 16, 2012 at 2:41 PM, David-Michael Lincke wrote: > Hi Joshua, > > Thank you very much for the comprehensive response. > > In the meantime, I had taken a look at the source code of function > DEoptim() and your example below confirms the conclusions that I have > arrived at from

Re: [R] Plotting tidal speed and direction in R

2012-06-16 Thread Duncan Mackay
Hi The devil is in the detail of the components so here is a toy example to give you an idea in 2D but 5D It is somewhat easier to interpret if you condition. You may be able to visualize in 3D not all can. 3D can be a problem if distinguishing points are 180 degrees apart in the preferred vie

Re: [R] interpolation to montly data

2012-06-16 Thread Gabor Grothendieck
On Sat, Jun 16, 2012 at 8:19 AM, stef salvez wrote: > I have a panel data set (in MS excel)  like the one below > > >  1         "23/11/08"            2 > 1   "28/12/08"                   3 > 1    "25/01/09"                   4 > 1   "22/02/09"                   5 > 1    "29/03/09"                

Re: [R] Plotting tidal speed and direction in R

2012-06-16 Thread David Winsemius
On Jun 16, 2012, at 3:18 PM, Charles Berry wrote: zoeita live.co.uk> writes: Hi, I have had a look around the forums and I can't seem to find anything that works with my data. I have lats, longs, time, tidal speed and direction and need to plot this in an xy plot to determine changes

Re: [R] Plotting tidal speed and direction in R

2012-06-16 Thread Charles Berry
zoeita live.co.uk> writes: > > Hi, > > I have had a look around the forums and I can't seem to find anything that > works with my data. I have lats, longs, time, tidal speed and direction and > need to plot this in an xy plot to determine changes over time. contour and > cloud have been recomm

Re: [R] A basic design question for R

2012-06-16 Thread Onur Uncu
Thank you all for the useful replies. I will go with the list of matrices idea as suggested multiple times. On Sat, Jun 16, 2012 at 6:50 PM, Jeff Newmiller wrote: > A data frame is a list of vectors all with the same length. Note that vectors > have simple types. Sticking other types of object

Re: [R] gWidgets - gtable returning multiple values

2012-06-16 Thread j verzani
michaelyb gmail.com> writes: > > To whoever is looking for the same thing as I was, > I found a solution, or > sort of. > Here is the code: > > flavors<-c("vanilla", "chocolate", "strawberry") > > w <- gwindow("checkbox example") > gp <- ggroup(container=w) > glabel("Favorite flavors:",con

Re: [R] aligning axis labels in a colorkey from levelplot

2012-06-16 Thread ilai
On Sat, Jun 16, 2012 at 2:11 AM, Stephen Eglen wrote: > R does a great job with the fine details regarding plots. e.g in the > following: > > library(lattice) > y <- -4:4/10 > xyplot(y~1, las=1) > > No. las is a parameter in base graphics ?par. It was simply ignored here: xyplot(y~1,scales=list(

Re: [R] A basic design question for R

2012-06-16 Thread Jeff Newmiller
A data frame is a list of vectors all with the same length. Note that vectors have simple types. Sticking other types of objects into it violates the generic constraint stated above, leading to incompatibility with many functions that normally work with data frames. If you want to maintain data

Re: [R] interpolation to montly data

2012-06-16 Thread Miguel Manese
Hi Ken, Stef, We can make your script more elegant like below: On Sun, Jun 17, 2012 at 12:52 AM, Ken wrote: > > stef salvez googlemail.com> writes: [snip] > #load library > library(plyr) > > # utility function > mean.var = function(df, var){ mean(df[[var]], na.rm = T)}; > > # create example

Re: [R] A basic design question for R

2012-06-16 Thread Petr Savicky
On Sat, Jun 16, 2012 at 06:14:38PM +0100, Onur Uncu wrote: > Thank you. But isn't a data frame already a list? Data frame is a list of columns. The suggestion was to use a list, whose length is the number of rows and which contains a matrix for each row. > What is wrong with > adding a column to

Re: [R] A basic design question for R

2012-06-16 Thread Rui Barradas
Hello, Follow this example. It uses a list to hold the mortality curves. Since there are only two different gender/age combinations, it first gets all such unique combinations and then creates a list of the appropriate length. Then assigns a matrix to the first list element. DF <- read.table(

Re: [R] A basic design question for R

2012-06-16 Thread Onur Uncu
Thank you. But isn't a data frame already a list? What is wrong with adding a column to the existing data frame (a column with the mortality curve matrices)? Sorry if I am being difficult. Just want to learn good design in R. On Sat, Jun 16, 2012 at 5:49 PM, steven mosher wrote: > use a list.

[R] Efficient distance calculation on big matrix

2012-06-16 Thread Boel Brynedal
Hi All, I'm working on analyzing a large data set, lets asume that dim(Data)=c(1000,8700). I want to calculate the canberra distance between the columns of this matrix, and using a toy example ('test' is a matrix filled with random numbers 0-1): > system.time(d<-as.matrix(dist(t(test), method = "

Re: [R] interpolation to montly data

2012-06-16 Thread Ken
stef salvez googlemail.com> writes: > > I would like to clarify that since each observation is obtained every > 28 days, each such observation is a 4-week average > > thanks > > On 6/16/12, stef salvez googlemail.com> wrote: > > I have a panel data set (in MS excel) like the one below > > >

Re: [R] A basic design question for R

2012-06-16 Thread steven mosher
use a list. or create new class which is a list On Jun 16, 2012 8:52 AM, "Onur Uncu" wrote: > Hello R Community, > > I have the following design question. I have a data set that looks > like this (shortened for the sake of example). > > Gender Age > M 70 > F 65 > M

[R] A basic design question for R

2012-06-16 Thread Onur Uncu
Hello R Community, I have the following design question. I have a data set that looks like this (shortened for the sake of example). Gender Age M 70 F 65 M 70 Each row represents a person with an age/gender combination. We could put this data into a data frame. N

Re: [R] How to specify "newdata" in a Cox-Modell with a time dependent interaction term?

2012-06-16 Thread John Fox
Dear Jurgen, > fit <- survfit(mod.allison.5, newdata.1, individual=TRUE) > fit Call: survfit(formula = mod.allison.5, newdata = newdata.1, individual = TRUE) records n.max n.start events median 0.95LCL 0.95UCL 19809 432 432 114 NA NA NA plot(fit) # shows one s

Re: [R] interpolation to montly data

2012-06-16 Thread stef salvez
I would like to clarify that since each observation is obtained every 28 days, each such observation is a 4-week average thanks On 6/16/12, stef salvez wrote: > I have a panel data set (in MS excel) like the one below > > > 1 "23/11/08"2 > 1 "28/12/08" 3

Re: [R] time zones and the chron to POSIXct conversion

2012-06-16 Thread Gabor Grothendieck
On Fri, Jun 15, 2012 at 3:25 AM, Jannis wrote: > Hey R folks, > > > i found some strange (to me) behaviour with chron to POSIXct conversion. The > two lines of code result in two different results, on ewith the correct time > zone, one without: > > library(chron) > as.POSIXct(chron('12/12/2000'),

Re: [R] How to specify "newdata" in a Cox-Modell with a time dependent interaction term?

2012-06-16 Thread John Fox
Dear Jürgen, All the values of your Id variable are equal to 1; how can that make sense? Removing the argument Id=id may get you what you want. By the way, the document to which you refer was an appendix to a 2002 book that has been superseded by Fox and Weisberg, An R Companion to Applied Regr

Re: [R] Adding title to colorkey

2012-06-16 Thread Ricardo Pietrobon
Stephen, for ggplot2 you might want to check http://goo.gl/0Wx0B On Sat, Jun 16, 2012 at 4:40 AM, Stephen Eglen wrote: > > A recent paper on visualisation (in Neuron, a leading neuroscience > journal) surveyed how well previous articles in this journal labelled their > graphs (e.g. axis labelling

[R] R CMD -lgsl -lgslcblas *.c returns a fatal error: gsl/gsl_rng.h no such file or directory exists

2012-06-16 Thread kevinpw
Hello, I tried this posted on the R devel subforum but no help so far. Maybe the wider net will be fruitful. Probably a pretty simple issue. The short story goes, I'm writing C source code and compiling it in as *.dll in the windows terminal by R CMD SHLIB foo.c. It works, I'm on a 64-bit system

[R] Plotting tidal speed and direction in R

2012-06-16 Thread zoeita
Hi, I have had a look around the forums and I can't seem to find anything that works with my data. I have lats, longs, time, tidal speed and direction and need to plot this in an xy plot to determine changes over time. contour and cloud have been recommended to me as a way to do this but I can't

[R] interpolation to montly data

2012-06-16 Thread stef salvez
I have a panel data set (in MS excel) like the one below 1 "23/11/08"2 1 "28/12/08" 3 1"25/01/09" 4 1 "22/02/09" 5 1"29/03/09" 6 1 "26/04/09" 32 1 "24/05/09"

[R] Selecting correlated predictors with LASSO

2012-06-16 Thread ThomasH_MB
I'm using the package 'lars' in R with the following code: > library(lars) > set.seed(3) > n <- 1000 > x1 <- rnorm(n) > x2 <- x1+rnorm(n)*0.5 > x3 <- rnorm(n) > x4 <- rnorm(n) > x5 <- rexp(n) > y <- 5*x1 + 4*x2 + 2*x3 + 7*x4 + rnorm(n) > x <- cbind(x1,x2,x3,x4,x5) > cor(cbind(y,x)) y

Re: [R] Loop Help

2012-06-16 Thread Jim Lemon
On 06/16/2012 07:41 AM, @ngel wrote: Hello all, I'm new here and new to R, but I have to admit I'm learning rather fast. Right now I need to write a loop, and I don't seem to think I'm doing it properly, judging by the errors I get! What I need to do is to insert my data (csv-table) into a variab

[R] Adding title to colorkey

2012-06-16 Thread Stephen Eglen
A recent paper on visualisation (in Neuron, a leading neuroscience journal) surveyed how well previous articles in this journal labelled their graphs (e.g. axis labelling and describing their error bars). Of particular interest is that (only) 40% of plots labelled what their colorkey was showing

[R] aligning axis labels in a colorkey from levelplot

2012-06-16 Thread Stephen Eglen
R does a great job with the fine details regarding plots. e.g in the following: library(lattice) y <- -4:4/10 xyplot(y~1, las=1) the y axis is labelled with numbers -0.4, -0.2, 0.0, 0.2, 0.4 with the numbers aligned on the decimal point. How do I get the same behaviour in the colorkey of a lev

Re: [R] time zones and the chron to POSIXct conversion

2012-06-16 Thread David Winsemius
On Jun 16, 2012, at 1:01 AM, Jeff Newmiller wrote: Why would a date function have a TZ? `as.Date` wouldn't. This statement seems nonsensical to me. POSIXt objects have tzone attributes. I earlier expressed surprise at this statement based on: attributes(as.POSIXct(chron('12/12/2000'),

Re: [R] time zones and the chron to POSIXct conversion

2012-06-16 Thread David Winsemius
On Jun 16, 2012, at 1:01 AM, Jeff Newmiller wrote: Why would a date function have a TZ? `as.Date` wouldn't. This statement seems nonsensical to me. POSIXt objects have tzone attributes. They do? -- David. Date and chron objects do not. Since they do not include tzone, logically the us

[R] Loop Help

2012-06-16 Thread @ngel
Hello all, I'm new here and new to R, but I have to admit I'm learning rather fast. Right now I need to write a loop, and I don't seem to think I'm doing it properly, judging by the errors I get! What I need to do is to insert my data (csv-table) into a variable, and take snapshots of my data (it'

Re: [R] Decision Trees or Markov Models for Cost Effectiveness

2012-06-16 Thread Ricardo Pietrobon
not quite an R package, but one way of taking advantage of R would be to use something like treeplan http://goo.gl/wHsb6 along with RExcel http://goo.gl/ToD77 On Thu, Jun 14, 2012 at 11:34 AM, stefan.d...@gmail.com < stefan.d...@gmail.com> wrote: > Hi Noah, > > I did ask basically the same questi