Skip to content

Instantly share code, notes, and snippets.

View aurora-mareviv's full-sized avatar

aurora-mareviv

View GitHub Profile
@aurora-mareviv
aurora-mareviv / EPStoPDFconverter.tex
Last active December 17, 2015 06:58
EPS to PDF converter!
%%%%%%%%%%%%%%%%%%%%%%%%
%% EPS TO PDF CONVERTER %%
%%%%%%%%%%%%%%%%%%%%%%%%
% Author: Mareviv
% Under GNU General Public License
% Paste this document entirely into a file with .TEX extension (.tex). Open it with TeXworks
% Tips for starting with LaTeX: http://talesofr.wordpress.com/2013/05/02/learning-latex-from-scratch/
\documentclass{article}
@aurora-mareviv
aurora-mareviv / Network.R
Last active December 17, 2015 06:58
Network graphs with igraph!
###########################################
### Network graphs using package igraph ###
###########################################
# Author: Aurora-Mareviv
# Under GNU General Public License
# Script not intended for running using source()
# Simple script that draws a network
library(igraph)
load("my_directory/my_file.rda")
@aurora-mareviv
aurora-mareviv / networkII.R
Last active December 17, 2015 07:08
Network graphs from adjacency matrix! (II)
#####################################################
### Network graphs from adjacency matrix - II part ##
#####################################################
# Author: Aurora-Mareviv
# Under GNU General Public License
# If we must construct an adjacency matrix:
# May be the cleanest way to plot links using igraph
# This Gist uses almost the same code as: https://gist.github.com/aurora-mareviv/5568957#file-gistfile1-r
# Paste and execute this simple code in a R console:
@aurora-mareviv
aurora-mareviv / server.R
Last active July 7, 2017 19:55
Power estimations in Mitochondrial DNA association studies: a Samuels et al. impementation (with Graph)
#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) {
@aurora-mareviv
aurora-mareviv / server.R
Last active December 19, 2015 04:49
Power estimations in Mitochondrial DNA association studies: a Samuels et al. impementation
#under GNU General Public License
#server.R
library(shiny)
library(ggplot2)
shinyServer(function(input, output) {
## My function:
f <- function(n.cases, p0, OR.cas.ctrl, Nh, sig.level) {
ncases <- n.cases
p0 <- p0
@aurora-mareviv
aurora-mareviv / RstartingCommands.R
Last active May 30, 2018 17:38
Small R scripts to learn R and basic statistics at the same time.
##########################################
### COMMANDS TO START WITH R CONSOLE 1 ###
##########################################
# Under GNU-GPL license v.3
# First, install R: http://cran.r-project.org/
# Second, install and open R-Studio: http://www.rstudio.com/ide/download/desktop
# You can open this text file from inside R-studio, or with a basic text editor (like Notepad).
# Just copy and paste the following commands, and press ENTER to see the results.
@aurora-mareviv
aurora-mareviv / RStartAndroid.R
Created September 30, 2014 22:35
Script to start playing with R on Android
###########################################
### COMMANDS TO START WITH R ON ANDROID ###
###########################################
# Under GNU-GPL license
# R in Android installed via the apps "GNURoot" and "GNURoot Wheezy", and sources.list updated with the newest CRAN repositories.
# I strongly recommend to set the working directory of R to a folder that can be accessed from Android such as /sdcard
setwd("/sdcard/R")
@aurora-mareviv
aurora-mareviv / pmidata.2.R
Last active September 22, 2016 23:10
PMIDs database, semi-automatized
#########################################################
#### 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"])]
@aurora-mareviv
aurora-mareviv / cSplit.R
Last active August 29, 2015 14:07 — forked from mrdwab/cSplit.R
cSplit <- function(indt, splitCols, sep = ",", direction = "wide",
makeEqual = NULL, fixed = TRUE, drop = TRUE,
stripWhite = FALSE) {
## 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)))) {
indt[, eval(splitCols) := lapply(.SD, as.character),
@aurora-mareviv
aurora-mareviv / ReadPubMed.R
Last active September 22, 2016 23:06
ReadPubMed modified function from RefManageR
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]