Displaying 10 results from an estimated 10 matches similar to: "Paste problem when looping variable assignments"
2017 Dec 18
0
Finding center of mass in a hydrologic time series
Hi Eric,
the following works for me.
HTH,
Eric
library(EGRET)
StartDate <- "1990-10-01"
EndDate <- "2017-09-30"
siteNumber <- "10310000"
QParameterCd <- "00060"
Daily <- readNWISDaily(siteNumber, QParameterCd, StartDate, EndDate)
# Define 'center of mass' function
com <- function(x) {
match(TRUE, cumsum(x/sum(x)) > 0.5) -
2011 Jun 07
1
Sorting a data frame with values of different lengths
Hi all,
I am attempting to run a script in which I permute my data and run a
Wilcoxon rank sum test on the data 1000 times and compare my original test
statistic to the permuted test statistics to more accurately estimate a
significance level for the trends I am observing.
In the process of doing this, I need to sort a data frame that measures 3 x
1001 based on the value of the test statistic
2017 Dec 18
2
Finding center of mass in a hydrologic time series
Eric B's response provided just the kind of quick & simple solution I was
hoping for (appears as the function com below). However, I once again
failed to take advantage of the power of R and have reverted back to using
a for loop for the next step of the processing. The example below (which
requires the library EGRET for pulling an example dataset) works, but
probably can be replaced
2017 Jun 07
0
Determining which.max() within groups
cumsum() seems to be what you need.
This can probably be done more elegantly, but ...
out <- aggregate(Q ~ wyr, data = Daily, which.max)
tbl <- table(Daily$wyr)
out$Q <- out$Q + cumsum(c(0,tbl[-length(tbl)]))
out
## yields
wyr Q
1 1990 4
2 1991 6
3 1992 9
4 1993 15
5 1994 18
I leave the matter of Julian dates to you or others.
Cheers,
Bert
Bert Gunter
"The trouble
2017 Jun 07
4
Determining which.max() within groups
Using the dataset below, I got close to what I'm after, but not quite all
the way there. Any suggestions appreciated:
Daily <- read.table(textConnection(" Date wyr Q
1911-04-01 1990 4.530695
1911-04-02 1990 4.700596
1911-04-03 1990 4.898814
1911-04-04 1990 5.097032
1911-04-05 1991 5.295250
1911-04-06 1991 6.569508
1911-04-07 1991 5.861587
1911-04-08 1991 5.153666
2017 Dec 16
0
Finding center of mass in a hydrologic time series
Hi Eric,
How about
match( TRUE, cumsum(hyd/sum(hyd)) > .5 ) - 1
HTH,
Eric
On Sat, Dec 16, 2017 at 3:18 PM, Morway, Eric <emorway at usgs.gov> wrote:
> The small bit of script below is an example of what I'm attempting to do -
> find the day on which the 'center of mass' occurs. In case that is the
> wrong term, I'd like to know the day that essentially cuts
2004 Jun 10
3
Package installation
Hi all,
I'm very new to R.
I have installed R 1.9.0 on Linux (Fedora).
Now I got an self-made package comprising R functions as well as C-Code
which are used in several R functions.
I installed the package without any error (see install log below).
Then, I checked in /usr/lib/R/library if the package izbi exists and it
exists.
But whenever I try to load the library on the command line I
2017 Dec 16
3
Finding center of mass in a hydrologic time series
The small bit of script below is an example of what I'm attempting to do -
find the day on which the 'center of mass' occurs. In case that is the
wrong term, I'd like to know the day that essentially cuts the area under
the curve in to two equal parts:
set.seed(4004)
Date <- seq(as.Date('2000-09-01'), as.Date('2000-09-30'), by='day')
hyd <-
2012 Jun 11
2
Define a variable on a non-standard year interval (Water Years)
Hello,
I am trying to define a different interval for a "year". In hydrology,
a "water year" is defined as the period between October 1st and
September 30 of the following year. I was wondering how I might do
this in R. Say I have a data.frame like the following and I want to
extract a variable with the water year specs as defined above:
2009 Jul 23
1
[PATCH server] changes required for fedora rawhide inclusion.
Signed-off-by: Scott Seago <sseago at redhat.com>
---
AUTHORS | 17 ++++++
README | 10 +++
conf/ovirt-agent | 12 ++++
conf/ovirt-db-omatic | 12 ++++
conf/ovirt-host-browser | 12 ++++