datar.apis.base
datar.apis.base
APIs ported from r-base
abs_
(
x
)
(Any) — Compute the absolute value of a vector</>acos
(
x
)
(Any) — Get the inverse cosine</>acosh
(
x
)
(Any) — Get the inverse hyperbolic cosine</>all_
(
x
,na_rm
)
(Any) — Are all elements true</>any_
(
x
,na_rm
)
(Any) — Is any element true</>any_na
(
x
)
(Any) — Check if anything inx
is NA</>append
(
x
,values
,after
)
(Any) — Append values to the vector</>arg
(
x
)
(Any) — Angles of complex numbers</>as_character
(
x
)
(Any) — Convert a vector to a character vector</>as_complex
(
x
)
(Any) — Convert a vector to a complex vector</>as_date
(
x
,format
,try_formats
,optional
,tz
,origin
)
(Any) — Convert an object to a datetime.date object</>as_double
(
x
)
(Any) — Convert a vector to a double vector</>as_factor
(
x
)
(Any) — Convert a vector to a factor vector</>as_integer
(
x
)
(Any) — Convert a vector to an integer vector</>as_logical
(
x
)
(Any) — Convert a vector to a logical vector</>as_null
(
x
)
(Any) — Convert anything to NULL</>as_numeric
(
x
)
(Any) — Convert a vector to a numeric vector</>as_ordered
(
x
)
(Any) — Convert a vector to an ordered vector</>asin
(
x
)
(Any) — Get the inverse sine</>asinh
(
x
)
(Any) — Get the inverse hyperbolic sine</>atan
(
x
)
(Any) — Get the inverse tangent</>atan2
(
y
,x
)
(Any) — Get the inverse tangent of y/x</>atanh
(
x
)
(Any) — Get the inverse hyperbolic tangent</>bessel_i
(
x
,nu
,expon_scaled
)
(Any) — Compute the modified Bessel function of the first kind</>bessel_j
(
x
,nu
)
(Any) — Compute the Bessel function of the first kind</>bessel_k
(
x
,nu
,expon_scaled
)
(Any) — Compute the modified Bessel function of the second kind</>bessel_y
(
x
,nu
)
(Any) — Compute the Bessel function of the second kind</>beta
(
x
,y
)
(Any) — Compute the beta function</>c_
(
*args
)
(Any) — Concatenate vectors</>ceiling
(
x
)
(Any) — Round up to the nearest integer</>chartr
(
old
,new
,x
)
(Any) — Translate characters</>choose
(
n
,k
)
(Any) — Compute the binomial coefficient</>col_means
(
x
,na_rm
)
(Any) — Compute the column means of a matrix</>col_medians
(
x
,na_rm
)
(Any) — Compute the column medians of a matrix</>col_sds
(
x
,na_rm
)
(Any) — Compute the column standard deviations of a matrix</>col_sums
(
x
,na_rm
)
(Any) — Compute the column sums of a matrix</>colnames
(
x
,nested
)
(Any) — Get the column names</>complete_cases
(
x
)
(Any) — Get the complete cases</>conj
(
x
)
(Any) — Complex conjugate</>cos
(
x
)
(Any) — Get the cosine</>cosh
(
x
)
(Any) — Get the hyperbolic cosine</>cospi
(
x
)
(Any) — Get the cosine of pi times x</>cov
(
x
,y
,na_rm
,ddof
)
(Any) — Compute pairwise covariance between two variables</>cummax
(
x
)
(Any) — Cumulative maxima</>cummin
(
x
)
(Any) — Cumulative minima</>cumprod
(
x
)
(Any) — Cumulative products</>cumsum
(
x
)
(Any) — Cumulative sums</>cut
(
x
,breaks
,labels
,include_lowest
,right
,dig_lab
,ordered_result
)
(Any) — Cut a numeric vector into bins</>diag
(
x
,nrow
,ncol
)
(Any) — Get the diagonal of a matrix</>diff
(
x
,lag
,differences
)
(An array of `x[lag) — Difference of a numeric vector</>digamma
(
x
)
(Any) — Compute the digamma function</>dim
(
x
,nested
)
(Any) — Get the dimensions</>droplevels
(
x
)
(Any) — Drop unused levels of a factor</>duplicated
(
x
,incomparables
,from_last
)
(Any) — Get the duplicated values</>endswith
(
x
,suffix
)
(Any) — Does x end with suffix</>exp
(
x
)
(Any) — Compute the exponential of a vector</>expand_grid
(
x
,*args
,**kwargs
)
(Any) — Expand a grid</>factor
(
x
,levels
,labels
,exclude
,ordered
,nmax
)
(Any) — Create a factor vector</>factorial
(
x
)
(Any) — Compute the factorial</>floor
(
x
)
(Any) — Round down to the nearest integer</>gamma
(
x
)
(Any) — Compute the gamma function</>grep
(
pattern
,x
,ignore_case
,value
,fixed
,invert
)
(Any) — Grep for a pattern</>grepl
(
pattern
,x
,ignore_case
,fixed
)
(Any) — Grep for a pattern</>gsub
(
pattern
,replacement
,x
,ignore_case
,fixed
)
(Any) — Substitute a pattern</>head
(
x
,n
)
(Any) — Get the first n rows</>identity
(
x
)
(Any) — Identity function</>im
(
x
)
(Any) — Imaginary part of complex numbers</>intersect
(
x
,y
)
(Any) — Get the intersection of two vectors</>is_atomic
(
x
)
(Any) — Is the object atomic</>is_character
(
x
)
(Any) — Is x a character vector</>is_complex
(
x
)
(Any) — Check if a vector is complex</>is_double
(
x
)
(Any) — Is the object a double</>is_element
(
x
,y
)
(Any) — Is the object an element of the table</>is_factor
(
x
)
(Any) — Check if a vector is a factor</>is_false
(
x
)
(bool) — Check if anything is false</>is_finite
(
x
)
(Any) — Check if anything is finite</>is_infinite
(
x
)
(Any) — Check if anything is infinite</>is_integer
(
x
)
(Any) — Is the object an integer</>is_logical
(
x
)
(Any) — Check if a vector is logical</>is_na
(
x
)
(Any) — Check if anything is NA</>is_null
(
x
)
(Any) — Check if anything is NULL</>is_numeric
(
x
)
(Any) — Is the object numeric</>is_ordered
(
x
)
(Any) — Check if a vector is ordered</>is_true
(
x
)
(bool) — Check if anything is true</>lbeta
(
x
,y
)
(Any) — Compute the log beta function</>lchoose
(
n
,k
)
(Any) — Compute the log binomial coefficient</>length
(
x
)
(Any) — Get the length of a vector</>lengths
(
x
)
(Any) — Get the lengths of a list</>levels
(
x
)
(Any) — Get the levels of a factor</>lfactorial
(
x
)
(Any) — Compute the log factorial</>lgamma
(
x
)
(Any) — Compute the log gamma function</>log
(
x
,base
)
(Any) — Compute the logarithm of a vector</>log10
(
x
)
(Any) — Compute the base 10 logarithm of a vector</>log1p
(
x
)
(Any) — Compute the logarithm of one plus a vector</>log2
(
x
)
(Any) — Compute the base-2 logarithm of a vector</>make_names
(
names
,unique
)
(Any) — Make names for a vector</>make_unique
(
names
)
(Any) — Make a vector unique</>match
(
x
,table
,nomatch
)
(Any) — Match elements of a vector</>max_
(
x
,na_rm
)
(Any) — Compute the maximum of a vector</>max_col
(
x
,ties_method
,nested
)
(Any) — Get the maximum column</>mean
(
x
,na_rm
)
(Any) — Compute the mean of a vector</>median
(
x
,na_rm
)
(Any) — Compute the median of a vector</>min_
(
x
,na_rm
)
(Any) — Compute the minimum of a vector</>mod
(
x
)
(Any) — Modulus of complex numbers</>nchar
(
x
,type_
,allow_na
,keep_na
,_na_len
)
(Any) — Get the number of characters in a string</>ncol
(
x
,nested
)
(Any) — Get the number of columns</>nlevels
(
x
)
(Any) — Get the number of levels of a factor</>nrow
(
x
)
(Any) — Get the number of rows</>nzchar
(
x
,keep_na
)
(Any) — Is the string non-zero length</>order
(
x
,decreasing
,na_last
)
(Any) — Order a vector</>ordered
(
x
,levels
,labels
,exclude
,nmax
)
(Any) — Create an ordered factor vector</>outer
(
x
,y
,fun
)
(Any) — Outer product of two vectors</>paste
(
*args
,sep
,collapse
)
(Any) — Join a vector into a string</>paste0
(
*args
,collapse
)
(Any) — Join a vector into a string</>pmax
(
*args
,na_rm
)
(Any) — Returns the (regular or Parallel) maxima and minima of the input values. </>pmin
(
*args
,na_rm
)
(Any) — Returns the (regular or Parallel) maxima and minima of the input values. </>prod
(
x
,na_rm
)
(Any) — Compute the product of a vector</>proportions
(
x
,margin
)
(Any) — Get the proportion table</>psigamma
(
x
,deriv
)
(Any) — Compute the psi function</>quantile
(
x
,probs
,na_rm
,names
,type_
,digits
)
(Any) — Compute the quantiles of a vector</>rank
(
x
,na_last
,ties_method
)
(Any) — Rank a numeric vector</>rbinom
(
n
,size
,prob
)
(Any) — Generate random binomial variables</>rcauchy
(
n
,location
,scale
)
(Any) — Generate random Cauchy variables</>rchisq
(
n
,df
)
(Any) — Generate random chi-squared variables</>re_
(
x
)
(Any) — Real part of complex numbers</>rep
(
x
,times
,length
,each
)
(Any) — Replicate elements of a vector</>rev
(
x
)
(Any) — Reverse a vector</>rexp
(
n
,rate
)
(Any) — Generate random exponential variables</>rnorm
(
n
,mean
,sd
)
(Any) — Generate random normal variables</>round_
(
x
,digits
)
(Any) — Round the values of a vector</>row_means
(
x
,na_rm
)
(Any) — Compute the row means of a matrix</>row_medians
(
x
,na_rm
)
(Any) — Compute the row medians of a matrix</>row_sds
(
x
,na_rm
)
(Any) — Compute the row standard deviations of a matrix</>row_sums
(
x
,na_rm
)
(Any) — Compute the row sums of a matrix</>rownames
(
x
)
(Any) — Get the row names</>rpois
(
n
,lambda_
)
(Any) — Generate random Poisson variables</>runif
(
n
,min
,max
)
(Any) — Generate random uniform variables</>sample
(
x
,size
,replace
,prob
)
(Any) — Sample a vector</>scale
(
x
,center
,scale_
)
(Any) — Center and/or scale the data</>sd
(
x
,na_rm
)
(Any) — Compute the standard deviation of a vector</>seq
(
from_
,to
,by
,length_out
,along_with
)
(Any) — Generate a sequence</>seq_along
(
x
)
(Any) — Generate a sequence along a vector</>seq_len
(
x
)
(Any) — Generate a sequence of length x</>set_colnames
(
x
,names
,nested
)
(Any) — Set the column names</>set_levels
(
x
,levels
)
(Any) — Set the levels of a factor</>set_rownames
(
x
,names
)
(Any) — Set the row names</>set_seed
(
seed
)
(Any) — Set the seed of the random number generator</>setdiff
(
x
,y
)
(Any) — Get the difference of two vectors</>setequal
(
x
,y
)
(Any) — Check if two vectors are equal</>sign
(
x
)
(Any) — Compute the sign of a vector</>signif
(
x
,digits
)
(Any) — Round the values of a vector to a given number of significant digits</>sin
(
x
)
(Any) — Get the sine</>sinh
(
x
)
(Any) — Get the hyperbolic sine</>sinpi
(
x
)
(Any) — Get the sine of pi times x</>sort
(
x
,decreasing
,na_last
)
(Any) — Sort a vector</>sprintf
(
fmt
,*args
)
(Any) — Format a string</>sqrt
(
x
)
(Any) — Compute the square root of a vector</>startswith
(
x
,prefix
)
(Any) — Does x start with prefix</>strsplit
(
x
,split
,fixed
,perl
,use_bytes
)
(Any) — Split a string</>strtoi
(
x
,base
)
(Any) — Convert a string to an integer</>sub
(
pattern
,replacement
,x
,ignore_case
,fixed
)
(Any) — Substitute a pattern</>substr
(
x
,start
,stop
)
(Any) — Get a substring</>substring
(
x
,first
,last
)
(Any) — Get a substring</>sum_
(
x
,na_rm
)
(Any) — Compute the sum of a vector</>t
(
x
)
(Any) — Get the transpose</>table
(
x
,*more
,exclude
,use_na
,dnn
,deparse_level
)
(Any) — Get the table of a vector</>tabulate
(
bin
,nbins
)
(Any) — Get the table of a vector</>tail
(
x
,n
)
(Any) — Get the last n rows</>tan
(
x
)
(Any) — Get the tangent</>tanh
(
x
)
(Any) — Get the hyperbolic tangent</>tanpi
(
x
)
(Any) — Get the tangent of pi times x</>tolower
(
x
)
(Any) — Convert a string to lower case</>toupper
(
x
)
(Any) — Convert a string to upper case</>trigamma
(
x
)
(Any) — Compute the trigamma function</>trimws
(
x
,which
,whitespace
)
(Any) — Trim whitespace from a string</>trunc
(
x
)
(Any) — Truncate the values of a vector</>union
(
x
,y
)
(Any) — Get the union of two vectors</>unique
(
x
)
(Any) — Get the unique values</>var
(
x
,na_rm
,ddof
)
(Any) — Compute the variance of a vector</>weighted_mean
(
x
,w
,na_rm
)
(Any) — Compute the weighted mean of a vector</>which
(
x
)
(Any) — Get the indices of the non-zero values</>which_max
(
x
)
(Any) — Get the index of the maximum value</>which_min
(
x
)
(Any) — Get the index of the minimum value</>
datar.apis.base.
ceiling
(
x
)
Round up to the nearest integer
x
— The value to be rounded up
The rounded up value
datar.apis.base.
cov
(
x
, y=None
, na_rm=False
, ddof=1
)
Compute pairwise covariance between two variables
x
— a numeric vector, matrix or data frame.y
(optional) — None or a vector, matrix or data frame withcompatible dimensions tox
. The default is equivalent toy = x
na_rm
(bool, optional) — IfTrue
, remove missing values before computingthe covariance.ddof
(int, optional) — The denominator degrees of freedom.
The covariance matrix
datar.apis.base.
floor
(
x
)
Round down to the nearest integer
x
— The value to be rounded down
The rounded down value
datar.apis.base.
mean
(
x
, na_rm=False
)
Compute the mean of a vector
x
— A numeric vectorna_rm
(bool, optional) — Whether to removeNA
values
The mean of the vector
datar.apis.base.
median
(
x
, na_rm=False
)
Compute the median of a vector
x
— A numeric vectorna_rm
(bool, optional) — Whether to removeNA
values
The median of the vector
datar.apis.base.
pmax
(
*args
, na_rm=False
)
Returns the (regular or Parallel) maxima and minima of the input values.
na_rm
(bool, optional) — Whether to removeNA
valuesx
— A numeric vectormore
— One or more values
The maximum of the vector and the values
datar.apis.base.
pmin
(
*args
, na_rm=False
)
Returns the (regular or Parallel) maxima and minima of the input values.
na_rm
(bool, optional) — Whether to removeNA
valuesx
— A numeric vectormore
— One or more values
The minimum of the vector and the values
datar.apis.base.
sqrt
(
x
)
Compute the square root of a vector
x
— A numeric vector
The square root of the vector
datar.apis.base.
var
(
x
, na_rm=False
, ddof=1
)
Compute the variance of a vector
x
— A numeric vectorna_rm
(bool, optional) — Whether to removeNA
valuesddof
(int, optional) — The degrees of freedomy
— None or a vector, matrix or data frame withcompatible dimensions tox
. The default is equivalent toy = x
The variance of the vector
datar.apis.base.
scale
(
x
, center=True
, scale_=True
)
Center and/or scale the data
x
— A numeric vectorcenter
(optional) — Whether to center the datascale_
(optional) — Whether to scale the data
The scaled data
datar.apis.base.
col_sums
(
x
, na_rm=False
)
Compute the column sums of a matrix
x
— A numeric matrixna_rm
(bool, optional) — Whether to removeNA
values
The column sums of the matrix
datar.apis.base.
col_means
(
x
, na_rm=False
)
Compute the column means of a matrix
x
— A numeric matrixna_rm
(bool, optional) — Whether to removeNA
values
The column means of the matrix
datar.apis.base.
col_sds
(
x
, na_rm=False
)
Compute the column standard deviations of a matrix
x
— A numeric matrixna_rm
(bool, optional) — Whether to removeNA
values
The column standard deviations of the matrix
datar.apis.base.
col_medians
(
x
, na_rm=False
)
Compute the column medians of a matrix
x
— A numeric matrixna_rm
(bool, optional) — Whether to removeNA
values
The column medians of the matrix
datar.apis.base.
row_sums
(
x
, na_rm=False
)
Compute the row sums of a matrix
x
— A numeric matrixna_rm
(bool, optional) — Whether to removeNA
values
The row sums of the matrix
datar.apis.base.
row_means
(
x
, na_rm=False
)
Compute the row means of a matrix
x
— A numeric matrixna_rm
(bool, optional) — Whether to removeNA
values
The row means of the matrix
datar.apis.base.
row_sds
(
x
, na_rm=False
)
Compute the row standard deviations of a matrix
x
— A numeric matrixna_rm
(bool, optional) — Whether to removeNA
values
The row standard deviations of the matrix
datar.apis.base.
row_medians
(
x
, na_rm=False
)
Compute the row medians of a matrix
x
— A numeric matrixna_rm
(bool, optional) — Whether to removeNA
values
The row medians of the matrix
datar.apis.base.
min_
(
x
, na_rm=False
)
Compute the minimum of a vector
x
— A numeric vectorna_rm
(bool, optional) — Whether to removeNA
values
The minimum of the vector
datar.apis.base.
max_
(
x
, na_rm=False
)
Compute the maximum of a vector
x
— A numeric vectorna_rm
(bool, optional) — Whether to removeNA
values
The maximum of the vector
datar.apis.base.
round_
(
x
, digits=0
)
Round the values of a vector
x
— A numeric vectordigits
(int, optional) — The number of digits to round to
The rounded values
datar.apis.base.
sum_
(
x
, na_rm=False
)
Compute the sum of a vector
x
— A numeric vectorna_rm
(bool, optional) — Whether to removeNA
values
The sum of the vector
datar.apis.base.
abs_
(
x
)
Compute the absolute value of a vector
x
— A numeric vector
The absolute values of the vector
datar.apis.base.
prod
(
x
, na_rm=False
)
Compute the product of a vector
x
— A numeric vectorna_rm
(bool, optional) — Whether to removeNA
values
The product of the vector
datar.apis.base.
sign
(
x
)
Compute the sign of a vector
x
— A numeric vector
The signs of the vector
datar.apis.base.
signif
(
x
, digits=6
)
Round the values of a vector to a given number of significant digits
x
— A numeric vectordigits
(int, optional) — The number of significant digits to round to
The rounded values
datar.apis.base.
trunc
(
x
)
Truncate the values of a vector
x
— A numeric vector
The truncated values
datar.apis.base.
exp
(
x
)
Compute the exponential of a vector
x
— A numeric vector
The exponential values
datar.apis.base.
log
(
x
, base=2.718281828459045
)
Compute the logarithm of a vector
x
— A numeric vectorbase
(float, optional) — The base of the logarithm
The logarithm values
datar.apis.base.
log2
(
x
)
Compute the base-2 logarithm of a vector
x
— A numeric vector
The logarithm values
datar.apis.base.
log10
(
x
)
Compute the base 10 logarithm of a vector
x
— A numeric vector
The logarithm values
datar.apis.base.
log1p
(
x
)
Compute the logarithm of one plus a vector
x
— A numeric vector
The logarithm values
datar.apis.base.
sd
(
x
, na_rm=False
)
Compute the standard deviation of a vector
x
— A numeric vectorna_rm
(bool, optional) — Whether to removeNA
values
The standard deviation of the vector
datar.apis.base.
weighted_mean
(
x
, w=None
, na_rm=False
)
Compute the weighted mean of a vector
x
— A numeric vectorw
(optional) — The weights to usena_rm
(bool, optional) — Whether to removeNA
values
The weighted mean of the vector
datar.apis.base.
quantile
(
x
, probs=(0.0, 0.25, 0.5, 0.75, 1.0)
, na_rm=False
, names=True
, type_=7
, digits=7
)
Compute the quantiles of a vector
x
— A numeric vectorprobs
(optional) — The probabilities to use
The quantiles of the vector
datar.apis.base.
bessel_i
(
x
, nu
, expon_scaled=False
)
Compute the modified Bessel function of the first kind
x
— A numeric vectornu
— The order of the Bessel functionexpon_scaled
(bool, optional) — Whether to use the scaled version
The Bessel function values
datar.apis.base.
bessel_j
(
x
, nu
)
Compute the Bessel function of the first kind
x
— A numeric vectornu
— The order of the Bessel function
The Bessel function values
datar.apis.base.
bessel_k
(
x
, nu
, expon_scaled=False
)
Compute the modified Bessel function of the second kind
x
— A numeric vectornu
— The order of the Bessel functionexpon_scaled
(bool, optional) — Whether to use the scaled version
The Bessel function values
datar.apis.base.
bessel_y
(
x
, nu
)
Compute the Bessel function of the second kind
x
— A numeric vectornu
— The order of the Bessel function
The Bessel function values
datar.apis.base.
as_double
(
x
)
Convert a vector to a double vector
x
— A numeric vector
The double vector
datar.apis.base.
as_integer
(
x
)
Convert a vector to an integer vector
x
— A numeric vector
The integer vector
datar.apis.base.
as_logical
(
x
)
Convert a vector to a logical vector
x
— A numeric vector
The logical vector
datar.apis.base.
as_character
(
x
)
Convert a vector to a character vector
x
— A numeric vector
The character vector
datar.apis.base.
as_factor
(
x
)
Convert a vector to a factor vector
x
— A numeric vector
The factor vector
datar.apis.base.
as_ordered
(
x
)
Convert a vector to an ordered vector
x
— A numeric vector
The ordered vector
datar.apis.base.
as_date
(
x
, format=None
, try_formats=None
, optional=False
, tz=0
, origin=None
)
Convert an object to a datetime.date object
See: https://rdrr.io/r/base/as.Date.html
x
— Object that can be converted into a datetime.date objectformat
(optional) — If not specified, it will try try_formats one by one onthe first non-np.nan element, and give an error if none works. Otherwise, the processing is via strptimetry_formats
(optional) — vector of format strings to try if format is not specified.Default formats to try: "%Y-%m-%d" "%Y/%m/%d" "%Y-%m-%d %H:%M:%S" "%Y/%m/%d %H:%M:%S"optional
(optional) — indicating to return np.nan (instead of signalling an error)if the format guessing does not succeed.tz
(optional) — a time zone offset or a datetime.timedelta object.Note that time zone name is not supported yet.origin
(optional) — a datetime.date/datetime object, or something which can becoerced by as_date(origin, ...) to such an object.
The datetime.date object
datar.apis.base.
as_numeric
(
x
)
Convert a vector to a numeric vector
x
— A numeric vector
The numeric vector
datar.apis.base.
arg
(
x
)
Angles of complex numbers
x
— A numeric vector
The angles
datar.apis.base.
conj
(
x
)
Complex conjugate
x
— A numeric vector
The complex conjugates
datar.apis.base.
mod
(
x
)
Modulus of complex numbers
x
— A numeric vector
The modulus
datar.apis.base.
re_
(
x
)
Real part of complex numbers
x
— A numeric vector
The real parts
datar.apis.base.
im
(
x
)
Imaginary part of complex numbers
x
— A numeric vector
The imaginary parts
datar.apis.base.
as_complex
(
x
)
Convert a vector to a complex vector
x
— A numeric vector
The complex vector
datar.apis.base.
is_complex
(
x
)
Check if a vector is complex
x
— A numeric vector
Whether the vector is complex
datar.apis.base.
cummax
(
x
)
Cumulative maxima
x
— A numeric vector
The cumulative maxima
datar.apis.base.
cummin
(
x
)
Cumulative minima
x
— A numeric vector
The cumulative minima
datar.apis.base.
cumprod
(
x
)
Cumulative products
x
— A numeric vector
The cumulative products
datar.apis.base.
cumsum
(
x
)
Cumulative sums
x
— A numeric vector
The cumulative sums
datar.apis.base.
droplevels
(
x
)
Drop unused levels of a factor
x
— A numeric vector
The factor vector
datar.apis.base.
levels
(
x
)
Get the levels of a factor
x
— A numeric vector
The factor vector
datar.apis.base.
set_levels
(
x
, levels
)
Set the levels of a factor
x
— A numeric vectorlevels
— The new levels
The factor vector
datar.apis.base.
is_factor
(
x
)
Check if a vector is a factor
x
— A numeric vector
Whether the vector is a factor
datar.apis.base.
is_ordered
(
x
)
Check if a vector is ordered
x
— A numeric vector
Whether the vector is ordered
datar.apis.base.
nlevels
(
x
)
Get the number of levels of a factor
x
— A numeric vector
The number of levels
datar.apis.base.
factor
(
x=None
, levels=None
, labels=None
, exclude=None
, ordered=False
, nmax=None
)
Create a factor vector
x
(optional) — A numeric vectorlevels
(optional) — The levelslabels
(optional) — The labelsexclude
(optional) — The excluded levelsordered
(optional) — Whether the factor is orderednmax
(optional) — The maximum number of levels
The factor vector
datar.apis.base.
ordered
(
x
, levels=None
, labels=None
, exclude=None
, nmax=None
)
Create an ordered factor vector
x
— A numeric vectorlevels
(optional) — The levelslabels
(optional) — The labelsexclude
(optional) — The excluded levelsnmax
(optional) — The maximum number of levels
The ordered factor vector
datar.apis.base.
cut
(
x
, breaks
, labels=None
, include_lowest=False
, right=True
, dig_lab=3
, ordered_result=False
)
Cut a numeric vector into bins
x
— A numeric vectorbreaks
— The breakslabels
(optional) — The labelsinclude_lowest
(optional) — Whether to include the lowest valueright
(optional) — Whether to include the rightmost valuedig_lab
(optional) — The number of digits for labelsordered_result
(optional) — Whether to return an ordered factor
The factor vector
datar.apis.base.
diff
(
x
, lag=1
, differences=1
)
Difference of a numeric vector
x
— A numeric vectorlag
(int, optional) — The lag to use. Could be negative.It always calculatesx[lag:] - x[:-lag]
even whenlag
is negativedifferences
(int, optional) — The order of the difference
] – x[:-lag].If
differences > 1, the rule applies
differencestimes on
x`
datar.apis.base.
expand_grid
(
x
, *args
, **kwargs
)
Expand a grid
x
— A numeric vector*args
— Additional numeric vectors**kwargs
— Additional keyword arguments
The expanded grid
datar.apis.base.
outer
(
x
, y
, fun='*'
)
Outer product of two vectors
x
— A numeric vectory
— A numeric vectorfun
(optional) — The function to handle how the result of the elements fromthe first and second vectors should be computed. The function has to be vectorized at the second argument, and return the same shape as y.
The outer product
datar.apis.base.
make_names
(
names
, unique=True
)
Make names for a vector
names
— character vector to be coerced to syntactically valid names.This is coerced to character if necessary.unique
(bool, optional) — Whether to make the names unique
The names
datar.apis.base.
make_unique
(
names
)
Make a vector unique
names
— a character vector
The unique vector
datar.apis.base.
rank
(
x
, na_last=True
, ties_method='average'
)
Rank a numeric vector
x
— A numeric vectorna_last
(bool, optional) — Whether to put NA at the endties_method
(str, optional) — The method to handle ties. One of "average", "first","last", "random", "max", "min"
The ranks
datar.apis.base.
identity
(
x
)
Identity function
x
— A numeric vector
The same vector
datar.apis.base.
is_logical
(
x
)
Check if a vector is logical
x
— A numeric vector
Whether the vector is logical
datar.apis.base.
is_true
(
x
)
Check if anything is true
x
— object to be tested
Whether x
is true
datar.apis.base.
is_false
(
x
)
Check if anything is false
x
— object to be tested
Whether x
is false
datar.apis.base.
is_na
(
x
)
Check if anything is NA
x
— object to be tested
Whether x
is NA
datar.apis.base.
is_finite
(
x
)
Check if anything is finite
x
— object to be tested
Whether x
is finite
datar.apis.base.
is_infinite
(
x
)
Check if anything is infinite
x
— object to be tested
Whether x
is infinite
datar.apis.base.
any_na
(
x
)
Check if anything in x
is NA
x
— object to be tested
Whether anything in x
is NA
datar.apis.base.
as_null
(
x
)
Convert anything to NULL
x
— object to be converted
NULL
datar.apis.base.
is_null
(
x
)
Check if anything is NULL
x
— object to be tested
Whether x
is NULL
datar.apis.base.
set_seed
(
seed
)
→ Any
Set the seed of the random number generator
seed
— The seed
datar.apis.base.
rep
(
x
, times=1
, length=None
, each=1
)
Replicate elements of a vector
x
— a vector or scalertimes
(optional) — number of times to repeat each element if of length len(x),or to repeat the whole vector if of length 1length
(optional) — non-negative integer. The desired length of the output vectoreach
(optional) — non-negative integer. Each element of x is repeated each times.
The replicated vector
datar.apis.base.
c_
(
*args
)
Concatenate vectors
args
— vectors to be concatenated
The concatenated vector
datar.apis.base.
length
(
x
)
Get the length of a vector
x
— a vector or scaler
The length of the vector
datar.apis.base.
lengths
(
x
)
Get the lengths of a list
x
— a list
The lengths of the list
datar.apis.base.
order
(
x
, decreasing=False
, na_last=True
)
Order a vector
x
— a vector or scalerdecreasing
(bool, optional) — Whether to order in decreasing orderna_last
(bool, optional) — Whether to put NA at the end
The order
datar.apis.base.
sort
(
x
, decreasing=False
, na_last=True
)
Sort a vector
x
— a vector or scalerdecreasing
(bool, optional) — Whether to sort in decreasing orderna_last
(bool, optional) — Whether to put NA at the end
The sorted vector
datar.apis.base.
rev
(
x
)
Reverse a vector
x
— a vector or scaler
The reversed vector
datar.apis.base.
sample
(
x
, size=None
, replace=False
, prob=None
)
Sample a vector
x
— a vector or scalersize
(optional) — the size of the samplereplace
(bool, optional) — whether to sample with replacementprob
(optional) — the probabilities of sampling each element
The sampled vector
datar.apis.base.
seq
(
from_=None
, to=None
, by=None
, length_out=None
, along_with=None
)
Generate a sequence
from_
(optional) — the start of the sequenceto
(optional) — the end of the sequenceby
(optional) — the step of the sequencelength_out
(optional) — the length of the sequencealong_with
(optional) — the sequence to be aligned with
The sequence
datar.apis.base.
seq_along
(
x
)
Generate a sequence along a vector
x
— a vector or scaler
The sequence
datar.apis.base.
seq_len
(
x
)
Generate a sequence of length x
x
— a vector or scaler
The sequence
datar.apis.base.
match
(
x
, table
, nomatch=-1
)
Match elements of a vector
x
— a vector or scalertable
— the table to matchnomatch
(optional) — the value to use for no match
The matched vector
datar.apis.base.
beta
(
x
, y
)
Compute the beta function
x
— a vector or scalery
— a vector or scaler
The beta function
datar.apis.base.
lgamma
(
x
)
Compute the log gamma function
x
— a vector or scaler
The log gamma function
datar.apis.base.
digamma
(
x
)
Compute the digamma function
x
— a vector or scaler
The digamma function
datar.apis.base.
trigamma
(
x
)
Compute the trigamma function
x
— a vector or scaler
The trigamma function
datar.apis.base.
choose
(
n
, k
)
Compute the binomial coefficient
n
— a vector or scalerk
— a vector or scaler
The binomial coefficient
datar.apis.base.
factorial
(
x
)
Compute the factorial
x
— a vector or scaler
The factorial
datar.apis.base.
gamma
(
x
)
Compute the gamma function
x
— a vector or scaler
The gamma function
datar.apis.base.
lfactorial
(
x
)
Compute the log factorial
x
— a vector or scaler
The log factorial
datar.apis.base.
lchoose
(
n
, k
)
Compute the log binomial coefficient
n
— a vector or scalerk
— a vector or scaler
The log binomial coefficient
datar.apis.base.
lbeta
(
x
, y
)
Compute the log beta function
x
— a vector or scalery
— a vector or scaler
The log beta function
datar.apis.base.
psigamma
(
x
, deriv
)
Compute the psi function
x
— a vector or scalerderiv
— the derivative
The psi function
datar.apis.base.
rnorm
(
n
, mean=0
, sd=1
)
Generate random normal variables
n
— the number of random variablesmean
(optional) — the mean of the random variablessd
(optional) — the standard deviation of the random variables
The random normal variables
datar.apis.base.
runif
(
n
, min=0
, max=1
)
Generate random uniform variables
n
— the number of random variablesmin
(optional) — the minimum of the random variablesmax
(optional) — the maximum of the random variables
The random uniform variables
datar.apis.base.
rpois
(
n
, lambda_
)
Generate random Poisson variables
n
— the number of random variableslambda_
— the lambda of the random variables
The random Poisson variables
datar.apis.base.
rbinom
(
n
, size
, prob
)
Generate random binomial variables
n
— the number of random variablessize
— the size of the random variablesprob
— the probability of the random variables
The random binomial variables
datar.apis.base.
rcauchy
(
n
, location=0
, scale=1
)
Generate random Cauchy variables
n
— the number of random variableslocation
(optional) — the location of the random variablesscale
(optional) — the scale of the random variables
The random Cauchy variables
datar.apis.base.
rchisq
(
n
, df
)
Generate random chi-squared variables
n
— the number of random variablesdf
— the degrees of freedom of the random variables
The random chi-squared variables
datar.apis.base.
rexp
(
n
, rate
)
Generate random exponential variables
n
— the number of random variablesrate
— the rate of the random variables
The random exponential variables
datar.apis.base.
is_character
(
x
)
Is x a character vector
x
— a vector or scaler
True if x is a character vector
datar.apis.base.
grep
(
pattern
, x
, ignore_case=False
, value=False
, fixed=False
, invert=False
)
Grep for a pattern
pattern
— the pattern to search forx
— the vector to searchignore_case
(optional) — ignore casevalue
(optional) — return the valuefixed
(optional) — use fixed string matchinginvert
(optional) — invert the match
The indices of the matches
datar.apis.base.
grepl
(
pattern
, x
, ignore_case=False
, fixed=False
)
Grep for a pattern
pattern
— the pattern to search forx
— the vector to searchignore_case
(optional) — ignore casefixed
(optional) — use fixed string matching
The indices of the matches
datar.apis.base.
sub
(
pattern
, replacement
, x
, ignore_case=False
, fixed=False
)
Substitute a pattern
pattern
— the pattern to search forreplacement
— the replacementx
— the vector to searchignore_case
(optional) — ignore casefixed
(optional) — use fixed string matching
The vector with the substitutions
datar.apis.base.
gsub
(
pattern
, replacement
, x
, ignore_case=False
, fixed=False
)
Substitute a pattern
pattern
— the pattern to search forreplacement
— the replacementx
— the vector to searchignore_case
(optional) — ignore casefixed
(optional) — use fixed string matching
The vector with the substitutions
datar.apis.base.
strsplit
(
x
, split
, fixed=False
, perl=False
, use_bytes=False
)
Split a string
x
— the vector to splitsplit
— the pattern to split onfixed
(optional) — use fixed string matchingperl
(optional) — use perl regular expressionsuse_bytes
(optional) — use bytes
The vector with the splits
datar.apis.base.
paste
(
*args
, sep=' '
, collapse=None
)
Join a vector into a string
*args
— the vector to joinsep
(optional) — the separatorcollapse
(optional) — collapse the vector
The vector joined into a string
datar.apis.base.
paste0
(
*args
, collapse=None
)
Join a vector into a string
*args
— the vector to joincollapse
(optional) — collapse the vector
The vector joined into a string
datar.apis.base.
sprintf
(
fmt
, *args
)
Format a string
fmt
— the format stringargs
— the arguments to the format string
The formatted string
datar.apis.base.
substr
(
x
, start
, stop
)
Get a substring
x
— the string to get the substring fromstart
— the start of the substringstop
— the stop of the substring
The substring
datar.apis.base.
substring
(
x
, first
, last=None
)
Get a substring
x
— the string to get the substring fromfirst
— the start of the substringlast
(optional) — the stop of the substring
The substring
datar.apis.base.
startswith
(
x
, prefix
)
Does x start with prefix
x
— the string to checkprefix
— the prefix to check
True if x starts with prefix
datar.apis.base.
endswith
(
x
, suffix
)
Does x end with suffix
x
— the string to checksuffix
— the suffix to check
True if x ends with suffix
datar.apis.base.
strtoi
(
x
, base=0
)
Convert a string to an integer
x
— the string to convertbase
(optional) — the base of the integer
The integer
datar.apis.base.
trimws
(
x
, which='both'
, whitespace=' \\t'
)
Trim whitespace from a string
x
— the string to trimwhich
(optional) — which whitespace to trimwhitespace
(optional) — the whitespace to trim
The trimmed string
datar.apis.base.
toupper
(
x
)
Convert a string to upper case
x
— the string to convert
The upper case string
datar.apis.base.
tolower
(
x
)
Convert a string to lower case
x
— the string to convert
The lower case string
datar.apis.base.
chartr
(
old
, new
, x
)
Translate characters
old
— the characters to translatenew
— the new charactersx
— the string to translate
The translated string
datar.apis.base.
nchar
(
x
, type_='width'
, allow_na=True
, keep_na=False
, _na_len=2
)
Get the number of characters in a string
x
— the string to countallow_na
(bool, optional) — allow NAkeep_na
(bool, optional) — keep NAtype
— the type of count
The number of characters
datar.apis.base.
nzchar
(
x
, keep_na=False
)
Is the string non-zero length
x
— the string to checkkeep_na
(bool, optional) — keep NA
True if the string is non-zero length
datar.apis.base.
table
(
x
, *more
, exclude=None
, use_na='no'
, dnn=None
, deparse_level=1
)
Get the table of a vector
x
— the vector to get the table ofexclude
(optional) — exclude these valuesuse_na
(optional) — use NAdnn
(optional) — the names of the vectorsdeparse_level
(optional) — the deparse levelmore
— more vectors
The table
datar.apis.base.
tabulate
(
bin
, nbins=None
)
Get the table of a vector
bin
— the vector to get the table ofnbins
(optional) — the number of bins
An integer valued 'integer' vector (without names).There is a bin for each of the values '1, ..., nbins'
datar.apis.base.
is_atomic
(
x
)
Is the object atomic
x
— the object to check
True if the object is atomic
datar.apis.base.
is_double
(
x
)
Is the object a double
x
— the object to check
True if the object is a double
datar.apis.base.
is_element
(
x
, y
)
Is the object an element of the table
x
— the object to checky
— the pool to check
True if the object is an element of the pool
datar.apis.base.
is_integer
(
x
)
Is the object an integer
x
— the object to check
True if the object is an integer
datar.apis.base.
is_numeric
(
x
)
Is the object numeric
x
— the object to check
True if the object is numeric
datar.apis.base.
any_
(
x
, na_rm=False
)
Is any element true
x
— the vector to checkna_rm
(bool, optional) — remove NA
True if any element is true
datar.apis.base.
all_
(
x
, na_rm=False
)
Are all elements true
x
— the vector to checkna_rm
(bool, optional) — remove NA
True if all elements are true
datar.apis.base.
acos
(
x
)
Get the inverse cosine
x
— the value to get the inverse cosine of
The inverse cosine
datar.apis.base.
acosh
(
x
)
Get the inverse hyperbolic cosine
x
— the value to get the inverse hyperbolic cosine of
The inverse hyperbolic cosine
datar.apis.base.
asin
(
x
)
Get the inverse sine
x
— the value to get the inverse sine of
The inverse sine
datar.apis.base.
asinh
(
x
)
Get the inverse hyperbolic sine
x
— the value to get the inverse hyperbolic sine of
The inverse hyperbolic sine
datar.apis.base.
atan
(
x
)
Get the inverse tangent
x
— the value to get the inverse tangent of
The inverse tangent
datar.apis.base.
atanh
(
x
)
Get the inverse hyperbolic tangent
x
— the value to get the inverse hyperbolic tangent of
The inverse hyperbolic tangent
datar.apis.base.
cos
(
x
)
Get the cosine
x
— the value to get the cosine of
The cosine
datar.apis.base.
cosh
(
x
)
Get the hyperbolic cosine
x
— the value to get the hyperbolic cosine of
The hyperbolic cosine
datar.apis.base.
cospi
(
x
)
Get the cosine of pi times x
x
— the value to get the cosine of pi times x of
The cosine of pi times x
datar.apis.base.
sin
(
x
)
Get the sine
x
— the value to get the sine of
The sine
datar.apis.base.
sinh
(
x
)
Get the hyperbolic sine
x
— the value to get the hyperbolic sine of
The hyperbolic sine
datar.apis.base.
sinpi
(
x
)
Get the sine of pi times x
x
— the value to get the sine of pi times x of
The sine of pi times x
datar.apis.base.
tan
(
x
)
Get the tangent
x
— the value to get the tangent of
The tangent
datar.apis.base.
tanh
(
x
)
Get the hyperbolic tangent
x
— the value to get the hyperbolic tangent of
The hyperbolic tangent
datar.apis.base.
tanpi
(
x
)
Get the tangent of pi times x
x
— the value to get the tangent of pi times x of
The tangent of pi times x
datar.apis.base.
atan2
(
y
, x
)
Get the inverse tangent of y/x
y
— the numeratorx
— the denominator
The inverse tangent of y/x
datar.apis.base.
append
(
x
, values
, after=-1
)
Append values to the vector
x
— the vector to append tovalues
— the values to appendafter
(int, optional) — the index to append after
The vector with the values appended
datar.apis.base.
colnames
(
x
, nested=True
)
Get the column names
x
— the data frame to get the column names ofnested
(bool, optional) — whether x is a nested data frame
The column names
datar.apis.base.
set_colnames
(
x
, names
, nested=True
)
Set the column names
x
— the data frame to set the column names ofnames
— the column names to setnested
(bool, optional) — whether the frame are nested
The data frame with the column names set
datar.apis.base.
rownames
(
x
)
Get the row names
x
— the data frame to get the row names of
The row names
datar.apis.base.
set_rownames
(
x
, names
)
Set the row names
x
— the data frame to set the row names ofnames
— the row names to set
The data frame with the row names set
datar.apis.base.
dim
(
x
, nested=True
)
Get the dimensions
x
— the data frame to get the dimensions ofnested
(bool, optional) — whether x is a nested data frame
The dimensions
datar.apis.base.
diag
(
x
, nrow=None
, ncol=None
)
Get the diagonal of a matrix
x
— the matrix to get the diagonal ofnrow
(optional) — the number of rowsncol
(optional) — the number of columns
The diagonal of the matrix
datar.apis.base.
duplicated
(
x
, incomparables=None
, from_last=False
)
Get the duplicated values
x
— the vector to get the duplicated values ofincomparables
(optional) — the incomparablesfrom_last
(bool, optional) — whether to search from the last
The duplicated values
datar.apis.base.
intersect
(
x
, y
)
Get the intersection of two vectors
x
— the first vectory
— the second vector
The intersection of the two vectors
datar.apis.base.
ncol
(
x
, nested=True
)
Get the number of columns
x
— the data frame to get the number of columns ofnested
(bool, optional) — whether x is a nested data frame
The number of columns
datar.apis.base.
nrow
(
x
)
Get the number of rows
x
— the data frame to get the number of rows of
The number of rows
datar.apis.base.
proportions
(
x
, margin=1
)
Get the proportion table
x
— the data frame to get the proportion table ofmargin
(int, optional) — the margin
The proportion table
datar.apis.base.
setdiff
(
x
, y
)
Get the difference of two vectors
x
— the first vectory
— the second vector
The difference of the two vectors
datar.apis.base.
setequal
(
x
, y
)
Check if two vectors are equal
x
— the first vectory
— the second vector
Whether the two vectors are equal
datar.apis.base.
unique
(
x
)
Get the unique values
x
— the vector to get the unique values of
The unique values
datar.apis.base.
t
(
x
)
Get the transpose
x
— the matrix to get the transpose of
The transpose
datar.apis.base.
union
(
x
, y
)
Get the union of two vectors
x
— the first vectory
— the second vector
The union of the two vectors
datar.apis.base.
max_col
(
x
, ties_method='random'
, nested=True
)
Get the maximum column
x
— the data frame to get the maximum column ofties_method
(str, optional) — the ties methodnested
(bool, optional) — whether x is a nested data frame
The maximum column
datar.apis.base.
complete_cases
(
x
)
Get the complete cases
x
— the data frame to get the complete cases of
The complete cases
datar.apis.base.
head
(
x
, n=6
)
Get the first n rows
x
— the data frame to get the first n rows ofn
(int, optional) — the number of rows to get
The first n rows
datar.apis.base.
tail
(
x
, n=6
)
Get the last n rows
x
— the data frame to get the last n rows ofn
(int, optional) — the number of rows to get
The last n rows
datar.apis.base.
which
(
x
)
Get the indices of the non-zero values
x
— the vector to get the indices of the non-zero values of
The indices of the non-zero values
datar.apis.base.
which_max
(
x
)
Get the index of the maximum value
x
— the vector to get the index of the maximum value of
The index of the maximum value
datar.apis.base.
which_min
(
x
)
Get the index of the minimum value
x
— the vector to get the index of the minimum value of
The index of the minimum value