From 102aa9d09f377ba1a3051caf387a84d36bd17c34 Mon Sep 17 00:00:00 2001 From: Bai Li Date: Thu, 19 Oct 2023 16:51:43 -0400 Subject: [PATCH] reoganize files --- .../TextAnalysis}/top10_analysis.R | 16 ++++++++-------- .../TextAnalysis}/top10_barplot_mean.jpg | Bin .../TextAnalysis}/top10_barplot_sum.jpg | Bin .../TextAnalysis}/top10_frequency.csv | 0 .../TextAnalysis}/top10_presence.csv | 0 .../TextAnalysis}/top10_proportion.csv | 0 .../TextAnalysis}/top20_analysis.R | 18 +++++++++--------- .../TextAnalysis}/top20_barplot_All.jpg | Bin .../TextAnalysis}/top20_barplot_Australia.jpg | Bin .../TextAnalysis}/top20_barplot_ICES.jpg | Bin .../TextAnalysis}/top20_barplot_NOAA.jpg | Bin .../TextAnalysis}/top20_frequency_All.csv | 0 .../top20_frequency_Australia.csv | 0 .../TextAnalysis}/top20_frequency_ICES.csv | 0 .../TextAnalysis}/top20_frequency_NOAA.csv | 0 .../TextAnalysis}/top20_presence_All.csv | 0 .../TextAnalysis}/top20_presence_All.jpg | Bin .../top20_presence_Australia.csv | 0 .../top20_presence_Australia.jpg | Bin .../TextAnalysis}/top20_presence_ICES.csv | 0 .../TextAnalysis}/top20_presence_ICES.jpg | Bin .../TextAnalysis}/top20_presence_NOAA.csv | 0 .../TextAnalysis}/top20_presence_NOAA.jpg | Bin .../TextAnalysis}/top20_proportion_All.csv | 0 .../top20_proportion_Australia.csv | 0 .../TextAnalysis}/top20_proportion_ICES.csv | 0 .../TextAnalysis}/top20_proportion_NOAA.csv | 0 .../TextAnalysis}/top20_wordcloud_All.jpg | Bin .../top20_wordcloud_Australia.jpg | Bin .../TextAnalysis}/top20_wordcloud_ICES.jpg | Bin .../TextAnalysis}/top20_wordcloud_NOAA.jpg | Bin {TextAnalysis => inst/TextAnalysis}/tree.txt | Bin emltest.R => inst/examples/emltest.R | 0 example.R => inst/examples/example.R | 0 test.R => inst/examples/test.R | 0 text_mining.R => inst/examples/text_mining.R | 0 _pkgdown.yml => pkgdown/_pkgdown.yml | 1 + extra.css => pkgdown/extra.css | 0 38 files changed, 18 insertions(+), 17 deletions(-) rename {TextAnalysis => inst/TextAnalysis}/top10_analysis.R (89%) rename {TextAnalysis => inst/TextAnalysis}/top10_barplot_mean.jpg (100%) rename {TextAnalysis => inst/TextAnalysis}/top10_barplot_sum.jpg (100%) rename {TextAnalysis => inst/TextAnalysis}/top10_frequency.csv (100%) rename {TextAnalysis => inst/TextAnalysis}/top10_presence.csv (100%) rename {TextAnalysis => inst/TextAnalysis}/top10_proportion.csv (100%) rename {TextAnalysis => inst/TextAnalysis}/top20_analysis.R (88%) rename {TextAnalysis => inst/TextAnalysis}/top20_barplot_All.jpg (100%) rename {TextAnalysis => inst/TextAnalysis}/top20_barplot_Australia.jpg (100%) rename {TextAnalysis => inst/TextAnalysis}/top20_barplot_ICES.jpg (100%) rename {TextAnalysis => inst/TextAnalysis}/top20_barplot_NOAA.jpg (100%) rename {TextAnalysis => inst/TextAnalysis}/top20_frequency_All.csv (100%) rename {TextAnalysis => inst/TextAnalysis}/top20_frequency_Australia.csv (100%) rename {TextAnalysis => inst/TextAnalysis}/top20_frequency_ICES.csv (100%) rename {TextAnalysis => inst/TextAnalysis}/top20_frequency_NOAA.csv (100%) rename {TextAnalysis => inst/TextAnalysis}/top20_presence_All.csv (100%) rename {TextAnalysis => inst/TextAnalysis}/top20_presence_All.jpg (100%) rename {TextAnalysis => inst/TextAnalysis}/top20_presence_Australia.csv (100%) rename {TextAnalysis => inst/TextAnalysis}/top20_presence_Australia.jpg (100%) rename {TextAnalysis => inst/TextAnalysis}/top20_presence_ICES.csv (100%) rename {TextAnalysis => inst/TextAnalysis}/top20_presence_ICES.jpg (100%) rename {TextAnalysis => inst/TextAnalysis}/top20_presence_NOAA.csv (100%) rename {TextAnalysis => inst/TextAnalysis}/top20_presence_NOAA.jpg (100%) rename {TextAnalysis => inst/TextAnalysis}/top20_proportion_All.csv (100%) rename {TextAnalysis => inst/TextAnalysis}/top20_proportion_Australia.csv (100%) rename {TextAnalysis => inst/TextAnalysis}/top20_proportion_ICES.csv (100%) rename {TextAnalysis => inst/TextAnalysis}/top20_proportion_NOAA.csv (100%) rename {TextAnalysis => inst/TextAnalysis}/top20_wordcloud_All.jpg (100%) rename {TextAnalysis => inst/TextAnalysis}/top20_wordcloud_Australia.jpg (100%) rename {TextAnalysis => inst/TextAnalysis}/top20_wordcloud_ICES.jpg (100%) rename {TextAnalysis => inst/TextAnalysis}/top20_wordcloud_NOAA.jpg (100%) rename {TextAnalysis => inst/TextAnalysis}/tree.txt (100%) rename emltest.R => inst/examples/emltest.R (100%) rename example.R => inst/examples/example.R (100%) rename test.R => inst/examples/test.R (100%) rename text_mining.R => inst/examples/text_mining.R (100%) rename _pkgdown.yml => pkgdown/_pkgdown.yml (98%) rename extra.css => pkgdown/extra.css (100%) diff --git a/TextAnalysis/top10_analysis.R b/inst/TextAnalysis/top10_analysis.R similarity index 89% rename from TextAnalysis/top10_analysis.R rename to inst/TextAnalysis/top10_analysis.R index 26aa218..c49d4cf 100644 --- a/TextAnalysis/top10_analysis.R +++ b/inst/TextAnalysis/top10_analysis.R @@ -214,9 +214,9 @@ proportion_database <- rbind( ) proportion_database[nrow(proportion_database), "ID"] <- "Sum" -write.csv(frequency_database, file=here::here("TextAnalysis", "top10_frequency.csv"), row.names=FALSE) -write.csv(presence_database, file=here::here("TextAnalysis", "top10_presence.csv"), row.names=FALSE) -write.csv(proportion_database, file=here::here("TextAnalysis", "top10_proportion.csv"), row.names=FALSE) +write.csv(frequency_database, file=here::here("inst", "TextAnalysis", "top10_frequency.csv"), row.names=FALSE) +write.csv(presence_database, file=here::here("inst", "TextAnalysis", "top10_presence.csv"), row.names=FALSE) +write.csv(proportion_database, file=here::here("inst","TextAnalysis", "top10_proportion.csv"), row.names=FALSE) # Upload xlsx to Google Drive authorize_GoogleDrive <- FALSE @@ -227,9 +227,9 @@ if (authorize_GoogleDrive) { } # Plot results ------------------------------------------------------------ -frequency_database <- read.csv(file=here::here("TextAnalysis", "top10_frequency.csv")) -presence_database<-read.csv(file=here::here("TextAnalysis", "top10_presence.csv")) -proportion_database<-read.csv(file=here::here("TextAnalysis", "top10_proportion.csv")) +frequency_database <- read.csv(file=here::here("inst", "TextAnalysis", "top10_frequency.csv")) +presence_database<-read.csv(file=here::here("inst", "TextAnalysis", "top10_presence.csv")) +proportion_database<-read.csv(file=here::here("inst", "TextAnalysis", "top10_proportion.csv")) colnames(presence_database) <- col_name data_reshape <- reshape2::melt( @@ -244,7 +244,7 @@ sum_by_group <- aggregate(value ~ keyword+keyword_id+group+Source, data = data_m sum_by_group <- sum_by_group[order(sum_by_group$keyword_id),] group <- unique(sum_by_group$group) -jpeg(filename = here::here("TextAnalysis", "top10_barplot_sum.jpg"), width=200, height=150, units="mm", res=1200) +jpeg(filename = here::here("inst", "TextAnalysis", "top10_barplot_sum.jpg"), width=200, height=150, units="mm", res=1200) ggplot(sum_by_group, aes(fill=Source, y=value, x=keyword_id)) + geom_bar(position="dodge", stat="identity") + facet_wrap(~group, scales = "free_x") + @@ -260,7 +260,7 @@ mean_by_group <- aggregate(value ~ keyword+keyword_id+group+Source, data = data_ mean_by_group <- mean_by_group[order(mean_by_group$keyword_id),] group <- unique(mean_by_group$group) -jpeg(filename = here::here("TextAnalysis", "top10_barplot_mean.jpg"), width=200, height=150, units="mm", res=1200) +jpeg(filename = here::here("inst", "TextAnalysis", "top10_barplot_mean.jpg"), width=200, height=150, units="mm", res=1200) ggplot(mean_by_group, aes(fill=Source, y=value*100, x=keyword_id)) + geom_bar(position="dodge", stat="identity") + facet_wrap(~group, scales = "free_x") + diff --git a/TextAnalysis/top10_barplot_mean.jpg b/inst/TextAnalysis/top10_barplot_mean.jpg similarity index 100% rename from TextAnalysis/top10_barplot_mean.jpg rename to inst/TextAnalysis/top10_barplot_mean.jpg diff --git a/TextAnalysis/top10_barplot_sum.jpg b/inst/TextAnalysis/top10_barplot_sum.jpg similarity index 100% rename from TextAnalysis/top10_barplot_sum.jpg rename to inst/TextAnalysis/top10_barplot_sum.jpg diff --git a/TextAnalysis/top10_frequency.csv b/inst/TextAnalysis/top10_frequency.csv similarity index 100% rename from TextAnalysis/top10_frequency.csv rename to inst/TextAnalysis/top10_frequency.csv diff --git a/TextAnalysis/top10_presence.csv b/inst/TextAnalysis/top10_presence.csv similarity index 100% rename from TextAnalysis/top10_presence.csv rename to inst/TextAnalysis/top10_presence.csv diff --git a/TextAnalysis/top10_proportion.csv b/inst/TextAnalysis/top10_proportion.csv similarity index 100% rename from TextAnalysis/top10_proportion.csv rename to inst/TextAnalysis/top10_proportion.csv diff --git a/TextAnalysis/top20_analysis.R b/inst/TextAnalysis/top20_analysis.R similarity index 88% rename from TextAnalysis/top20_analysis.R rename to inst/TextAnalysis/top20_analysis.R index eb2a6c8..43cb3d1 100644 --- a/TextAnalysis/top20_analysis.R +++ b/inst/TextAnalysis/top20_analysis.R @@ -223,9 +223,9 @@ for (org in seq_along(subfolder_info)){ ) proportion_database[nrow(proportion_database), "ID"] <- "Sum" - write.csv(frequency_database, file=here::here("TextAnalysis", paste0("top20_frequency_", names(subfolder_info)[org], ".csv")), row.names=FALSE) - write.csv(presence_database, file=here::here("TextAnalysis", paste0("top20_presence_", names(subfolder_info)[org], ".csv")), row.names=FALSE) - write.csv(proportion_database, file=here::here("TextAnalysis", paste0("top20_proportion_", names(subfolder_info)[org], ".csv")), row.names=FALSE) + write.csv(frequency_database, file=here::here("inst", "TextAnalysis", paste0("top20_frequency_", names(subfolder_info)[org], ".csv")), row.names=FALSE) + write.csv(presence_database, file=here::here("inst", "TextAnalysis", paste0("top20_presence_", names(subfolder_info)[org], ".csv")), row.names=FALSE) + write.csv(proportion_database, file=here::here("inst", "TextAnalysis", paste0("top20_proportion_", names(subfolder_info)[org], ".csv")), row.names=FALSE) # Upload xlsx to Google Drive if (authorize_GoogleDrive) { # Google Drive folder id @@ -234,9 +234,9 @@ for (org in seq_along(subfolder_info)){ } # Plot results ------------------------------------------------------------ - frequency_database <- read.csv(file=here::here("TextAnalysis", paste0("top20_frequency_", names(subfolder_info)[org], ".csv"))) - presence_database<-read.csv(file=here::here("TextAnalysis", paste0("top20_presence_", names(subfolder_info)[org], ".csv"))) - proportion_database<-read.csv(file=here::here("TextAnalysis", paste0("top20_proportion_", names(subfolder_info)[org], ".csv"))) + frequency_database <- read.csv(file=here::here("inst", "TextAnalysis", paste0("top20_frequency_", names(subfolder_info)[org], ".csv"))) + presence_database<-read.csv(file=here::here("inst", "TextAnalysis", paste0("top20_presence_", names(subfolder_info)[org], ".csv"))) + proportion_database<-read.csv(file=here::here("inst", "TextAnalysis", paste0("top20_proportion_", names(subfolder_info)[org], ".csv"))) word_frequency <- as.matrix(frequency_database[frequency_database$ID == "Sum", 4:ncol(frequency_database)]) word_presence <- as.matrix(presence_database[presence_database$ID == "Sum", 4:ncol(presence_database)]) @@ -266,7 +266,7 @@ for (org in seq_along(subfolder_info)){ ) # barplot - jpeg(filename = here::here("TextAnalysis", paste0("top20_barplot_", names(subfolder_info)[org], ".jpg")), width = 200, height = 120, units = "mm", res = 1200) + jpeg(filename = here::here("inst", "TextAnalysis", paste0("top20_barplot_", names(subfolder_info)[org], ".jpg")), width = 200, height = 120, units = "mm", res = 1200) par(mar = c(6, 4, 1, 1), mfrow = c(3, 1)) frequency_barplot <- barplot(height = word_frequency, xaxt = "n", ylab = "Frequency") text(frequency_barplot - 0.25, par("usr")[3] - 0.25, xlabels, xpd = TRUE, srt = 40, adj = 1, cex = 0.8) @@ -280,14 +280,14 @@ for (org in seq_along(subfolder_info)){ dev.off() - jpeg(filename = here::here("TextAnalysis", paste0("top20_presence_", names(subfolder_info)[org], ".jpg")), width = 200, height = 120, units = "mm", res = 1200) + jpeg(filename = here::here("inst", "TextAnalysis", paste0("top20_presence_", names(subfolder_info)[org], ".jpg")), width = 200, height = 120, units = "mm", res = 1200) par(mar = c(6, 4, 1, 1), mfrow = c(1, 1)) presence_barplot <- barplot(height = word_presence, xaxt = "n", ylab = "Frequency") # range: 26-83, median:68 text(presence_barplot - 0.25, par("usr")[3] - 0.25, xlabels, xpd = TRUE, srt = 40, adj = 1, cex = 0.7) dev.off() # wordcloud figure - jpeg(filename = here::here("TextAnalysis", paste0("top20_wordcloud_", names(subfolder_info)[org], ".jpg")), width = 200, height = 200, units = "mm", res = 1200) + jpeg(filename = here::here("inst", "TextAnalysis", paste0("top20_wordcloud_", names(subfolder_info)[org], ".jpg")), width = 200, height = 200, units = "mm", res = 1200) par(mar = c(1, 1, 1, 1), mfrow = c(1, 1)) wordcloud( words = xlabels, freq = word_presence, rot.per = 0.35, diff --git a/TextAnalysis/top20_barplot_All.jpg b/inst/TextAnalysis/top20_barplot_All.jpg similarity index 100% rename from TextAnalysis/top20_barplot_All.jpg rename to inst/TextAnalysis/top20_barplot_All.jpg diff --git a/TextAnalysis/top20_barplot_Australia.jpg b/inst/TextAnalysis/top20_barplot_Australia.jpg similarity index 100% rename from TextAnalysis/top20_barplot_Australia.jpg rename to inst/TextAnalysis/top20_barplot_Australia.jpg diff --git a/TextAnalysis/top20_barplot_ICES.jpg b/inst/TextAnalysis/top20_barplot_ICES.jpg similarity index 100% rename from TextAnalysis/top20_barplot_ICES.jpg rename to inst/TextAnalysis/top20_barplot_ICES.jpg diff --git a/TextAnalysis/top20_barplot_NOAA.jpg b/inst/TextAnalysis/top20_barplot_NOAA.jpg similarity index 100% rename from TextAnalysis/top20_barplot_NOAA.jpg rename to inst/TextAnalysis/top20_barplot_NOAA.jpg diff --git a/TextAnalysis/top20_frequency_All.csv b/inst/TextAnalysis/top20_frequency_All.csv similarity index 100% rename from TextAnalysis/top20_frequency_All.csv rename to inst/TextAnalysis/top20_frequency_All.csv diff --git a/TextAnalysis/top20_frequency_Australia.csv b/inst/TextAnalysis/top20_frequency_Australia.csv similarity index 100% rename from TextAnalysis/top20_frequency_Australia.csv rename to inst/TextAnalysis/top20_frequency_Australia.csv diff --git a/TextAnalysis/top20_frequency_ICES.csv b/inst/TextAnalysis/top20_frequency_ICES.csv similarity index 100% rename from TextAnalysis/top20_frequency_ICES.csv rename to inst/TextAnalysis/top20_frequency_ICES.csv diff --git a/TextAnalysis/top20_frequency_NOAA.csv b/inst/TextAnalysis/top20_frequency_NOAA.csv similarity index 100% rename from TextAnalysis/top20_frequency_NOAA.csv rename to inst/TextAnalysis/top20_frequency_NOAA.csv diff --git a/TextAnalysis/top20_presence_All.csv b/inst/TextAnalysis/top20_presence_All.csv similarity index 100% rename from TextAnalysis/top20_presence_All.csv rename to inst/TextAnalysis/top20_presence_All.csv diff --git a/TextAnalysis/top20_presence_All.jpg b/inst/TextAnalysis/top20_presence_All.jpg similarity index 100% rename from TextAnalysis/top20_presence_All.jpg rename to inst/TextAnalysis/top20_presence_All.jpg diff --git a/TextAnalysis/top20_presence_Australia.csv b/inst/TextAnalysis/top20_presence_Australia.csv similarity index 100% rename from TextAnalysis/top20_presence_Australia.csv rename to inst/TextAnalysis/top20_presence_Australia.csv diff --git a/TextAnalysis/top20_presence_Australia.jpg b/inst/TextAnalysis/top20_presence_Australia.jpg similarity index 100% rename from TextAnalysis/top20_presence_Australia.jpg rename to inst/TextAnalysis/top20_presence_Australia.jpg diff --git a/TextAnalysis/top20_presence_ICES.csv b/inst/TextAnalysis/top20_presence_ICES.csv similarity index 100% rename from TextAnalysis/top20_presence_ICES.csv rename to inst/TextAnalysis/top20_presence_ICES.csv diff --git a/TextAnalysis/top20_presence_ICES.jpg b/inst/TextAnalysis/top20_presence_ICES.jpg similarity index 100% rename from TextAnalysis/top20_presence_ICES.jpg rename to inst/TextAnalysis/top20_presence_ICES.jpg diff --git a/TextAnalysis/top20_presence_NOAA.csv b/inst/TextAnalysis/top20_presence_NOAA.csv similarity index 100% rename from TextAnalysis/top20_presence_NOAA.csv rename to inst/TextAnalysis/top20_presence_NOAA.csv diff --git a/TextAnalysis/top20_presence_NOAA.jpg b/inst/TextAnalysis/top20_presence_NOAA.jpg similarity index 100% rename from TextAnalysis/top20_presence_NOAA.jpg rename to inst/TextAnalysis/top20_presence_NOAA.jpg diff --git a/TextAnalysis/top20_proportion_All.csv b/inst/TextAnalysis/top20_proportion_All.csv similarity index 100% rename from TextAnalysis/top20_proportion_All.csv rename to inst/TextAnalysis/top20_proportion_All.csv diff --git a/TextAnalysis/top20_proportion_Australia.csv b/inst/TextAnalysis/top20_proportion_Australia.csv similarity index 100% rename from TextAnalysis/top20_proportion_Australia.csv rename to inst/TextAnalysis/top20_proportion_Australia.csv diff --git a/TextAnalysis/top20_proportion_ICES.csv b/inst/TextAnalysis/top20_proportion_ICES.csv similarity index 100% rename from TextAnalysis/top20_proportion_ICES.csv rename to inst/TextAnalysis/top20_proportion_ICES.csv diff --git a/TextAnalysis/top20_proportion_NOAA.csv b/inst/TextAnalysis/top20_proportion_NOAA.csv similarity index 100% rename from TextAnalysis/top20_proportion_NOAA.csv rename to inst/TextAnalysis/top20_proportion_NOAA.csv diff --git a/TextAnalysis/top20_wordcloud_All.jpg b/inst/TextAnalysis/top20_wordcloud_All.jpg similarity index 100% rename from TextAnalysis/top20_wordcloud_All.jpg rename to inst/TextAnalysis/top20_wordcloud_All.jpg diff --git a/TextAnalysis/top20_wordcloud_Australia.jpg b/inst/TextAnalysis/top20_wordcloud_Australia.jpg similarity index 100% rename from TextAnalysis/top20_wordcloud_Australia.jpg rename to inst/TextAnalysis/top20_wordcloud_Australia.jpg diff --git a/TextAnalysis/top20_wordcloud_ICES.jpg b/inst/TextAnalysis/top20_wordcloud_ICES.jpg similarity index 100% rename from TextAnalysis/top20_wordcloud_ICES.jpg rename to inst/TextAnalysis/top20_wordcloud_ICES.jpg diff --git a/TextAnalysis/top20_wordcloud_NOAA.jpg b/inst/TextAnalysis/top20_wordcloud_NOAA.jpg similarity index 100% rename from TextAnalysis/top20_wordcloud_NOAA.jpg rename to inst/TextAnalysis/top20_wordcloud_NOAA.jpg diff --git a/TextAnalysis/tree.txt b/inst/TextAnalysis/tree.txt similarity index 100% rename from TextAnalysis/tree.txt rename to inst/TextAnalysis/tree.txt diff --git a/emltest.R b/inst/examples/emltest.R similarity index 100% rename from emltest.R rename to inst/examples/emltest.R diff --git a/example.R b/inst/examples/example.R similarity index 100% rename from example.R rename to inst/examples/example.R diff --git a/test.R b/inst/examples/test.R similarity index 100% rename from test.R rename to inst/examples/test.R diff --git a/text_mining.R b/inst/examples/text_mining.R similarity index 100% rename from text_mining.R rename to inst/examples/text_mining.R diff --git a/_pkgdown.yml b/pkgdown/_pkgdown.yml similarity index 98% rename from _pkgdown.yml rename to pkgdown/_pkgdown.yml index 8516f37..75045bc 100644 --- a/_pkgdown.yml +++ b/pkgdown/_pkgdown.yml @@ -33,6 +33,7 @@ reference: - read_in - shiny_dd - validate_Rd + - make_hex navbar: diff --git a/extra.css b/pkgdown/extra.css similarity index 100% rename from extra.css rename to pkgdown/extra.css