Dear Jim,
Thanks a lot for your support.
Take care.
Md
On Wed, Aug 5, 2020 at 1:06 PM Jim Lemon wrote:
> Hi Md,
> I think the errors are that you forgot to initialize "m", calculated
> the mean outside the loops and forgot the final brace:
>
> m<-rep(0,44)
> for(i in 1975:2017) {
> for(j in
Dear Rui,
Thank you for your nice help.
Take care and be safe.
Md
On Tue, Aug 4, 2020 at 10:45 PM Rui Barradas wrote:
> Hello,
>
> Please keep cc-ing the list R-help is threaded and questions and answers
> might be of help to others in the future.
>
> As for the question, see if the following
Hi Md,
I think the errors are that you forgot to initialize "m", calculated
the mean outside the loops and forgot the final brace:
m<-rep(0,44)
for(i in 1975:2017) {
for(j in 1:44) {
mddat2[j]<-mddat[mddat$Year == i & mddat$Month >= 7 |
mddat$Year == (i+1) & mddat$Month <= 6,]
m[j]=m
Hello,
Please keep cc-ing the list R-help is threaded and questions and answers
might be of help to others in the future.
As for the question, see if the following code does what you want.
First, create a logical index i of the months between 7 and 3 and use
that index to subset the original
Your problem is in the subset operation. You have asked for a value of
month greater or equal to 7 and less than or equal to 6. You probably
got an error message that told you that the data were of length zero
or something similar. If you check the result of that statement:
> mddat$month >= 7 & md
Hello,
And here is another way, with aggregate.
Make up test data.
set.seed(2020)
df1 <- expand.grid(Year = 2000:2018, Month = 1:12)
df1 <- df1[order(df1$Year),]
df1$Value <- sample(20:30, nrow(df1), TRUE)
head(df1)
#Use subset to keep only the relevant months
aggregate(Value ~ Year, data = s
On 2020-08-03 21:11 +1000, Jim Lemon wrote:
> On Mon, Aug 3, 2020 at 8:52 PM Md. Moyazzem Hossain
> wrote:
> >
> > Hi,
> >
> > I have a dataset having monthly
> > observations (from January to
> > December) over a period of time like
> > (2000 to 2018). Now, I am trying to
> > take an average
Hi Md,
One way is to form a subset of your data, then calculate the means by year:
# assume your data is named mddat
mddat2<-mddat[mddat$month < 7,]
jan2jun<-by(mddat2$value,mddat2$year,mean)
Jim
On Mon, Aug 3, 2020 at 8:52 PM Md. Moyazzem Hossain wrote:
>
> Hi,
>
> I have a dataset having mont
Hi,
I have a dataset having monthly observations (from January to December)
over a period of time like (2000 to 2018). Now, I am trying to take an
average the value from January to July of each year.
The data looks like
YearMonth Value
20001 25
20002 28
20003
ot; "58" "59" "60"
[61] "61" "62" "63" "64" "65" "66" "67" "68" "69" "70" "71" "72"
[73] "73" "74" "75"
, 2013 12:52 PM
Subject: Re: [R] arrange data
it is ok, but I want for all rows not only for 2, like in my example.
Thank you very much!
On 6 April 2013 19:47, arun wrote:
>
>Hi,
>Try this:
>#dat1 is dataset
>indx<-apply(dat1,2,function(x) head(which(!is.na(x)),2))
>re
e -
From: catalin roibu
To: r-help@r-project.org
Cc:
Sent: Saturday, April 6, 2013 10:28 AM
Subject: [R] arrange data
Hello all!
I have a problem to arrange data in another form. My initial data is like
this:
'data.frame': 421 obs. of 58 variables:
$ 01A: num NA NA NA NA NA NA NA N
If you want to reorder the column names of your data frame, try (it would
have been nice if you provided a subset of your data with 'dput'):
# create the order of the new columns
indx <- order(substring(colnnames(df), 3, 3)
, substring(colnames(df), 1, 2)
)
df <
On Apr 6, 2013, at 7:28 AM, catalin roibu wrote:
> Hello all!
> I have a problem to arrange data in another form. My initial data is like
> this:
> 'data.frame': 421 obs. of 58 variables:
> $ 01A: num NA NA NA NA NA NA NA NA NA NA ...
> $ 01B: num NA NA NA NA NA NA NA NA NA NA ...
> $ 03A: num
Hello all!
I have a problem to arrange data in another form. My initial data is like
this:
'data.frame': 421 obs. of 58 variables:
$ 01A: num NA NA NA NA NA NA NA NA NA NA ...
$ 01B: num NA NA NA NA NA NA NA NA NA NA ...
$ 03A: num NA NA NA NA NA NA NA NA NA NA ...
$ 03B: num NA NA NA NA N
om: Roslina Zakaria
>To: Felipe Carrillo
>Sent: Sunday, November 11, 2012 10:56 PM
>Subject: Re: [R] arrange data
>
>
>Thank you so much Felipe, I'll try your suggestion.
>
>
>From: Felipe Carrillo
>To: Roslina Zakaria ; "r-help@r-project.org"
ntan.dt[,3]!=31,]) # assuming 3rd column corresponds to day
A.K.
- Original Message -
From: Roslina Zakaria
To: "r-help@r-project.org"
Cc:
Sent: Sunday, November 11, 2012 9:39 PM
Subject: [R] arrange data
Dear r-users,
I have daily rainfall data from 1971 to 2000. I w
0);both
Felipe D. Carrillo
Supervisory Fishery Biologist
Department of the Interior
US Fish & Wildlife Service
California, USA
http://www.fws.gov/redbluff/rbdd_jsmp.aspx
From: Roslina Zakaria
>To: "r-help@r-project.org"
>Sent: Sunday, November 11, 2012 6:39 PM
>Subject
Dear r-users,
I have daily rainfall data from 1971 to 2000. I would like to extract november
and december data only. I would also like to do column bind for november and
december, therefore I would like to delete 31 December from december data so
that the length of november and december are
1006
#5 99 2 941
#6 0 2 1075A.K.
- Original Message -
From: Rui Barradas
To: arun
Cc: Roslina Zakaria ; R help
Sent: Saturday, October 6, 2012 7:22 AM
Subject: Re: [R] arrange data
Hello,
Using Arun's data example, instead of creating a factor "convert&
0 9 633
#34 010 553
#35 011 914
#36 012 1039
A.K.
- Original Message -
From: Roslina Zakaria
To: "r-help@r-project.org"
Cc:
Sent: Friday, October 5, 2012 8:09 PM
Subject: [R] arrange data
Dear r-users,
I have dailly rainfall data from year
ahun Bahun ..1
#31 0 7 685
#32 0 8 504
#33 0 9 633
#34 0 10 553
#35 0 11 914
#36 0 12 1039
A.K.
- Original Message -
From: Roslina Zakaria
To: "r-help@r-project.org"
Cc:
Sent: Friday, October 5, 2012 8:09 PM
Subject: [R] a
Dear r-users,
I have dailly rainfall data from year 1971 to 2000. I use aggregate to form
monthly rainfall data. What I don't understand is that the data for the year
2000 become on the top, instead of year 1971. Here are some codes and output:
agg_dt1 <- aggregate(x=dt1[,4],by=dt1[,c(1,
@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Roslina Zakaria
Sent: Tuesday, 1 June 2010 2:55 PM
To: r-help@r-project.org
Cc: roslinazairimah zakaria
Subject: [R] arrange data
Hi r-users,
I have a data below but I would like to rearrange my data so that it will be in
the follow
Hi r-users,
I have a data below but I would like to rearrange my data so that it will be in
the following format: year, month, day, rain. I also would like the data to be
arranged so that it will be continues for example year 1939 it will go from
january 1 to december 31 and continue with yea
25 matches
Mail list logo