Open hrlai opened 2 years ago
Okay it just got weirder... because apply(z, 1, "mean")
works...
That sounds spooky! Let me check this out.
Hi there, I'm looking into cumsum
and encountered a similar issue to the earlier one, potentially also related to #504
Wanted to apply the cumsum
function across rows of a greta_array
, but got NAs instead... do you think these fall into the same category of things to improve?
library(greta)
#>
#> Attaching package: 'greta'
#> The following objects are masked from 'package:stats':
#>
#> binomial, cov2cor, poisson
#> The following objects are masked from 'package:base':
#>
#> %*%, apply, backsolve, beta, chol2inv, colMeans, colSums, diag,
#> eigen, forwardsolve, gamma, identity, rowMeans, rowSums, sweep,
#> tapply
x <- normal(0, 10, dim = c(4, 5))
#> ℹ Initialising python and checking dependencies, this may take a moment.
#> ✔ Initialising python and checking dependencies ... done!
#>
apply(x, 1, mean) # doesn't work
#> Error in match.arg(FUN): 'arg' must be NULL or a character vector
apply(x, 1, "mean") # works
#> greta array (operation)
#>
#> [,1]
#> [1,] ?
#> [2,] ?
#> [3,] ?
#> [4,] ?
apply(x, 2, sd) # doesn't work
#> Error in match.arg(FUN): 'arg' must be NULL or a character vector
apply(x, 2, "sd") # doesn't work too, but gives more informative error
#> Error in match.arg(FUN): 'arg' should be one of "sum", "max", "mean", "min", "prod", "cumsum", "cumprod"
apply(x, 2, cumsum) # doesn't work
#> Error in match.arg(FUN): 'arg' must be NULL or a character vector
apply(x, 2, "cumsum") # supposed to work according to error message above, but doesn't
#> greta array (operation)
#>
#> [,1] [,2] [,3] [,4] [,5]
#> [1,] NA NA NA NA NA
#> [2,] NA NA NA NA NA
#> [3,] NA NA NA NA NA
#> [4,] NA NA NA NA NA
Created on 2022-12-19 with reprex v2.0.2
Hi, I bumped into this weird problem today... hopefully there is a quick fix or I was just doing something wrong.
Working on Ubuntu and
greta_0.4.2
.