Skip to content

Commit

Permalink
Update function descriptions and examples
Browse files Browse the repository at this point in the history
  • Loading branch information
YuhangTom committed Sep 25, 2023
1 parent 656ae30 commit ae02882
Show file tree
Hide file tree
Showing 20 changed files with 48 additions and 88 deletions.
8 changes: 2 additions & 6 deletions R/df_rmtrend_x3p.R
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
#' Removing missing values and the quadratic trend from inner polygon
#'
#' Obtained x3p object after removing missing values and the quadratic trend from the inner polygon.
#' @param insidepoly_df data frame of inside polygon
#' @param insidepoly_df data frame of inside polygon obtained from \code{wire::x3p_insidepoly_df}
#' @return x3p object of residuals after removing trend
#' @import dplyr
#' @importFrom x3ptools df_to_x3p
#' @importFrom stats lm predict
#' @export
#' @examples
#' x3p <- x3p_subsamples[[1]]
#' mask_col <- "#FF0000"
#' concavity <- 1.5
#'
#' insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = mask_col, concavity = concavity, b = 1)
#' insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = "#FF0000", concavity = 1.5, b = 1)
#'
#' x3p_inner_nomiss_res <- df_rmtrend_x3p(insidepoly_df)
#' x3p_inner_nomiss_res
#'
#' if (interactive()) {
#' x3p_image_autosize(x3p_inner_nomiss_res)
#' }
Expand Down
7 changes: 2 additions & 5 deletions R/vec_align_sigs_list.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,11 @@
#' @export
#' @examples
#' x3p <- x3p_subsamples[[1]]
#' mask_col <- "#FF0000"
#' concavity <- 1.5
#'
#' insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = mask_col, concavity = concavity, b = 1)
#' insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = "#FF0000", concavity = 1.5, b = 1)
#' x3p_inner_nomiss_res <- df_rmtrend_x3p(insidepoly_df)
#' x3p_inner_impute <- x3p_impute(x3p_inner_nomiss_res, ifsave = FALSE, dir_name = NULL, ifplot = TRUE)
#'
#' x3p_bin_rotate <- x3p_vertical(x3p_inner_impute, min_score_cut = 0.1)
#'
#' vec_align_sigs_list(x3p_raw_sig_vec(x3p_bin_rotate), x3p_shift_sig_vec(x3p_bin_rotate),
#' ifplot = TRUE)
#'
Expand Down
6 changes: 1 addition & 5 deletions R/x3p_MLE_angle_vec.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,12 @@
#' @export
#' @examples
#' x3p <- x3p_subsamples[[1]]
#' mask_col <- "#FF0000"
#' concavity <- 1.5
#'
#' insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = mask_col, concavity = concavity, b = 1)
#' insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = "#FF0000", concavity = 1.5, b = 1)
#' x3p_inner_nomiss_res <- df_rmtrend_x3p(insidepoly_df)
#' x3p_inner_impute <- x3p_impute(x3p_inner_nomiss_res, ifsave = FALSE, dir_name = NULL, ifplot = TRUE)
#'
#' x3p_MLE_angle_vec(x3p_inner_impute, min_score_cut = 0.1, ifplot = TRUE)
#'
#'
x3p_MLE_angle_vec <- function(x3p, ntheta = 720, min_score_cut = 0.1,
ifplot = FALSE,
loess_span = 0.2) {
Expand Down
6 changes: 1 addition & 5 deletions R/x3p_impute.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,11 @@
#' @export
#' @examples
#' x3p <- x3p_subsamples[[1]]
#' mask_col <- "#FF0000"
#' concavity <- 1.5
#'
#' insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = mask_col, concavity = concavity, b = 1)
#' insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = "#FF0000", concavity = 1.5, b = 1)
#' x3p_inner_nomiss_res <- df_rmtrend_x3p(insidepoly_df)
#'
#' x3p_inner_impute <- x3p_impute(x3p_inner_nomiss_res, ifsave = FALSE, dir_name = NULL, ifplot = TRUE)
#' x3p_inner_impute
#'
#' if (interactive()) {
#' x3p_image_autosize(x3p_inner_impute)
#' }
Expand Down
12 changes: 9 additions & 3 deletions R/x3p_insidepoly_df.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
#' @param concavity strictly positive value used in \code{concaveman::concaveman}
#' @param b positive integer value, block size, used in \code{x3ptools::x3p_average}
#' @return data frame of inside polygon
#' \itemize{
#' \item{x}{x value from input x3p object}
#' \item{y}{y value from input x3p object}
#' \item{value}{height value from input x3p object}
#' \item{mask}{mask value from input x3p object}
#' \item{n_neighbor_val_miss}{number of missing immediate neighbor, self included}
#' \item{sd_not_miss}{standard deviation for immediate neighbor}
#' }
#' @import dplyr
#' @importFrom x3ptools x3p_extract x3p_average x3p_to_df
#' @importFrom tidyr pivot_longer
Expand All @@ -15,10 +23,8 @@
#' @export
#' @examples
#' x3p <- x3p_subsamples[[1]]
#' mask_col <- "#FF0000"
#' concavity <- 1.5
#'
#' insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = mask_col, concavity = concavity, b = 1)
#' insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = "#FF0000", concavity = 1.5, b = 1)
#' str(insidepoly_df)
#'
x3p_insidepoly_df <- function(x3p, mask_col = "#FF0000", concavity = 1.5, b = 10) {
Expand Down
6 changes: 1 addition & 5 deletions R/x3p_quantile_angle_vec.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,12 @@
#' @export
#' @examples
#' x3p <- x3p_subsamples[[1]]
#' mask_col <- "#FF0000"
#' concavity <- 1.5
#'
#' insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = mask_col, concavity = concavity, b = 1)
#' insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = "#FF0000", concavity = 1.5, b = 1)
#' x3p_inner_nomiss_res <- df_rmtrend_x3p(insidepoly_df)
#' x3p_inner_impute <- x3p_impute(x3p_inner_nomiss_res, ifsave = FALSE, dir_name = NULL, ifplot = TRUE)
#'
#' x3p_quantile_angle_vec(x3p_inner_impute, min_score_cut = 0.1, ifplot = TRUE)
#'
#'
x3p_quantile_angle_vec <- function(x3p, ntheta = 720, min_score_cut = 0.1,
ifplot = FALSE) {
theta <-
Expand Down
9 changes: 3 additions & 6 deletions R/x3p_raw_sig_vec.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,12 @@
#' @importFrom stats na.omit median
#' @export
#' @examples
#' x3p <- x3p_subsamples[[1]]
#' mask_col <- "#FF0000"
#' concavity <- 1.5
#'
#' insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = mask_col, concavity = concavity, b = 1)
#' x3p <- x3p_subsamples[[2]]
#' insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = "#FF0000", concavity = 1.5, b = 1)
#' x3p_inner_nomiss_res <- df_rmtrend_x3p(insidepoly_df)
#' x3p_inner_impute <- x3p_impute(x3p_inner_nomiss_res, ifsave = FALSE, dir_name = NULL, ifplot = TRUE)
#'
#' x3p_bin_rotate <- x3p_vertical(x3p_inner_impute, min_score_cut = 0.1)
#'
#' x3p_raw_sig_vec(x3p_bin_rotate, ifplot = TRUE) %>%
#' str()
#'
Expand Down
8 changes: 3 additions & 5 deletions R/x3p_shift_sig_vec.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,13 @@
#' @importFrom tidyr nest unnest
#' @export
#' @examples
#' x3p <- x3p_subsamples[[1]]
#' mask_col <- "#FF0000"
#' concavity <- 1.5
#' x3p <- x3p_subsamples[[2]]
#'
#' insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = mask_col, concavity = concavity, b = 1)
#' insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = "#FF0000", concavity = 1.5, b = 1)
#' x3p_inner_nomiss_res <- df_rmtrend_x3p(insidepoly_df)
#' x3p_inner_impute <- x3p_impute(x3p_inner_nomiss_res, ifsave = FALSE, dir_name = NULL, ifplot = TRUE)
#'
#' x3p_bin_rotate <- x3p_vertical(x3p_inner_impute, min_score_cut = 0.1)
#'
#' if (interactive()) {
#' x3p_shift_sig_vec(x3p_bin_rotate, ifplot = TRUE) %>%
#' str()
Expand Down
1 change: 1 addition & 0 deletions R/x3p_surface_polygon.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#' x3p <- x3p %>% x3p_surface_polygon(sample=1)
#' x3p_image(x3p, size = dim(x3p$surface.matrix), zoom=.6)
#' }
#'
x3p_surface_polygon <- function(x3p, colour = "red", sample = 10, center = NULL, concavity = 1.5) {
stopifnot("x3p" %in% class(x3p), is.numeric(concavity), concavity > 0)

Expand Down
5 changes: 1 addition & 4 deletions R/x3p_vertical.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,13 @@
#' @export
#' @examples
#' x3p <- x3p_subsamples[[1]]
#' mask_col <- "#FF0000"
#' concavity <- 1.5
#'
#' insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = mask_col, concavity = concavity, b = 1)
#' insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = "#FF0000", concavity = 1.5, b = 1)
#' x3p_inner_nomiss_res <- df_rmtrend_x3p(insidepoly_df)
#' x3p_inner_impute <- x3p_impute(x3p_inner_nomiss_res, ifsave = FALSE, dir_name = NULL, ifplot = TRUE)
#'
#' x3p_bin_rotate <- x3p_vertical(x3p_inner_impute, min_score_cut = 0.1, ifplot = TRUE)
#' x3p_bin_rotate
#'
#' if (interactive()) {
#' x3p_image_autosize(x3p_bin_rotate)
#' }
Expand Down
8 changes: 2 additions & 6 deletions man/df_rmtrend_x3p.Rd

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

7 changes: 2 additions & 5 deletions man/vec_align_sigs_list.Rd

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

6 changes: 1 addition & 5 deletions man/x3p_MLE_angle_vec.Rd

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

6 changes: 1 addition & 5 deletions man/x3p_impute.Rd

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

12 changes: 9 additions & 3 deletions man/x3p_insidepoly_df.Rd

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

6 changes: 1 addition & 5 deletions man/x3p_quantile_angle_vec.Rd

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

9 changes: 3 additions & 6 deletions man/x3p_raw_sig_vec.Rd

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

8 changes: 3 additions & 5 deletions man/x3p_shift_sig_vec.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/x3p_surface_polygon.Rd

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

5 changes: 1 addition & 4 deletions man/x3p_vertical.Rd

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

0 comments on commit ae02882

Please sign in to comment.