Skip to content

Instantly share code, notes, and snippets.

Avatar

Omar Daniel Leon Alvarado oleon12

View GitHub Profile
@oleon12
oleon12 / toCharacter_toNumber.R
Last active Aug 29, 2015
If you need change numbers treat as characters in a data frame to numeric class, this function will be useful.
View toCharacter_toNumber.R
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.
@oleon12
oleon12 / GenBank.R
Last active Aug 29, 2015
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.
View GenBank.R
#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 #
# #
#######################################################################################
View Vane_Wright_Index.R
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