Passing additional arguments using Apply (pbdDMAT)

23 views
Skip to first unread message

Nicholas Cavanaugh

unread,
Nov 25, 2014, 12:06:53 PM11/25/14
to rbigdatap...@googlegroups.com
Using the ddmatrix apply function offered in pbdDMAT, I am running into difficulty passing an additional parameter to the function used in apply. In the case below, "dat" is a local matrix and "distributed.dat" is it's distributed version. Variable "t" offers temporal information and is, in this case, not distributed, as it corresponds to each row of dat/distributed.dat. 

It appears that the additional variable "t" is not being passed along with the variable to be operated on when in distributed mode. A code snippet is below. Any help would be appreciated!

----
> clim.mat <- apply(X=dat,MARGIN=1,FUN=calc.tsday.clim,t=t,nharm=nharm)
> clim.mat <- apply(X=distributed.dat,MARGIN=1,FUN=calc.tsday.clim,t=t,nharm=nharm)
 Hide Traceback
 
 Rerun with Debug
 Error in which(t$day == clim$t$day[i] & t$month == clim$t$month[i]) : 
  argument "t" is missing, with no default 
7 which(t$day == clim$t$day[i] & t$month == clim$t$month[i]) 
6 FUN(newX[, i], ...) 
5 apply(X@Data, MARGIN = 1, FUN = FUN) 
4 apply(X@Data, MARGIN = 1, FUN = FUN) 
3 .local(X, MARGIN, FUN, ...) 
2 apply(X = distributed.dat, MARGIN = 1, FUN = calc.tsday.clim, 
    t = t, nharm = nharm) 
1 apply(X = distributed.dat, MARGIN = 1, FUN = calc.tsday.clim, 
    t = t, nharm = nharm) 
----

Drew Schmidt

unread,
Nov 26, 2014, 9:12:07 AM11/26/14
to rbigdatap...@googlegroups.com
Hi Nicholas,

Thanks for the report.  There was a bug in the apply() code which has been fixed here:  https://github.com/wrathematics/pbdDMAT

-Drew
Reply all
Reply to author
Forward
0 new messages