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
library(tidyverse) | |
library(tidytext) | |
library(wordcloud) | |
library(reshape2) | |
library(tidygraph) | |
library(ggraph) | |
gdpr_text <- readr::read_tsv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2020/2020-04-21/gdpr_text.tsv') | |
#base on https://www.tidytextmining.com/sentiment.html |
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
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
pmId | |
23552565 | |
26655164 | |
26077880 | |
26164471 | |
25135986 | |
24978892 | |
24467976 | |
24180712 |
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
######################################################### | |
#### CAPTURE ABSTRACTS FROM PMIDs & MAKE A WORDCLOUD #### | |
######################################################### | |
# GNU-GPL license | |
# Author: Mareviv (https://talesofr.wordpress.com) | |
# Script to retrieve and mine abstracts from PubMed (http://www.ncbi.nlm.nih.gov/pubmed) | |
# Uses the function ReadPubMed from the package RefManageR. It reads the PubMed API similarly to the search engine in PubMed's page. | |
# This script creates two directories in your working directory: 'corpus1' for the abstracts file, and 'wordcloud' to store the plot. |
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
# server.R | |
shinyServer(function(input, output) { | |
f <- function(seed, ncases, branches){ | |
set.seed(seed) | |
branch <- branches | |
if(branch==2){ # table creation | |
rond1 <- round(ncases/2, 0) | |
rond2 <- ncases-rond1 |
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 is a Sweave template from TalesofR.wordpress.com. | |
% When a line is preceeded by a "%" sign, it will be ignored by the program. | |
% You can write what you want in this way. It usually serves for making invisible comments. | |
% If you want to make a comment inside the chunk of R code, the symbol to start the line must be "#", instead of "%" | |
% Let's start with the template: | |
\documentclass{article} | |
\begin{document} | |
% chunks of R code are initiated by "<>=", and ended by "@" |
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
################################ | |
### 1. FORMULA SAMUELS CALC #### | |
####### NCMIN-HAPLOGROUPS ###### | |
################################ | |
# Under GPL license | |
# AUTHOR: A. Baluja | |
# Original formulae in Samuels et al., AJHG 2006, PMC1424681. Written in R by A. Baluja. |
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
#under GNU General Public License | |
#server.R | |
library(shiny) | |
library(pwr) | |
shinyServer(function(input, output) { | |
## My pwr function: | |
f <- function(eff.size, n.observs, degfree, signif) { |
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
###################################### | |
### DOWNLOAD JOURNAL ABBREVIATIONS ### | |
###################################### | |
# URL: ftp://ftp.ncbi.nih.gov/pubmed/J_Medline.txt | |
cit <- read.csv("ftp://ftp.ncbi.nih.gov/pubmed/J_Medline.txt", quote = "", sep = "\t", row.names = NULL, stringsAsFactors = FALSE) | |
# Tidy the original data and create data.frame | |
names(cit)[1] <- "X" |
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
#################################### | |
### DOWNLOAD IMPACT FACTORS 2014 ### | |
#################################### | |
# url: http://www.citefactor.org/journal-impact-factor-list-2014.html | |
# download lots of tables, then join them | |
# tabs <- getURL(url) | |
# tabs <- readHTMLTable(tabs, stringsAsFactors = F) | |
library(RCurl) |
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
ReadPubMed <- function (query, database = "PubMed", ...) | |
{ | |
.params <- list(...) | |
bad.ind <- which(!names(.params) %in% c("usehistory", "WebEnv", | |
"query_key", "retstart", "retmax", "field", "datetype", | |
"reldate", "mindate", "maxdate")) | |
.parms <- .params | |
if (length(bad.ind)) { | |
warning("Invalid .params specified and will be ignored") | |
.parms <- .parms[-bad.ind] |
NewerOlder