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) | |
# Plot 1: Sentiment wordcloud. | |
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
% 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
######################################################### | |
#### CAPTURE ARTICLE INFO, IMPACT FACTORS FROM PMIDs #### | |
######################################################### | |
# Script to retrieve and organise publications data 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. | |
# First, automagically install needed libraries: | |
list.of.packages <- c("RCurl", "RefManageR", "devtools", "plyr", "XML", "data.table") | |
new.packages <- list.of.packages[!(list.of.packages %in% installed.packages()[,"Package"])] |
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
################################################ | |
## Functions for derivatives of GAM(M) models ## | |
################################################ | |
Deriv <- function(mod, n = 200, eps = 1e-7, newdata, term) { | |
if(inherits(mod, "gamm")) | |
mod <- mod$gam | |
m.terms <- attr(terms(mod), "term.labels") | |
if(missing(newdata)) { | |
newD <- sapply(model.frame(mod)[, m.terms, drop = FALSE], | |
function(x) seq(min(x), max(x), length = n)) |
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
cSplit <- function(indt, splitCols, sep = ",", direction = "wide", | |
makeEqual = NULL, fixed = TRUE, drop = TRUE, | |
stripWhite = FALSE) { | |
message("`cSplit` is now part of the 'splitstackshape' package (V1.4.0)") | |
## requires data.table >= 1.8.11 | |
require(data.table) | |
if (!is.data.table(indt)) setDT(indt) | |
if (is.numeric(splitCols)) splitCols <- names(indt)[splitCols] | |
if (any(!vapply(indt[, splitCols, with = FALSE], | |
is.character, logical(1L)))) { |
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(ggplot2) | |
shinyServer(function(input, output) { | |
## My function: | |
f <- function(min.cases, max.cases, p0, OR.cas.ctrl, Nh, sig.level) { |
NewerOlder