If you use Rcpp::Rcpp.package.skeleton() to make a package out
of the attached C++ code you can speed up the run counting quite
a bit - to 1.4 s. from 48 s. for the 101 x 107 x 17 x 103 example.
The package you make will define an R function called CountColumnRuns
that computes the number of runs
How fast is fast enough and what size and shape is your dataset
(show the output of str(yourData))? You will get the fastest execution
time by using C or C++ or Fortran, but you will want to parameterize
the problem well enough that you can amortize the time it takes to
write the code over many pr
Thanks for your response. It is faster than before but still very slow. Any
other suggestion ?
-Deb
On Sun, Jul 10, 2016 at 2:13 PM, William Dunlap wrote:
> There is no need to test that a logical equals TRUE: 'logicalVector==TRUE'
> is the
> same as just 'logicalVector'.
>
> There is no need t
There is no need to test that a logical equals TRUE: 'logicalVector==TRUE'
is the
same as just 'logicalVector'.
There is no need to convert logical vectors to numeric, since rle() works
on both
types.
There is no need to use length(subset(x, logicalVector)) to count how many
elements
in logicalVe
Hi Everyone,
Thanks for your help. It works. I have similar problem when I am
calculating number of spell.
I am also calculation spell (definition: period of two or more days where x
exceeds 70) using similar way:
*new = apply(x,c(1,2,4),FUN=function(y) {fun.spell.deb(y, 70)})*
where fun.spell.de
On Sat, 9 Jul 2016, Debasish Pai Mazumder wrote:
I have 4-dimension array x(lat,lon,time,var)
I am using "apply" to calculate over time
new = apply(x,c(1,2,4),FUN=function(y) {length(which(y>=70))})
This is very slow. Is there anyway make it faster?
If dim(x)[3] << prod(dim(x)[-3]),
new <-
function(y) {sum(y>=70)}
--
Sent from my phone. Please excuse my brevity.
On July 9, 2016 1:19:27 PM PDT, Debasish Pai Mazumder wrote:
>I have 4-dimension array x(lat,lon,time,var)
>
>I am using "apply" to calculate over time
> new = apply(x,c(1,2,4),FUN=function(y) {length(which(y>=70))})
>
>Th
I have 4-dimension array x(lat,lon,time,var)
I am using "apply" to calculate over time
new = apply(x,c(1,2,4),FUN=function(y) {length(which(y>=70))})
This is very slow. Is there anyway make it faster?
-Debasish
[[alternative HTML version deleted]]
_
8 matches
Mail list logo