[R] efficient sine interpolation

2014-05-12 Thread Ortiz-Bobea, Ariel
Hello, I'm trying to fit a sine curve over successive temperature readings (i.e. minimum and maximum temperature) over several days and for many locations. The code below shows a hypothetical example of 5000 locations with 7 days of temperature data. Not very efficient when you have many more

Re: [R] speeding up applying hist() over rows of a matrix

2014-05-02 Thread Ortiz-Bobea, Ariel
This works great, thanks a lot! -AOB -Original Message- From: William Dunlap [mailto:wdun...@tibco.com] Sent: Friday, May 02, 2014 12:31 PM To: Ortiz-Bobea, Ariel Cc: r-help@r-project.org Subject: Re: [R] speeding up applying hist() over rows of a matrix And since as.integer(cut(x,bins

[R] speeding up applying hist() over rows of a matrix

2014-05-01 Thread Ortiz-Bobea, Ariel
Hello everyone, I'm trying to construct bins for each row in a matrix. I'm using apply() in combination with hist() to do this. Performing this binning for a 10K-by-50 matrix takes about 5 seconds, but only 0.5 seconds for a 1K-by-500 matrix. This suggests the bottleneck is accessing rows in