Re: [R] days between dates

2011-05-23 Thread armstrwa
Geoff, I think you could write an if loop to solve this. You could write: for(i in 1:num_obs){ if(DAYS[i]=='Monday'){ DF$DAYS.BETWEEN[i]<-1 } } Where 'num_obs' is the total number of temperature observations you have. This would only be correct if you had no missing data on Fridays. Also, if

Re: [R] Loop stopping after 1 iteration

2011-05-18 Thread armstrwa
Didn't mean to snub you guys, Hugo and David. I didn't see your posts before. Thanks for the advice. -- View this message in context: http://r.789695.n4.nabble.com/Loop-stopping-after-1-iteration-tp3532988p3533217.html Sent from the R help mailing list archive at Nabble.com. _

Re: [R] Loop stopping after 1 iteration

2011-05-18 Thread armstrwa
I knew it would be something simple. Thanks for catching that, Martyn. Billy -- View this message in context: http://r.789695.n4.nabble.com/Loop-stopping-after-1-iteration-tp3532988p3533041.html Sent from the R help mailing list archive at Nabble.com. __

[R] Loop stopping after 1 iteration

2011-05-18 Thread armstrwa
Hi all, This is a very basic question, but I just can't figure out why R is handling a loop I'm writing the way it is. Here is the script I have written: grid_2_series<-function(gage_handle,data_type,filename) series_name<-paste(gage_handle,data_type,sep="_") data_grid<-read.table(file=paste(fi

Re: [R] Paste problem when looping variable assignments

2011-04-22 Thread armstrwa
One thing I should have mentioned before is that "pds_gagehandles" is a character vector that contains the site names that I am interested in. An example of a site name is "saho". So with with the paste function, I am trying to get R to assign a variable with the site name followed by "_potwy".

[R] Paste problem when looping variable assignments

2011-04-22 Thread armstrwa
Hi all, I am attempting to run through a large set of data and sort events by the water year (1 Oct - 30 Sep) in which they occurred. I have no problem doing this for each individual site I am looking at (so my problem is not with most of the code, just one minor thing), but when I try to loop

[R] Acessing Test Outputs for Writing to a Table

2011-03-28 Thread armstrwa
Hi all, I am trying to write a script that will compute Kendall's tau for a 75 time series (using the Kendall package) and will then write the tau and p values from the Kendall test to a text file table that can be read into Excel. I am having no problem calculating Kendall's tau and the associat

Re: [R] Magic Number Error Message

2011-03-25 Thread armstrwa
#x27; and on and on.. Does anyone know what might be causing this error?  Or is there a way for me to see what line in the code results in an error? Thanks again. Billy Philipp Pagel-5 [via R] wrote: On Fri, Mar 25, 2011 at 06:42:49AM -0700, armstrwa wrote: > When I atte

[R] Magic Number Error Message

2011-03-25 Thread armstrwa
Hi all, When I attempt to run a script, I keep getting the error message shown below. I have seen from searching that the "Use of save versions prior to 2 is deprecated" could be an error resulting from a permissions problem, but I have been unable to find anything describing the "file has magnic

Re: [R] Basic Looping Trouble

2011-03-22 Thread armstrwa
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> Thanks, Petr.  Your insight has helped me out a lot. Billy Petr Savicky-2 [via R] wrote: On Mon, Mar 21, 2011 at 02:28:32PM -0700, armstrwa wrote: > Hi all, > > Forgive me for this basic q

Re: [R] Kendall v MannKendall Functions

2011-03-22 Thread armstrwa
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> Thank you very much, Peter.  That does make it clearer. Billy Peter Ehlers [via R] wrote: On 2011-03-21 14:16, armstrwa wrote: > Hi, > > I am running a correlation analysis on a temporal

[R] Looping Problem

2011-03-22 Thread armstrwa
Hi all, I am trying to write a script that will automate the task of running a Kendall's Tau correlation test on 75 time series that I am interested in. The code I have written is: for(i in 1:length(gagehandles)){ dates<-get(paste(gagehandles[i],"_amsd",sep="")) q<-get(paste(gagehandles[i],"_a

[R] Basic Looping Trouble

2011-03-21 Thread armstrwa
Hi all, Forgive me for this basic question. I've been doing some research and haven't been able to figure out how to best do this yet. I have 75 variables defined as vector time series. I am trying to create a script to automate calculations on each of these variables, but I wasn't sure how to

[R] Kendall v MannKendall Functions

2011-03-21 Thread armstrwa
Hi, I am running a correlation analysis on a temporal dataset. I was wondering if you would receive the same tau and p values running the function: MannKendall(x), where x is the dependant variable that changes with time as you would running: Kendall(d,x), where x is the exact same dataset a

Re: [R] Difficulty with 'loess' function

2011-03-18 Thread armstrwa
r formula, you've got them backwards from what you've said you're trying to model. armstrwa wrote: Yeah, I did look at the help(loess) page, but I wasn't really sure what to do with that.  I was inputting it as: > test<-loess(date ~ q,data.frame(

Re: [R] Difficulty with 'loess' function

2011-03-18 Thread armstrwa
Yeah, I did look at the help(loess) page, but I wasn't really sure what to do with that. I was inputting it as: > test<-loess(date ~ q,data.frame(date,q),span=0.5) > test Call: loess(formula = date ~ q, data = data.frame(date, q), span = 0.5) Number of Observations: 96 Equivalent Number of Para

[R] Difficulty with 'loess' function

2011-03-18 Thread armstrwa
Hi, I am trying to create a loess smooth from hydrologic data. My goal is to create a smooth line that describes discharge at a certain point in time. I have done this using the 'lowess' function and had no problem, but I'm having some difficulty with loess. I am inputting the date ('date') and