Title: | Manipulate MCMC Samples and Data Frames |
---|---|
Description: | Manipulates Monte Carlo Markov Chain samples and associated data frames. |
Authors: | Joe Thorley [aut, cre] |
Maintainer: | Joe Thorley <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.0.1.9000 |
Built: | 2024-12-01 07:42:38 UTC |
Source: | https://github.com/poissonconsulting/mcmcdata |
Anti join mcmc data
## S3 method for class 'mcmc_data' anti_join(x, y, by = NULL, copy = FALSE, ...)
## S3 method for class 'mcmc_data' anti_join(x, y, by = NULL, copy = FALSE, ...)
x , y
|
A pair of data frames, data frame extensions (e.g. a tibble), or lazy data frames (e.g. from dbplyr or dtplyr). See Methods, below, for more details. |
by |
A join specification created with If To join on different variables between To join by multiple variables, use a
For simple equality joins, you can alternatively specify a character vector
of variable names to join by. For example, To perform a cross-join, generating all combinations of |
copy |
If |
... |
Other parameters passed onto methods. |
Arrange mcmcr data
## S3 method for class 'mcmc_data' arrange(.data, ...)
## S3 method for class 'mcmc_data' arrange(.data, ...)
.data |
An mcmc_data object |
... |
< |
arrange(mcmc_data_example, species, homeworld)
arrange(mcmc_data_example, species, homeworld)
As Tibble
## S3 method for class 'mcmc_data' as_tibble(x, samples = FALSE, ...)
## S3 method for class 'mcmc_data' as_tibble(x, samples = FALSE, ...)
x |
An mcmc_data object to coerce to a tibble. |
samples |
A flag specifying whether to include samples |
... |
Unused, for extensibility. |
Bind Rows
bind_rows2(x, y)
bind_rows2(x, y)
x |
A mcmc_data |
y |
A second mcmc_data |
bind_rows2(mcmc_data_example, mcmc_data_example)
bind_rows2(mcmc_data_example, mcmc_data_example)
Checks an object is a mcmc_data
.
check_mcmc_data(x, x_name = NULL)
check_mcmc_data(x, x_name = NULL)
x |
The object to check. |
x_name |
A string of the name of object x or NULL. |
An invisible copy of x (if it doesn't throw an error).
check_mcmc_data(mcmcdata::mcmc_data_example)
check_mcmc_data(mcmcdata::mcmc_data_example)
Gets the coefficient table as a tibble.
## S3 method for class 'mcmc_data' coef(object, conf_level = 0.95, estimate = stats::median, ...)
## S3 method for class 'mcmc_data' coef(object, conf_level = 0.95, estimate = stats::median, ...)
object |
The mcmc_data object to get the coefficent table for. |
conf_level |
A probability specifying the confidence level. |
estimate |
A function to calculate the point estimate. |
... |
Unused |
coef(mcmc_data_example)
coef(mcmc_data_example)
Fills all of an object's missing values while preserving the object's dimensionality and class.
## S3 method for class 'mcmc_data' fill_na(x, value = 0, ...)
## S3 method for class 'mcmc_data' fill_na(x, value = 0, ...)
x |
An object. |
value |
A scalar of the value to replace values with. |
... |
Other arguments passed to methods. |
It should only be defined for objects with values of consistent class ie not standard data.frames.
The modified object.
fill_na(logical)
: Fill Missing Values for logical Objects
fill_na(integer)
: Fill Missing Values for integer Objects
fill_na(numeric)
: Fill Missing Values for numeric Objects
fill_na(character)
: Fill Missing Values for character Objects
Other fill:
fill_all()
# logical fill_na(c(TRUE, NA)) # integer fill_na(c(1L, NA), 0) # numeric fill_na(c(1, NA), Inf) # character fill_na(c("text", NA)) fill_na(matrix(c("text", NA)), value = Inf)
# logical fill_na(c(TRUE, NA)) # integer fill_na(c(1L, NA), 0) # numeric fill_na(c(1, NA), Inf) # character fill_na(c("text", NA)) fill_na(matrix(c("text", NA)), value = Inf)
Slice mcmcr data
## S3 method for class 'mcmc_data' filter(.data, ...)
## S3 method for class 'mcmc_data' filter(.data, ...)
.data |
An mcmc_data object |
... |
For Provide either positive values to keep, or negative values to drop. The values provided must be either all positive or all negative. Indices beyond the number of rows in the input are silently ignored. For |
filter(mcmc_data_example, species == "Droid")
filter(mcmc_data_example, species == "Droid")
Group mcmc data
## S3 method for class 'mcmc_data' group_by(.data, ..., .add = FALSE)
## S3 method for class 'mcmc_data' group_by(.data, ..., .add = FALSE)
.data |
An mcmc_data object |
... |
In |
.add |
When This argument was previously called |
group_by(mcmc_data_example, homeworld, species)
group_by(mcmc_data_example, homeworld, species)
Inner join mcmc data
## S3 method for class 'mcmc_data' inner_join(x, y, by = NULL, copy = FALSE, suffix = c(".x", ".y"), ...)
## S3 method for class 'mcmc_data' inner_join(x, y, by = NULL, copy = FALSE, suffix = c(".x", ".y"), ...)
x , y
|
A pair of data frames, data frame extensions (e.g. a tibble), or lazy data frames (e.g. from dbplyr or dtplyr). See Methods, below, for more details. |
by |
A join specification created with If To join on different variables between To join by multiple variables, use a
For simple equality joins, you can alternatively specify a character vector
of variable names to join by. For example, To perform a cross-join, generating all combinations of |
copy |
If |
suffix |
If there are non-joined duplicate variables in |
... |
Other parameters passed onto methods. |
Tests whether x is an object of class 'mcmc_data'
is.mcmc_data(x)
is.mcmc_data(x)
x |
The object to test. |
A flag indicating whether the test was positive.
Left join mcmc data
## S3 method for class 'mcmc_data' left_join(x, y, by = NULL, copy = FALSE, suffix = c(".x", ".y"), ...)
## S3 method for class 'mcmc_data' left_join(x, y, by = NULL, copy = FALSE, suffix = c(".x", ".y"), ...)
x , y
|
A pair of data frames, data frame extensions (e.g. a tibble), or lazy data frames (e.g. from dbplyr or dtplyr). See Methods, below, for more details. |
by |
A join specification created with If To join on different variables between To join by multiple variables, use a
For simple equality joins, you can alternatively specify a character vector
of variable names to join by. For example, To perform a cross-join, generating all combinations of |
copy |
If |
suffix |
If there are non-joined duplicate variables in |
... |
Other parameters passed onto methods. |
Combines an mcmc object with a data frame. The mcmc object must be for a single parameter of the same length as the number of rows in the data frame. The resultant object can be filtered or summarized or the coef calculated.
mcmc_data(mcmc, data)
mcmc_data(mcmc, data)
mcmc |
An mcmc object with one parameter |
data |
A data frame |
An object of class mcmc_data
An example mcmc_data object.
mcmc_data_example
mcmc_data_example
An object of class mcmc_data
of length 2.
Get mcmc_data object.
mcmc_derive_data(object, ...)
mcmc_derive_data(object, ...)
object |
The object. |
... |
Not used. |
Gets mcmc_data object of a derived parameters. To return an mcmcr object of one or more derived parameters use mcmc_derive(). By default the current parameter is call par and the derived one is called new_par.
## S3 method for class 'mcmc_data' mcmc_derive_data( object, expr = "new_par <- par", values = list(), parameter = "par", monitor = "new_par", parallel = FALSE, silent = getOption("mcmcderive.silent", FALSE), ... )
## S3 method for class 'mcmc_data' mcmc_derive_data( object, expr = "new_par <- par", values = list(), parameter = "par", monitor = "new_par", parallel = FALSE, silent = getOption("mcmcderive.silent", FALSE), ... )
object |
An mcmc_data object |
expr |
A string of the R expression. |
values |
A named list of values for objects not in object$data |
parameter |
A string of the name of the current MCMC samples in expr. |
monitor |
A string of the name of the derived parameter to return. |
parallel |
A flag specifying whether to generate the derived parameters for each chain in parallel. |
silent |
A flag specifying whether to suppress messages and warnings. |
... |
Unused. |
An mcmc_data object.
Gets mcmcr object of one or more derived parameters. To return an mcmc_data object use mcmc_derive_data(). By default the current parameter is call par.
## S3 method for class 'mcmc_data' mcmc_derive( object, expr = "new_par <- par", values = list(), parameter = "par", monitor = ".*", parallel = FALSE, silent = getOption("mcmcderive.silent", FALSE), ... )
## S3 method for class 'mcmc_data' mcmc_derive( object, expr = "new_par <- par", values = list(), parameter = "par", monitor = ".*", parallel = FALSE, silent = getOption("mcmcderive.silent", FALSE), ... )
object |
An mcmc_data object |
expr |
A string of the R expression. |
values |
A named list of values for objects not in object$data |
parameter |
A string of the name of the current MCMC samples in expr. |
monitor |
A regular expression specifying the derived parameter(s) in expr to monitor. |
parallel |
A flag specifying whether to generate the derived parameters for each chain in parallel. |
silent |
A flag specifying whether to suppress messages and warnings. |
... |
Unused. |
An mcmcr object of the derived parameters.
Mutate mcmc_data
## S3 method for class 'mcmc_data' mutate(.data, ...)
## S3 method for class 'mcmc_data' mutate(.data, ...)
.data |
An mcmc_data object |
... |
For For |
rename(mcmc_data_example, Spp = species)
rename(mcmc_data_example, Spp = species)
Rename mcmcr data
## S3 method for class 'mcmc_data' rename(.data, ...)
## S3 method for class 'mcmc_data' rename(.data, ...)
.data |
An mcmc_data object |
... |
For For |
rename(mcmc_data_example, Spp = species)
rename(mcmc_data_example, Spp = species)
Replace Missing Values mcmc data
## S3 method for class 'mcmc_data' replace_na(data, replace, ...)
## S3 method for class 'mcmc_data' replace_na(data, replace, ...)
data |
A data frame or vector. |
replace |
If If |
... |
Additional arguments for methods. Currently unused. |
Right join mcmc data
## S3 method for class 'mcmc_data' right_join(x, y, by = NULL, copy = FALSE, suffix = c(".x", ".y"), ...)
## S3 method for class 'mcmc_data' right_join(x, y, by = NULL, copy = FALSE, suffix = c(".x", ".y"), ...)
x , y
|
A pair of data frames, data frame extensions (e.g. a tibble), or lazy data frames (e.g. from dbplyr or dtplyr). See Methods, below, for more details. |
by |
A join specification created with If To join on different variables between To join by multiple variables, use a
For simple equality joins, you can alternatively specify a character vector
of variable names to join by. For example, To perform a cross-join, generating all combinations of |
copy |
If |
suffix |
If there are non-joined duplicate variables in |
... |
Other parameters passed onto methods. |
Select mcmcr data
## S3 method for class 'mcmc_data' select(.data, ...)
## S3 method for class 'mcmc_data' select(.data, ...)
.data |
An mcmc_data object |
... |
< |
select(mcmc_data_example, species, homeworld)
select(mcmc_data_example, species, homeworld)
Semi join mcmc data
## S3 method for class 'mcmc_data' semi_join(x, y, by = NULL, copy = FALSE, ...)
## S3 method for class 'mcmc_data' semi_join(x, y, by = NULL, copy = FALSE, ...)
x , y
|
A pair of data frames, data frame extensions (e.g. a tibble), or lazy data frames (e.g. from dbplyr or dtplyr). See Methods, below, for more details. |
by |
A join specification created with If To join on different variables between To join by multiple variables, use a
For simple equality joins, you can alternatively specify a character vector
of variable names to join by. For example, To perform a cross-join, generating all combinations of |
copy |
If |
... |
Other parameters passed onto methods. |
Slice mcmcr data
## S3 method for class 'mcmc_data' slice(.data, ...)
## S3 method for class 'mcmc_data' slice(.data, ...)
.data |
An mcmc_data object |
... |
For Provide either positive values to keep, or negative values to drop. The values provided must be either all positive or all negative. Indices beyond the number of rows in the input are silently ignored. For |
slice(mcmc_data_example, 1L)
slice(mcmc_data_example, 1L)
Summarise mcmc data
## S3 method for class 'mcmc_data' summarise(.data, ..., .fun = sum)
## S3 method for class 'mcmc_data' summarise(.data, ..., .fun = sum)
.data |
An mcmc_data object |
... |
< The value can be:
Returning values with size 0 or >1 was
deprecated as of 1.1.0. Please use |
.fun |
The function to use to summarise the MCMC samples. |
Ungroup mcmc data
## S3 method for class 'mcmc_data' ungroup(x, ...)
## S3 method for class 'mcmc_data' ungroup(x, ...)
x |
An mcmc_data object |
... |
In |
ungroup(mcmc_data_example)
ungroup(mcmc_data_example)