Re: [R] Finding values in a dataframe at a specified hour

2015-04-13 Thread PIKAL Petr
d because lack of data. Cheers Petr > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of > Alexandra Catena > Sent: Friday, April 10, 2015 11:07 PM > To: r-help@r-project.org > Subject: Re: [R] Finding values in a dataframe at a specified

Re: [R] Finding values in a dataframe at a specified hour

2015-04-10 Thread Jim Lemon
Hi Alexandra, I answered too quickly. Your response made me look for a deeper error: The value of i doesn't matter, as it isn't being used as an index. However, the first value of i=0 may cause the error in the second loop, where h is used as an index. for (i in 0:23){ hourRow = which(windHW$hou

Re: [R] Finding values in a dataframe at a specified hour

2015-04-10 Thread Alexandra Catena
Hi Jim, Thanks for the response, but unfortunately it results in the same error. I think it is something wrong with the if statement. I tried it out manually for the first row and hour that it's testing and indeed, the wind speed is not higher than the 5*sigma value. Since it is not higher than

Re: [R] Finding values in a dataframe at a specified hour

2015-04-10 Thread Jim Lemon
Hi Alexandra, The error probably comes from the first iteration of i in 0:23. As indexing in R begins at 1, there is no element 0. Try using: for(i in 1:24) { ... and see what happens. Jim On Sat, Apr 11, 2015 at 7:06 AM, Alexandra Catena wrote: > Update: > > I have this so far. * The first

Re: [R] Finding values in a dataframe at a specified hour

2015-04-10 Thread Alexandra Catena
Update: I have this so far. * The first column of windHW is the wind speed. The 5th column of the dataframe, spring, is the 5*sigma value of every hour. hourRow gives out all the rows of wind speed at a given hour. for (i in 0:23){ hourRow = which(windHW$hour==i,arr.ind=TRUE) for (h in hour