read_PHYLIP_data: Read a PHYLIP-format file

Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/BioGeoBEARS_basics_v1.R

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

1
2
  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.

Details

This function is a precursor to getranges_from_LagrangePHYLIP.

Value

tmpdf A data.frame containing the data.

Note

Go BEARS!

Author(s)

Nicholas J. Matzke matzke@berkeley.edu

References

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

Matzke_2012_IBS

See Also

getranges_from_LagrangePHYLIP

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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.

Example output

Loading required package: rexpokit
Loading required package: cladoRcpp
Loading required package: ape
Loading required package: phylobase

Attaching package: 'phylobase'

The following object is masked from 'package:ape':

    edges

Read 6 items
Read 38 items
                         K O M H
P_mariniana_Kokee2       1 0 0 0
P_mariniana_Oahu         0 1 0 0
P_mariniana_MauiNui      0 0 1 0
P_hawaiiensis_Makaopuhi  0 0 0 1
P_wawraeDL7428           1 0 0 0
P_kaduana_PuuKukuiAS     0 0 1 0
P_mauiensis_PepeAS       0 0 1 0
P_hawaiiensis_WaikamoiL1 0 0 1 0
P_mauiensis_Eke          0 0 1 0
P_fauriei2               0 1 0 0
P_hathewayi_1            0 1 0 0
P_kaduana_HawaiiLoa      0 1 0 0
P_greenwelliae07         1 0 0 0
P_greenwelliae907        1 0 0 0
P_grandiflora_Kal2       1 0 0 0
P_hobdyi_Kuia            1 0 0 0
P_hexandra_K1            1 0 0 0
P_hexandra_M             1 0 0 0
P_hexandra_Oahu          0 1 0 0
Read 6 items
Read 38 items
                         K O M H
P_mariniana_Kokee2       1 0 0 0
P_mariniana_Oahu         0 1 0 0
P_mariniana_MauiNui      0 0 1 0
P_hawaiiensis_Makaopuhi  0 0 0 1
P_wawraeDL7428           1 0 0 0
P_kaduana_PuuKukuiAS     0 0 1 0
P_mauiensis_PepeAS       0 0 1 0
P_hawaiiensis_WaikamoiL1 0 0 1 0
P_mauiensis_Eke          0 0 1 0
P_fauriei2               0 1 0 0
P_hathewayi_1            0 1 0 0
P_kaduana_HawaiiLoa      0 1 0 0
P_greenwelliae07         1 0 0 0
P_greenwelliae907        1 0 0 0
P_grandiflora_Kal2       1 0 0 0
P_hobdyi_Kuia            1 0 0 0
P_hexandra_K1            1 0 0 0
P_hexandra_M             1 0 0 0
P_hexandra_Oahu          0 1 0 0
                         Kauai Oahu Maui-Nui Big Island
P_mariniana_Kokee2           1    0        0          0
P_mariniana_Oahu             0    1        0          0
P_mariniana_MauiNui          0    0        1          0
P_hawaiiensis_Makaopuhi      0    0        0          1
P_wawraeDL7428               1    0        0          0
P_kaduana_PuuKukuiAS         0    0        1          0
P_mauiensis_PepeAS           0    0        1          0
P_hawaiiensis_WaikamoiL1     0    0        1          0
P_mauiensis_Eke              0    0        1          0
P_fauriei2                   0    1        0          0
P_hathewayi_1                0    1        0          0
P_kaduana_HawaiiLoa          0    1        0          0
P_greenwelliae07             1    0        0          0
P_greenwelliae907            1    0        0          0
P_grandiflora_Kal2           1    0        0          0
P_hobdyi_Kuia                1    0        0          0
P_hexandra_K1                1    0        0          0
P_hexandra_M                 1    0        0          0
P_hexandra_Oahu              0    1        0          0
Read 2 items
Read 38 items
                         Kauai Oahu Maui-Nui Big Island
P_mariniana_Kokee2           1    0        0          0
P_mariniana_Oahu             0    1        0          0
P_mariniana_MauiNui          0    0        1          0
P_hawaiiensis_Makaopuhi      0    0        0          1
P_wawraeDL7428               1    0        0          0
P_kaduana_PuuKukuiAS         0    0        1          0
P_mauiensis_PepeAS           0    0        1          0
P_hawaiiensis_WaikamoiL1     0    0        1          0
P_mauiensis_Eke              0    0        1          0
P_fauriei2                   0    1        0          0
P_hathewayi_1                0    1        0          0
P_kaduana_HawaiiLoa          0    1        0          0
P_greenwelliae07             1    0        0          0
P_greenwelliae907            1    0        0          0
P_grandiflora_Kal2           1    0        0          0
P_hobdyi_Kuia                1    0        0          0
P_hexandra_K1                1    0        0          0
P_hexandra_M                 1    0        0          0
P_hexandra_Oahu              0    1        0          0

BioGeoBEARS documentation built on May 29, 2017, 8:36 p.m.