Skip to content

Instantly share code, notes, and snippets.

View oleon12's full-sized avatar

Omar Daniel Leon Alvarado oleon12

View GitHub Profile
library(ape)
library(phangorn)
##This is the tree who I'll want to calculate Vane-Wright index
##
tree <- read.tree("puranius.tre")
plot(tree)
##Now a read the table
##This table have terminal and the number of nodes who belong each terminal
@oleon12
oleon12 / GenBank.R
Last active August 29, 2015 14:21
Here I describe how to download DNA sequences from GenBank in R, using two types of data frames: 1. Without NA and 2. With NA.
#How to download sequences from GenBank
#
#leon.alvarado12@gmail.com
#######################################################################################
# Use a data without NA #
# #
#This function need a data frame with the two first columns calling Genera and Specie #
# #
#######################################################################################
@oleon12
oleon12 / toCharacter_toNumber.R
Last active August 29, 2015 14:21
If you need change numbers treat as characters in a data frame to numeric class, this function will be useful.
toNum <- function(x){
for (i in 1:length(x)){
matrix <- as.matrix(x)
x[,i] <- as.numeric(matrix[,i])
}
}
#At the end, all characters in the data frame will be numeric type variables.