similar to: Problem with diff(strptime(...

Displaying 20 results from an estimated 140 matches similar to: "Problem with diff(strptime(..."

2010 Dec 30
2
optim and singularity
Hello, I was unable to find clues to my problem in ?optim. Using the data and code below, I get an error ("system is exactly singular") when a particular line of code is left in, but have found that 'optim' works when I comment it out. The line of code in question is after the closeAllConnections() line of code and contains a call to "na.approx" from the zoo package.
2010 Dec 22
0
adjust secondary y-axis bounds to minimize visual residuals
Hello, I'm plotting two sets of data referenced to either the left or right y-axes. The first, water table depth (blue circles), is plotted on the left y-axis in reverse order (0 at the top) as this is more intuitive when thinking in terms of depth. The second is electrical conductance (a surrogate for salinity), and is referenced to the right y-axis. The data and plot commands follow
2018 Apr 25
2
Wanted: WebRTC tutorial
On 04/24/2018 09:08 AM, Matt Fredrickson wrote: > On Tue, Apr 24, 2018 at 10:54 AM, Bruce Ferrell <bferrell at baywinds.org> wrote: >> A while back (last year maybe?), there was a Digium blog post on setting up >> WebRTC. >> >> I was never able to get that working. >> >> I was working with Asterisk 15 on a RHEL derived distro and had no idea of >>
2011 Jan 26
2
applying a set of rules to each row
All, I would like to apply a set of rules to each row of the sample data set below. The rule sets are the guidelines for determining an individual's date for retirement eligibility. The rules are found in this document, http://www.opm.gov/feddata/RetirementPaperFinal_v4.pdf. I am only interested in the top two categories for retirement eligibility, the CSRS and FERS plans. The data set has
2018 Jan 15
1
Time-dependent coefficients in a Cox model with categorical variants
Suppose I have a dataset contain three variants, looks like > head(dta) Sex tumorsize Histology time status 0 1.5 2 12.1000 0 1 1.8 1 38.4000 0 ..................... Sex: 1 for male; 0 for female., two levels Histology: 1 for SqCC; 2 for High risk AC; 3 for low risk AC,
2007 Sep 24
2
Calculate difference between dates in years
Hello, I would like to be able to calculate the age of someone at a particular date. Both dates are date objects. Here is what I have come up with: floor(as.numeric(sampleInfo$Date.of.DIAGNOSIS-sampleInfo$Date.of.birth)/365.25) Is this the best approach? or is there an inbuilt function? I have looked at difftime but that does not seem to allow output in years. Many thanks Dan --
2007 Oct 25
1
Strange behavior with time-series x-axis
I recently called plot(x,y) where x was an array of POSIXct timestamps, and was pleasantly surprised that it produced a nice plot right out of the box: z <- as.POSIXct(c("2006-10-26 08:00:00 EDT","2007-10-25 12:00:00 EDT")) x <- seq(z[1],z[2],len=100) y <- 1:100 plot(x,y,type="l") The X axis had nice labels, one tick mark every other month. (Plotting on
2012 Nov 27
4
Fitting and plotting a coxph with survfit, package(surv)
Hi Dear R-users I have a database with 18000 observations and 20 variables. I am running cox regression on five variables and trying to use survfit to plot the survival based on a specific variable without success. Lets say I have the following coxph: >library(survival) >fit <- coxph(Surv(futime, fustat) ~ age + rx, data = ovarian) >fit what I am trying to do is plot a survival
2010 Nov 24
2
Is there an equivalent to predict(..., type="linear") of a Proportional hazard model for a Cox model instead?
Hi all, Is there an equivalent to predict(...,type="linear") of a Proportional hazard model for a Cox model instead? For example, the Figure 13.12 in MASS (p384) is produced by: (aids.ps <- survreg(Surv(survtime + 0.9, status) ~ state + T.categ + pspline(age, df=6), data = Aidsp)) zz <- predict(aids.ps, data.frame(state = factor(rep("NSW", 83), levels =
2009 Mar 30
1
Possible bug in summary.survfit - 'scale' argument ignored?
Hi all, Using: R version 2.8.1 Patched (2009-03-07 r48068) on OSX (10.5.6) with survival version: Version: 2.35-3 Date: 2009-02-10 I get the following using the first example in ?summary.survfit: > summary( survfit( Surv(futime, fustat)~1, data=ovarian)) Call: survfit(formula = Surv(futime, fustat) ~ 1, data = ovarian) time n.risk n.event survival
2006 Aug 17
1
putting the mark for censored time on 1-KM curve or competing risk curve
Hi All, I'm trying to figure out the cumulative incidence curve in R in some limited time. I found in package "cmprsk", the command "plot.cuminc" can get this curve. But I noticed that there is no mark for the censored time there, comparing with the KM curve by "plot.survfit". Here are my codes (attached is the data): ----------------
2011 Jul 14
1
glm() scale parameters and predicted Values
In glm() you can use the summary() function to recover the shape parameter (the reciprocal of the dispersion parameter). How do you recover the scale parameter? Also, in the given example, how I estimate and save the geometric mean of the predicted values? For a simple model you can use fitted() or predicted() functions. I will appreciate any help. ? ? ? #Call required R packages require(plyr)?
2009 Jan 19
1
further notes on model.frame issue
This is a follow-up on my note of Saturday. Let me start with two important clarifications - I think this would be a nice addition, but I've had exactly one use for it in the 15+ years of developing the survival package. - I have a work around for the current case. Prioritize accordingly. The ideal would be to change survexp as follows: fit <- survexp( ~ gender,
2018 Mar 18
0
rdwd package error: invalid file argument raised by readDWD
Hi: I tried to download germany' historical weather data with rdwd package. However, when I tried to read downloaded data (1080 txt file in total) with readDWD function, but R raised an error down below: library(rdwd) ftpURL <- selectDWD(name = "", exactmatch = TRUE, res="monthly", var="kl", per="historical",
2011 May 14
2
changing the day of the week in dates format
Dear all, I have a question related to the POSIXlt function in R. I have a set of dates and times, for exmaple: startx <- as.POSIXct("2011-01-01 00:00:00") finx <- as.POSIXct("2011-12-31 00:00:00") daysx<- seq(startx, finx, by="24 hours") I want to change the dates of all the days falling on a Saturday to the next working day (i.e. Monday). So I
2011 May 26
5
Survival: pyears and ratetable: expected events
Dear all, I am having a (really) hard time getting pyears to work together with a ratetable to give me the number of expected events (deaths). I have the following data: dos, date of surgery, as.Date dof, date of last follow-up, as.Date dos, date of surgery, as.Date sex, gender, as.factor (female,male) ev, event(death), 0= censored at time point dof, 1=death at time point dof Could someone
2005 Aug 19
2
Handling dates
I have a problem with some functions handling dates, in packages 'date' and 'survival' (they seem to be identical). For instance, from the documentation, -------------------- mdy.date {survival} R Documentation Convert to Julian Dates Description Given a month, day, and year, returns the number of days since January 1, 1960. Usage mdy.date(month, day, year, nineteen = TRUE,
2011 Nov 07
2
Problem working with dates
Hello All, I've been reading books about R for awhile now and am in the process of replicating the SAS analyses from an old report. I want to be sure that I can do all the things I need to in R before using it in my daily work. So far, I've managed to read in all my data and have done some data manipulation. I'm having trouble with fixing an error in a date variable though, and was
2005 Dec 20
2
Time data
Dear All, I wonder how to compute the age from the date of birth and the date of examination. Suppose that have the following data: df <- as.data.frame(rbind(c(1,"10/08/1950","15/03/1998"), c(1,"10/08/1950","20/07/1998"), c(1,"10/08/1950","23/10/1998"))) names(df) <- c("ID", "date_birth",
2005 Dec 18
13
calculate age based on DoB
Hi, I wrote a little helper that calulates someone''s age based on his/her date of birth. def age(dob) diff = Date.today - dob age = (diff / 365.25).floor age.to_s end It works fine, but it''s not completely accurate as it just takes the average days in a year. It should be able to calculate this more accurately, right? I can''t work it out