Skip to content

Commit

Permalink
Merge pull request #31 from metasurveyr/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
mauroloprete authored May 1, 2024
2 parents b617cb6 + 6e4cda8 commit 535c760
Show file tree
Hide file tree
Showing 20 changed files with 63 additions and 7 deletions.
2 changes: 2 additions & 0 deletions R/set_engine.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#' @title set_engine
#' @keywords engine
#' @description Set engine for load survey
#' @param .engine Character vector with the name of the engine
#' @importFrom glue glue glue_col identity_transformer
Expand Down Expand Up @@ -54,6 +55,7 @@ set_engine <- function(.engine = show_engines()) {
#' @description Show engines available
#' @importFrom glue glue glue_col
#' @export
#' @keywords engine
#' @return Character vector

show_engines <- function() {
Expand Down
4 changes: 4 additions & 0 deletions R/steps.R
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ recode <- function(svy, new_var, ..., .default = NA_character_, ordered = FALSE,
#' @param ... Expressions to compute
#' @param use_copy Use copy
#' @return Survey object
#' @keywords Steps
#' @export

step_compute <- function(svy = NULL, ..., use_copy = use_copy_default()) {
Expand Down Expand Up @@ -206,6 +207,7 @@ step_compute <- function(svy = NULL, ..., use_copy = use_copy_default()) {
#' @param ordered Ordered
#' @param use_copy Use copy
#' @return Survey object
#' @keywords Steps
#' @export

step_recode <- function(svy = survey_empty(), new_var, ..., .default = NA_character_, .name_step = NULL, ordered = FALSE, use_copy = use_copy_default()) {
Expand Down Expand Up @@ -347,6 +349,8 @@ get_type_step <- function(steps) {
#' @importFrom visNetwork visOptions
#' @importFrom visNetwork addFontAwesome
#' @return Graph
#' @keywords Survey methods
#' @keywords Steps
#' @export


Expand Down
12 changes: 12 additions & 0 deletions R/survey.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,27 +56,33 @@ Survey <- R6Class("Survey",

#' @title survey_to_data_frame
#' @description Convert survey to data.frame
#' @keywords Surveymethods
#' @param svy Survey object

#' @export
#' @return data.frame
survey_to_data_frame <- function(svy) {
data.frame(svy$get_data())
}

#' @title survey_to_tibble
#' @keywords Surveymethods
#' @description Convert survey to tibble
#' @param svy Survey object
#' @export
#' @return tibble


survey_to_tibble <- function(svy) {
tibble::as_tibble(svy$get_data())
}

#' @title survey_to_data.table
#' @keywords Surveymethods
#' @description Convert survey to data.table
#' @param svy Survey object
#' @export

#' @importFrom data.table data.table
#' @return data.table
#'
Expand All @@ -88,6 +94,7 @@ survey_to_data.table <- function(svy) {
#' @title get_data
#' @description Get data from survey
#' @param svy Survey object
#' @keywords Surveymethods
#' @export
#' @return Data
#'
Expand Down Expand Up @@ -138,6 +145,7 @@ set_weight <- function(svy, new_weight) {

#' @title get_metadata
#' @description Get metadata from survey
#' @keywords Surveymethods
#' @importFrom glue glue glue_col
#' @importFrom emoji emoji
#' @param self Object of class Survey
Expand Down Expand Up @@ -183,6 +191,8 @@ get_metadata <- function(self) {
#' @title get_steps
#' @description Get steps from survey
#' @param svy Survey object
#' @keywords Survey methods
#' @keywords Steps
#' @export
#' @return List

Expand All @@ -192,11 +202,13 @@ get_steps <- function(svy) {

#' @title survey_empty
#' @description Create an empty survey
#' @keywords Surveymethods
#' @param edition Edition of survey
#' @param type Type of survey
#' @param weight Weight of survey
#' @param engine Engine of survey
#' @export

#' @return Survey object
#'

Expand Down
3 changes: 3 additions & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ validate_weight <- function(svy, weight) {

#' Load survey example
#' @param path Path to the survey file
#' @keywords utils
#' @export

load_survey_example <- function(path = NULL) {
Expand All @@ -49,6 +50,7 @@ load_survey_example <- function(path = NULL) {

#' Get use_copy option
#' @return Use copy
#' @keywords utils
#' @export

use_copy_default <- function() {
Expand All @@ -58,6 +60,7 @@ use_copy_default <- function() {
#' Set use_copy option
#' @param use_copy Use copy
#' @export
#' @keywords utils
#' @examples
#' set_use_copy(FALSE)
#' use_copy_default()
Expand Down
16 changes: 16 additions & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,19 @@ authors:
Natalia da Silva:
href: https://iesta.fcea.udelar.edu.uy/integrantes/natalia-da-silva/

reference:
- title: Engine
contents:
- has_keyword("engine")
- title: Survey methods
contents:
- has_keyword("Surveymethods")
- title: Steps
contents:
- has_keyword("Steps")
- title: Preprocessing
contents:
- has_keyword("preprocessing")
- title: Utils
contents:
- has_keyword("utils")
3 changes: 2 additions & 1 deletion man/get_data.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/get_metadata.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion man/get_steps.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/load_survey_example.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/set_engine.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/set_use_copy.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/show_engines.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/step_compute.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/step_recode.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/survey_empty.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/survey_to_data.table.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/survey_to_data_frame.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/survey_to_tibble.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/use_copy_default.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/view_graph.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 535c760

Please sign in to comment.