-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create function to structure icd_get_foundation output
- Loading branch information
1 parent
34a5f62
commit 71103c8
Showing
10 changed files
with
190 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#' | ||
#' Structure ICD list outputs | ||
#' | ||
#' @param icd_list An `icd_list` object produced by a call to any of the `icd_get` | ||
#' functions | ||
#' | ||
#' @return An object of class `icd_tbl` which is basically a `data.frame` format | ||
#' of ICD outputs | ||
#' | ||
#' @examples | ||
#' icd_list <- icd_get_foundation() | ||
#' icd_tbl_foundation <- icd_structure_foundation(icd_list) | ||
#' | ||
#' @rdname icd_structure | ||
#' @export | ||
#' | ||
icd_structure_foundation <- function(icd_list) { | ||
## Structure title ---- | ||
icd_list$title <- do.call(cbind, icd_list$title) |> data.frame() | ||
|
||
## Structure availableLanguages ---- | ||
icd_list$availableLanguages <- unlist(icd_list$availableLanguages) |> | ||
paste(collapse = ", ") | ||
|
||
## Structure child ---- | ||
icd_list$child <- unlist(icd_list$child) |> list() | ||
|
||
## Bind columns and rename columns ---- | ||
icd_tbl <- do.call(cbind, icd_list) | ||
names(icd_tbl)[3] <- "title@language" | ||
names(icd_tbl)[4] <- "title@value" | ||
names(icd_tbl)[8] <- "child" | ||
|
||
## Create `icd_tbl` class object ---- | ||
class(icd_tbl) <- "icd_tbl" | ||
|
||
icd_tbl | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters