Learn R Programming

BioGeoBEARS (version 0.2.1)

read_PHYLIP_data: Read a PHYLIP-format file

Description

This assumes data are interleaved, and that names are separated from data by a tab character; there is no 10-character limit on names.

Usage

read_PHYLIP_data(lgdata_fn = "lagrange_area_data_file.data", regionnames = NULL)

Arguments

lgdata_fn
The filename to read.
regionnames
A list of the names of the areas. Only used if the names are NOT specified in the file.

Value

tmpdf A data.frame containing the data.

Details

This function is a precursor to getranges_from_LagrangePHYLIP.

References

http://phylo.wikidot.com/matzke-2013-international-biogeography-society-poster

Matzke_2012_IBS

See Also

getranges_from_LagrangePHYLIP

Examples

Run this code
testval=1

# Get the example files directory
extdata_dir = np(system.file("extdata", package="BioGeoBEARS"))
# tmp hard code: extdata_dir = "/Dropbox/_njm/__packages/BioGeoBEARS_setup/inst/extdata/"
# Set the filename (Hawaiian Psychotria from Ree & Smith 2008)
fn = np(paste(extdata_dir, "/Psychotria_geog.data", sep=""))

# Read in the file
tmpdf = read_PHYLIP_data(lgdata_fn=fn, regionnames=NULL)
tmpdf

# Read in the file
tmpdf = read_PHYLIP_data(lgdata_fn=fn,
regionnames=c("Kauai", "Oahu", "Maui-Nui","Big Island"))
tmpdf	# Note that regionnames are only
# used if they are NOT specified in the file.
# But, you could put them on manually
names(tmpdf) = c("Kauai", "Oahu", "Maui-Nui","Big Island")
tmpdf

# This one has no area names
fn = np(paste(extdata_dir, "/Psychotria_geog_noAreaNames.data", sep=""))
tmpdf = read_PHYLIP_data(lgdata_fn=fn,
regionnames=c("Kauai", "Oahu", "Maui-Nui","Big Island"))
tmpdf	# Note that regionnames are only
# used if they are NOT specified in the file.

Run the code above in your browser using DataLab