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
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
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,]
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 &
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 =
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
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
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
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
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 NA
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 -
: catalin roibu catalinro...@gmail.com
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 NA NA
Sent: Saturday, April 6, 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 smartpink...@yahoo.com wrote:
Hi,
Try this:
#dat1 is dataset
indx-apply(dat1,2,function(x) head(which
, 2013 2:27 PM
Subject: Re: [R] arrange data
It is not for this case. I want to create a growth mean by row and compare with
another serie mean.
medrw1 - apply(res,1,median,na.rm=TRUE)
test-cbind(medrw1)
in this case I want to create a new column at first position which contain this
seq
To: Felipe Carrillo mazatlanmex...@yahoo.com
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 mazatlanmex...@yahoo.com
To: Roslina Zakaria zrosl...@yahoo.com; r-help@r-project.org
r-help@r
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
. 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 zrosl...@yahoo.com
To: r-help@r-project.org r-help@r-project.org
Sent: Sunday, November 11, 2012 6:39 PM
Subject: [R] arrange data
]!=31,]) # assuming 3rd column corresponds to day
A.K.
- Original Message -
From: Roslina Zakaria zrosl...@yahoo.com
To: r-help@r-project.org 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
#36 012 1039
A.K.
- Original Message -
From: Roslina Zakaria zrosl...@yahoo.com
To: r-help@r-project.org 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 1971 to 2000. I use aggregate
2 1075A.K.
- Original Message -
From: Rui Barradas ruipbarra...@sapo.pt
To: arun smartpink...@yahoo.com
Cc: Roslina Zakaria zrosl...@yahoo.com; R help r-help@r-project.org
Sent: Saturday, October 6, 2012 7:22 AM
Subject: Re: [R] arrange data
Hello,
Using Arun's data example, instead
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 -
: [R] arrange data
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
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
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 following format: year, month, day, rain. I also would like the data to be
arranged
25 matches
Mail list logo