Re: [R] Is there a funct to sum differences?

2016-12-25 Thread arthur brogard via R-help
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 Sun, Dec 25, 2016 at 1:34 PM, arthur brogard via R-help wrote: > Hi, > > thanks for this. > > > quote &

Re: [R] Is there a funct to sum differences?

2016-12-25 Thread arthur brogard via R-help
s(diffs) > [1] 85 115 145 175 205 235 265 295 325 355 385 415 445 475 505 535 565 > 595 625 655 450 278 143 49 > [25] 0 > -- snip > > The script could very simply be converted into a function if this is a > repetitive task with variable inputs. > > I

Re: [R] Is there a funct to sum differences?

2016-12-24 Thread arthur brogard via R-help
ted into a function if this is a repetitive task with variable inputs. I hope this helps, John - John Fox, Professor McMaster University Hamilton, Ontario Canada L8S 4M4 Web: socserv.mcmaster.ca/jfox > -Original Message----- > From: R-help [mailto:r-help-bo

Re: [R] Is there a funct to sum differences?

2016-12-24 Thread arthur brogard via R-help
[22,] 45 92 14100 > [23,] 47 96000 > [24,] 490000 > [25,]00000 >> rowSums(diffs) > [1] 85 115 145 175 205 235 265 295 325 355 385 415 445 475 505 535 565 595 > 625 655 450 278 143 49 > [25] 0 > -- sn

Re: [R] Is there a funct to sum differences?

2016-12-23 Thread arthur brogard via R-help
", tz="UTC") > > > rates$thisone <- c(diff(rates$Int), NA) > rates$nextone <- c(diff(rates$Int, lag=2), NA, NA) > rates$lastone <- (rates$thisone + rates$nextone)/6.5*1000 > > > rates > > > > ab > > > > - Original Mess

[R] Is there a funct to sum differences?

2016-12-23 Thread arthur brogard via R-help
I've been looking but I can't find a function to sum difference. I have this code: rates$thisone <- c(diff(rates$Int), NA) rates$nextone <- c(diff(rates$Int, lag=2), NA, NA) rates$lastone <- (rates$thisone + rates$nextone) It is looking down one long column of numbers. It sums the difference

Re: [R] Why Does R Print out strange record?

2016-12-20 Thread arthur brogard via R-help
ime problems. > > rates$Date <- strptime(paste0("1-", rates$Date), format="%d-%b-%Y", > tz="UTC") > ## you will need to read > ## ?as.POSIXct > ## ?strptime > > ## the rest of your calculations can be done more easily with > vectorized arit

[R] Why Does R Print out strange record?

2016-12-19 Thread arthur brogard via R-help
I have this bit of code: rates=read.csv("Rates2.csv") attach(rates) mysize <- nrow(rates) count <- 0 for(i in 1:(mysize - 3)) { #print(i) thisday <- Date[i] thisone <- Int[i+1] - Int[i] nextone <- Int[i+2] - Int[i] lastone <- thisone + nextone lastone <- lastone/6.5 lastone <- lastone * 1000 #prin