Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit389d513

Browse files
committed
Updating vignette and code formatting
1 parent3ca9ceb commit389d513

File tree

50 files changed

+1157
-135
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1157
-135
lines changed

‎R/mod_evaluation.R‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ server_evaluation <- function(id, selected_data, clusters) {
3838
metric_results<- compute_metric(selected_data(),
3939
clusters(),
4040
input$evaluation_selected)
41-
validate(need(all(!is.na(metric_results)),"Metric not evaluated for current data"))
41+
validate(need(all(!is.na(metric_results)),
42+
"Metric not evaluated for current data"))
4243
optimal_k<- optimal_score(metric_results$score,
4344
method=input$evaluation_highlight)
4445

‎R/mod_gapstat.R‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ server_gapstat <- function(id, selected_data, clusters) {
4949
df<- selected_data()
5050
clustered_data<- clusters()
5151
})
52-
validate(need(input$gap_B>0,"Bootstrap samples must be greater than 0."))
52+
validate(need(input$gap_B>0,
53+
"Bootstrap samples must be greater than 0."))
5354
compute_gapstat(df,clustered_data,input$gap_B)
5455
})
5556

‎R/mod_pca.R‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ ui_pca <- function() {
55
splitLayout(
66
verticalLayout(
77
fluidRow(
8-
column(6,selectizeInput(ns("pca_xaxis"),label="X axis:",choices=NULL)),
9-
column(6,selectizeInput(ns("pca_yaxis"),label="Y axis:",choices=NULL))),
8+
column(6,selectizeInput(ns("pca_xaxis"),
9+
label="X axis:",choices=NULL)),
10+
column(6,selectizeInput(ns("pca_yaxis"),
11+
label="Y axis:",choices=NULL))),
1012
plotOutput(ns("pca_plot"),width="100%",height="400px")
1113
),
1214
plotOutput(ns("drivers_plot"),width="100%",height="auto"),
@@ -26,14 +28,17 @@ server_pca <- function(id, selected_data, cluster_labels, cluster_colors) {
2628
observeEvent(pca_data(), {
2729
pca_res<- pca_data()
2830
pca_dims<- colnames(pca_res$x)
29-
updateSelectizeInput(session,"pca_xaxis",choices=pca_dims,selected="PC1")
30-
updateSelectizeInput(session,"pca_yaxis",choices=pca_dims,selected="PC2")
31+
updateSelectizeInput(session,"pca_xaxis",
32+
choices=pca_dims,selected="PC1")
33+
updateSelectizeInput(session,"pca_yaxis",
34+
choices=pca_dims,selected="PC2")
3135
})
3236

3337
output$pca_plot<- renderPlot({
3438
req(input$pca_xaxis)
3539
req(input$pca_yaxis)
36-
pca_scatterplot(pca_data(), cluster_labels(),cluster_colors,input$pca_xaxis,input$pca_yaxis)
40+
pca_scatterplot(pca_data(), cluster_labels(),
41+
cluster_colors,input$pca_xaxis,input$pca_yaxis)
3742
})
3843

3944
output$drivers_plot<- renderPlot({

‎R/mod_significance.R‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ server_significance <- function(id, all_data, cluster_labels, cluster_colors,
5858
}
5959
else {
6060
all_df$Cluster<-clusters
61-
t_test_formula<-stats::as.formula(paste(input$signif_var," ~ Cluster"))
61+
t_test_formula<-
62+
stats::as.formula(paste(input$signif_var," ~ Cluster"))
6263
stats::t.test(t_test_formula,data=all_df)
6364
}
6465
})

‎R/mod_table.R‎

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -81,27 +81,6 @@ server_table <- function(id, all_data, selected_data, cluster_labels, nclusters)
8181
new_data(updated_data)
8282

8383
})
84-
# new_data <- eventReactive(input$remove_subjects, {
85-
# isolate({
86-
# all_df <- all_data()
87-
# })
88-
# browser()
89-
# remove_selected_rows(all_df,
90-
# cluster_labels(),
91-
# input$clusters_selection,
92-
# input$clusters_table_rows_selected)
93-
# # this updates all_data after removing rows
94-
# })
95-
#
96-
# new_data <- eventReactive(input$keep_subjects, {
97-
# isolate({
98-
# all_df <- all_data()
99-
# })
100-
# keep_selected_rows(all_df,
101-
# cluster_labels(),
102-
# input$clusters_selection)
103-
# })
104-
10584

10685
new_data
10786

‎R/plot.R‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ facet_boxplot <- function(df, x, y, facet_var = NULL,
2020
shape<- match.arg(shape)
2121
if (!x%in% colnames(df)) stop("x variable not found in data frame")
2222
if (!y%in% colnames(df)) stop("y variable not found in data frame")
23-
if (!is.null(facet_var)&& (!facet_var%in% colnames(df))) stop("facet_var variable not found in data frame")
23+
if (!is.null(facet_var)&& (!facet_var%in% colnames(df)))
24+
stop("facet_var variable not found in data frame")
2425
p<- ggplot(df, aes(x=.data[[x]],fill=.data[[x]]))+
2526
theme_bw()+
2627
theme(panel.grid.major.x= element_blank(),
@@ -60,7 +61,8 @@ facet_boxplot <- function(df, x, y, facet_var = NULL,
6061

6162
#' Plot boxplots with clusters
6263
#'
63-
#' This is a convenience wrapper function for `facet_boxplot()`. Combined with `annotate_clusters()`, it
64+
#' This is a convenience wrapper function for `facet_boxplot()`.
65+
#' Combined with `annotate_clusters()`, it
6466
#' doesn't require specifying axes in `facet_boxplot()`.
6567
#'
6668
#' @param annotated_data data frame returned by `annotate_clusters()`
@@ -111,7 +113,8 @@ line_plot <- function(df, x, y, xintercept = NULL) {
111113
#' @param cluster_colors a list of colors to match the cluster labels
112114
#'
113115
#' @noRd
114-
pca_scatterplot<-function(pcres,cluster_labels,cluster_colors,xdim="PC1",ydim="PC2") {
116+
pca_scatterplot<-
117+
function(pcres,cluster_labels,cluster_colors,xdim="PC1",ydim="PC2") {
115118
pc_df<- as.data.frame(pcres$x)
116119
var_explained<- round(pcres$sdev/ sum(pcres$sdev)*100,2)
117120
pc_labels<-stats::setNames(paste0(colnames(pc_df),

‎R/server.R‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ app_server <- function(input, output, session) {
7575

7676
# Update UI ----
7777
selected_numeric<- reactive({
78-
validate(need(!is.null(input$selected_numeric),"No features have been selected"))
78+
validate(need(!is.null(input$selected_numeric),
79+
"No features have been selected"))
7980
input$selected_numeric
8081
})
8182

@@ -118,8 +119,10 @@ app_server <- function(input, output, session) {
118119
})
119120

120121
scaled_data<- reactive({
121-
scaled_mat<- scale_data(selected_data(),input$scaling)
122-
isolate({ rownames(scaled_mat)<- all_data()$ID })
122+
if (input$distance_method!="Binary") {
123+
scaled_mat<- scale_data(selected_data(),input$scaling)
124+
isolate({ rownames(scaled_mat)<- all_data()$ID })
125+
}elsescaled_mat<- selected_data()
123126
scaled_mat
124127
})
125128

‎README.Rmd‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,7 @@ To run the app once the package is installed:
5353

5454
```{r example, eval = FALSE}
5555
library(visxhclust)
56+
# Increases max file size to 30 MB
57+
options(shiny.maxRequestSize = 30*1024^2
5658
run_app()
5759
```

‎README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,7 @@ To run the app once the package is installed:
7171

7272
```r
7373
library(visxhclust)
74+
# Increases max file size to 30 MB
75+
options(shiny.maxRequestSize=30*1024^2
7476
run_app()
7577
```

‎dev/dev_init.R‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
#usethis::use_vignette("visxhclust")
4242

4343
#usethis::use_testthat()
44-
usethis::use_github_actions()
44+
#usethis::use_github_actions()
4545

4646
devtools::document()
4747
pkgdown::build_site()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp