Marginal distributions should first be obtained using the get_marginal_distributions()
function.
To obtain the marginal distributions for all variables you should only specify the dataset:
library(RESIDE)
get_marginal_distributions(IST) marginals <-
To obtain marginal distributions for select variables, you should specify the variables using the variables parameter:
library(RESIDE)
get_marginal_distributions(
marginals <-
IST,variables = c(
"SEX",
"AGE",
"ID14",
"RSBP",
"RATRIAL",
"SET14D",
"DSIDED"
) )
Marginal distributions can be printed when generating marginal distributions using the print parameter:
library(RESIDE)
get_marginal_distributions(
marginals <-
IST,print = TRUE
)
Or from a stored marginals object:
library(RESIDE)
get_marginal_distributions(IST)
marginals <-print(marginals)
Marginal distributions can be exported using the export_marginal_distributions()
function, specifying the marginal distributions (generated by `get_marginal_distributions()’) and a folder path:
library(RESIDE)
get_marginal_distributions(IST)
marginals <-export_marginal_distributions(
marginals,folder_path = "/Users/ryan/marginals"
)
This folder should exist and not contain any previously exported marginal distributions. You can create the folder automatically using the create_folder parameter:
library(RESIDE)
get_marginal_distributions(IST)
marginals <-export_marginal_distributions(
marginals,folder_path = "/Users/ryan/marginals",
create_folder = TRUE
)
export_marginal_distributions()
The following files will be created by the export_marginal_distributions()
function:
These files should then be sent to the user.
NB If there are no variables of a certain type the corresponding file will not be created.