Dear R Community,
I wish to create 5 preceding dates from the date variable by ID. How
could I create such dates? The code should consider leap year.
Thanks
Sample data follows:
structure(list(id = 1:12, date = structure(c(9L, 6L, 11L, 8L,
7L, 5L, 4L, 3L, 12L, 1L, 10L, 2L), .Label = c("01feb20
I want to rename columns 1 to 6 in the sample data set as bp_1 to
bp_6. How could I do that in R?
Thanks
> dput(dff)
structure(list(one = c(1.00027378507871, 0.982313483915127, 1.1531279945243,
1.07400410677618, 1.22710472279261, 1.19762271047046, 1.10904859685147,
1.32060232717317), two = c(1.0
I have a measurement that was taken in 15 minutes or more and want to
aggregate it by hour. How could I do that?
Sample data is found below
date_time concentration
26/11/2013 15:46 529.25
26/11/2013 16:03 1596
26/11/2013 16:23 1027.111
26/11/2013 16:39 1001.9
26/11/2013 16:54 -80.25
26/11/2013 17:
I want to replace column c3 with values from column c2 whenever values
of column Id are 2. In stata I could use replace c3 = c2 if id ==2.
How could I do that in R?
Thanks
Sample data found below:
> dput(df4)
structure(list(c2 = c(42L, 42L, 47L, 47L, 55L, 55L, 36L, 36L,
61L, 61L), c3 = c(68L, 5
This post has NOT been accepted by the mailing list yet.
I would like to subset a column based on the contents of a column with
specific character. In the sample data I wish to do the following:
First keep the data based on column "prog" if prog contains "ca", and
secondly to drop if race contains
I have several lme objects like the ones shown below and I wish to
combine the coefficients and confidence intervals of fixed effects of
several models. Is there a function that could do that job?
m1 <- lme(mark1 ~ pm10 + temp + + age + gender + bmi + statin
+ smoke + dow + season
I have a data frame with some extreme values which I wish to identify
and repeat an analysis without these extreme values. How could I
identify several columns with values which are 5 times higher than the
99th percentile?
Sample data is pasted below.
> dput(df)
structure(list(ad1 = c(98, 6.9, 8
Dear R users,
I have a data with month and year columns which are both characters
and wanted to create a new column like Jan-1999
with the following code. The result is all NA for the month part. What
is wrong with the and what is the right way to combine the two?
ddf$MonthDay <- paste(month.abb
ld appreciate if you could suggest a working solution
Thanks
On 23 September 2014 18:03, Marc Schwartz wrote:
> On Sep 23, 2014, at 10:41 AM, Kuma Raj wrote:
>
>> Dear R users,
>>
>> I have a data with month and year columns which are both characters
>> and wanted t
I want to generate a sequence of date based on a group id(similar IDs
should have same date). The id variable contains unequal observations
and the length of the data set also varies. How could I create a
sequence that starts on specific date (say January 1, 2000 onwards)
and continues until the e
I want to sum columns based on their names. As an exampel how could I
sum columns which contain 6574, 7584 and 85 as column names? In
addition, how could I sum those which contain 6574, 7584 and 85 in
ther names and have a prefix "f". My data contains several variables
with
I want to sum columns
How can I merge data frame df and "tem" shown below by filling the
head of "tem" with missing values?
a<- rnorm(1825, 20)
b<- rnorm(1825, 30)
date<-seq(as.Date("2000/1/1"), by = "day", length.out = 1825)
df<-data.frame(date,a,b)
tem<- rpois(1095, lambda=21)
Thanks
A solution on the link below provides the steps of updating R without
losing packages in Unix.
http://zvfak.blogspot.se/2012/06/updating-r-but-keeping-your-installed.html
How could I do that on windows 7 platform?
Thanks
__
R-help@r-project.org mailin
I have a matrix names test which I want to convert to a data frame. When I
use a command test2<-as.data.frame(test) it is executed without a problem.
But when I want to browse the content I receive an error message "Error in
data.frame(outcome = c("cardva", "respir", "cereb", "neoplasm", :
dupli
:31, Berend Hasselman wrote:
>
> On 08-11-2013, at 10:40, Kuma Raj wrote:
>
> > I have a matrix names test which I want to convert to a data frame. When
> I
> > use a command test2<-as.data.frame(test) it is executed without a
> problem.
> > But when I want to browse
I have asked this question on SO, but it attracted no response, thus I am
cross- posting it here with the hope that someone would help.
I want to estimate the effect of pm10 and o3 on three outcome(death, cvd
and resp). What I want to do is run one model for each of the main
predictors (pm10 and
pply(varlist0,function(v) {
> lapply(outcomes, function(o){
> f <- sprintf("%s~ s(time,bs='cr',k=200)+s(temp,bs='cr') +
> Lag(%s,0:6)", o, v)
>
> gam(as.formula(f),family=quasipoisson,na.action=na.omit,data=df)
> })})
>
>
> plist <- lapply(slist, `[[`, 'p.table')
>
>
> Hope this helps,
>
> Rui Barradas
>
> Em 12-11-2013 13:28, Kuma Raj escreveu:
>
>> Thanks for the script which works perfectly. I am interested to do
>> model checking and also interested
18 matches
Mail list logo