<jupyter_start><jupyter_text>Goal: time series binned analysis to check how open access trends have changed over the years.We need to get a .yml file for quick setup<jupyter_code>library(tidyverse)
library(plotly)
library(lubridate)
library(DT)
df <- read_csv('../Data/PMID_PMC_Journal_Year.csv')
head(df)
#df <- df[-1]
head(df)
glimpse(df)
df$year <- ymd(df$date) 
df$year <- arrange(df, date)
df$journal <- factor(df$journal)
str(df)
# count the number of missing values in the column pmd
# This means from the paper could not be downloaded: How many fall in this category

sum(is.na(df$pmcid))<jupyter_output><empty_output><jupyter_text>18530 papers could not be downloaded. If we subtract from the numbers of rows we have 25,256 - 18551 you get 6705 publications remain.<jupyter_code># counting the number of publications per journal since the 1970's
# This dataset needs additional cleaning to ensure each row is in the right place
ggplot(df, aes(sort(table(df$journal),decreasing = TRUE)) + geom_bar() 
# draw a plot to show trend of open access trends through the years
# the data is a lot we could combine groupby and count to remedy the situation

yearly_count_df <- df %>% group_by(date, pmcid) %>% filter(date > 1963) %>% summarize(n_pmd = n())

head(yearly_count_df)
tail(yearly_count_df)
names(yearly_count_df)
str(yearly_count_df)
yearly_count_df2 <- yearly_count_df
head(yearly_count_df2)
yearly_count_df2  %>% group_by(date, pmcid, n_pmd)  %>% count(pmcid)  
p <- ggplot(yearly_count_df2, aes(ymd(date), pmcid)) + geom_point() 

p
names(df)
p2 <- ggplot(df, aes(isopen)) + geom_bar(fill = "black", col = "black") + 
labs(x = "Open access or not", title = "Closed access versus Open access",
y ="Open or closed access", caption = "closed 18530 and open 6713") + theme_classic()
p2
table(df$isopen)
p3 <- ggplot(df, aes(date, month, color = isopen)) + geom_point()

p3
library(trelliscopejs)
library(plotly)
ggplot(df, aes(date, month, color = isopen)) + geom_point() + facet_trelliscope(~ factor(pmcid))
# adding DT into the analysis to allow querying to find these particular dates

datatable(df)
sessionInfo()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11363636363636363, 'fraction_numerical': 0.020871985157699443, 'mean_word_length': 5.847619047619047, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '88868', 'license': 'CC-BY-4.0', 'n_tokens_mistral': 805, 'n_tokens_neox': 754, 'n_words': 239, 'path': 'Notebooks/data-import-visualization.ipynb', 'repo_name': 'BioinfoNet/data-mining', 'size': '2156'}