Open hrlai opened 2 years ago
Thanks for posting, @hrlai !
Confirming that I get the same result as you:
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
greta_sitrep()
#> ℹ checking if python available
#> ✓ python (version 3.7) available
#>
#> ℹ checking if TensorFlow available
#> ✓ TensorFlow (version 1.14.0) available
#>
#> ℹ checking if TensorFlow Probability available
#> ✓ TensorFlow Probability (version 0.7.0) available
#>
#> ℹ checking if greta conda environment available
#> ✓ greta conda environment available
#>
#> ℹ Initialising python and checking dependencies, this may take a moment.
#> ✓ Initialising python and checking dependencies ... done!
#>
#> ℹ greta is ready to use!
x <- normal(0, 1, dim = 10)
sd(x)
#> [1] NA
mean(x)
#> greta array (operation)
#>
#> [,1]
#> [1,] ?
var(x)
#> [,1]
#> [1,] NA
scale(x)
#> [,1]
#> [1,] ?
#> [2,] ?
#> [3,] ?
#> [4,] ?
#> [5,] ?
#> [6,] ?
#> [7,] ?
#> [8,] ?
#> [9,] ?
#> [10,] ?
#> attr(,"scaled:center")
#> [1] NaN
#> attr(,"scaled:scale")
#> [1] 0
Created on 2022-03-18 by the reprex package (v2.0.1)
I think sd
should be included, I'm not sure why it wasn't, I'll just need to check a few things first with Nick Golding, but I'll add this to the next milestone in the meantime.
Cheers!
Nick
Intriguingly, there is no defined method for sd
and var
because sd
and var
are not generic methods in R
(learnt from: https://stackoverflow.com/questions/4728342/using-sd-as-a-generic-function-in-r)
I have started implementing this in #506
Hi there, with the code below, applying
sd()
on agreta_array
does not return the same class. Just wondering if it's intentional?I'm want to generate some calculated quantities by scaling using
sd(x)
so it'd be nice if it returns agreta_array
. I could usevar(x)
orscale(x)
(both returngreta_array
) but they are clunky in their own ways...This was using
greta_0.4.1.9000
onR version 4.1.3 (2022-03-10)