numpy_percentile: Python Numpy Percentile

Description Usage Arguments Value Examples

View source: R/numpy_percentile.R

Description

Python Numpy Percentile

Usage

1
numpy_percentile(x, probs = 0.99)

Arguments

x

a numeric vector

probs

Quantile to estimate

Value

A numeric

Examples

 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)

neuroconductor/flexconn documentation built on Sept. 25, 2020, 10:51 a.m.