Description Usage Arguments Value Examples
View source: R/numpy_percentile.R
Python Numpy Percentile
1 | numpy_percentile(x, probs = 0.99)
|
x |
a numeric vector |
probs |
Quantile to estimate |
A numeric
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | set.seed(11)
n = 45
x =rnorm(n)
x = sort(x)
q = numpy_percentile(x)
user = Sys.getenv("USER")
if (user %in% c("johnmuschelli", "travis") &
Sys.info()["sysname"] == "Darwin"){
reticulate::use_python(paste0(
"/Library/Frameworks/Python.framework/Versions/3.5/bin/python3"))
} else {
python = system("which python", intern = TRUE)
print(python)
reticulate::use_python(python)
}
np = reticulate::import("numpy")
q2 = np$percentile(x, 99L)
q2
q2 - q
quant = quantile(x, probs = 0.99)
q2 - quant
np$percentile(sort(as.double(x)), 99L)
np$percentile(sort(x), 99L)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.