search for: emorway

Displaying 20 results from an estimated 54 matches for "emorway".

2011 Jun 15
1
animation error
...uot;,ts,sep="")) ani.pause() #dev.off() } } saveMovie(plot.ani(),movie.name="concSlug.gif",img.name="ConcProfile",interval=0.15,outdir=getwd()) #Executing: #"C:/Program Files/ImageMagick-6.7.0-Q16/convert.exe" -loop 0 # -delay 15 # C:/Users/emorway/AppData/Local/Temp/2/RtmpwH5TwA/ConcProfile1.png # C:/Users/emorway/AppData/Local/Temp/2/RtmpwH5TwA/ConcProfile2.png ... # C:/Users/emorway/AppData/Local/Temp/2/RtmpwH5TwA/ConcProfile113.png # C:/Users/emorway/AppData/Local/Temp/2/RtmpwH5TwA/ConcProfile114.png # There seems to be an err...
2013 Jan 26
2
a function more appropriate than 'sapply'?
I'm wondering if I need to use a function other than sapply as the following line of code runs indefinitely (or > 30 min so far) and uses up all 16Gb of memory on my machine for what seems like a very small dataset (data attached in a txt file wells.txt <http://r.789695.n4.nabble.com/file/n4656723/wells.txt> ). The R code is:
2010 Jun 25
4
Average 2 Columns when possible, or return available value
Forum, Using the following data: DF<-read.table(textConnection("A B 22.60 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 102.00 NA 19.20 NA 19.20 NA NA NA NA NA NA NA 11.80 NA 7.62 NA NA NA NA NA NA NA NA NA NA NA 75.00 NA NA NA 18.30 18.2 NA NA NA NA 8.44 NA 18.00 NA NA NA 12.90 NA"),header=T) closeAllConnections() The second column is a duplicate
2013 Jan 23
2
setting off-diagonals to zero
The following 1460 x 1460 matrix can be throught of as 16 distinct 365 x 365 matrices. I'm trying to set off-diaganol terms in the 16 sub-matrices with indices more than +/- 5 (days) from each other to zero using some for loops. This works well for some, but not all, of the for loops. The R code I"m using follows. For some reason the third loop below zero's-out everything in the
2012 Feb 11
2
obtaining a true/false vector with combination of strsplit, length, unlist,
Hi, A pared down version of the dataset I'm working with: edm<-read.table(textConnection("WELLID X_GRID Y_GRID LAYER ROW COLUMN SPECIES CALCULATED OBSERVED w301_3 4428. 1389 2 6 18 1 3558 6490. w304_12 4836. 6627 2 27 20 1 3509 3228. 02_10_12080 3.6125E+04 13875 1 56 145 1
2017 Jun 07
0
Determining which.max() within groups
...ulian dates to you or others. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Tue, Jun 6, 2017 at 6:30 PM, Morway, Eric <emorway at usgs.gov> wrote: > 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 >...
2017 Dec 18
2
Finding center of mass in a hydrologic time series
...orcid.org/0000-0002-8553-6140> On Sat, Dec 16, 2017 at 5:32 AM, Eric Berger <ericjberger at gmail.com> wrote: > 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 the area under >&gt...
2017 Dec 18
0
Finding center of mass in a hydrologic time series
...function com <- function(x) { match(TRUE, cumsum(x/sum(x)) > 0.5) - 1 } wyrs <- unique(Daily$waterYear) x <- as.Date(sapply( wyrs, function(yr) { Df <- Daily[Daily$waterYear==yr,]; Df$Date[com(Df$Q)] } ), "1970-01-01") On Mon, Dec 18, 2017 at 4:47 PM, Morway, Eric <emorway at usgs.gov> wrote: > 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 ste...
2010 Mar 20
2
different forms of nls recommendations
Hello, Using this data: http://n4.nabble.com/file/n1676330/US_Final_Values.txt US_Final_Values.txt and the following code i got the image at the end of this message: US.final.values<-read.table("c:/tmp/US_Final_Values.txt",header=T,sep=" ") US.nls.1<-nls(US.final.values$ECe~a*US.final.values$WTD^b+c,data=US.final.values,start=list(a=2.75,b=-0.95,c=0.731),trace=TRUE)
2011 Dec 01
2
legend, "lheight", and alignment
Hello, A bit of fairly simple code, yet I don't seem to be able to manipulate it quite as much as I would like: 1) It would be nice if the objects appearing in the legend were aligned, and by aligned I mean the boxes are centered over the lines. Do I need to adjust the use of "NA" in the code below to accomplish this? Here's how it appears on my machine:
2013 Jan 25
2
resizing data
Undoubtedly this question has been asked before, I just can't seem to find the combination of search terms to produce it. I'm trying to resize a dataset that is pulled into R using read.table. However, I think the same problem can be produced using matrix: x<-matrix(1:64,8) x # [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] #[1,] 1 9 17 25 33 41 49 57 #[2,] 2 10
2010 Jun 02
3
#Rscript error on Windows 7 operating system
Forum, I've been running some parameter estimation software (UCODE which is maintained by the USGS) that has the capability of running models in parallel on a local network. Each additional processor I can incorporate into the parent-child network helps cut the overall runtime, which is currently on the order of days. When a signal is sent to a child (or slave) processor a series of
2010 Feb 08
2
object 'xxx' not found
The following line of code seems fairly straight forward, yet it is kicking back an error message: for (i in 1:length(mean.natveg.frac)){month.observed[i]=as.numeric(names(mean.natveg.frac[i]))%%12} Error message: Error in month.observed[i] = as numeric(names(mean.natveg.frac[i]))%%12 : object 'month.observed' not found Seems like its not found because I'm trying to define it. Also
2012 Jun 06
3
extracting values from txt file that follow user-supplied quote
useRs- I'm attempting to scan a more than 1Gb text file and read and store the values that follow a specific key-phrase that is repeated multiple time throughout the file. A snippet of the text file I'm trying to read is attached. The text file is a dumping ground for various aspects of the performance of the model that generates it. Thus, the location of information I'm wanting
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 13
3
inefficient for loop, is there a better way?
The code below is a small reproducible example of a much larger problem. While the script below works, it is really slow on the true dataset with many more rows and columns. I'm hoping to get the same result to examp, but with significant time savings. The example below is setting up a data.frame for an ensuing regression analysis. The purpose of the script below is to appends columns to
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 the area under > the curve in to tw...
2010 Jul 14
2
R's Data Dredging Philosophy for Distribution Fitting
Forum, I'm a grad student in Civil Eng, took some Stats classes that required students learn R, and I have since taken to R and use it for as much as I can. Back in my lab/office, many of my fellow grad students still use proprietary software at the behest of advisers who are familiar with the recommended software (Statistica, @Risk (Excel Add-on), etc). I have spent a lot of time learning
2011 Oct 05
2
subplot strange behavoir
Hello, Below is some example code that should reproduce an error I'm encountering while trying to create a tiff plot with two subplots. If I run just the following bit of code through the R GUI the result is what I'd like to have appear in the saved tiff image: x<-seq(0:20) y<-c(1,1,2,2,3,4,5,4,3,6,7,1,1,2,2,3,4,5,4,3,6) plot(x,y,type="l",las=1,ylim=c(0,12))
2011 Oct 17
1
contouring x y scatter data
Hello, I'm almost positive R can do the following, I just haven't hit upon the right package or search terms, however. Here's what I'm after: I've got concentration output from two different models that I want to qualitatively compare in a contour plot (or some variant of a contour plot). The problem as I see it is that the data is not gridded is the usual regular fashion,