This function takes a data.frame of information downloaded from the Paleobiology Database and converts it into .inp format to be used in subsequent analyses. For example, those demonstrated by Liow and Finarelli (2014, Proc. Roy. Soc. B). First, let’s take a look at the format of the data.

load("valid.aves.spp.RData")

head(valid.aves.spp)
##        oid typ   cid                                tna rnk    tid
## 1:3 149835 occ 13264               Ornimegalonyx oteroi   3 290147
## 1:4 150093 occ 18597     Phalacrocorax subvolans n. sp.   3  53350
## 1:5 150094 occ 18597        Proictinia floridana n. sp.   3  53301
## 1:6 150133 occ 13296           Buteo fluviaticus n. sp.   3 100015
## 1:7 150134 occ 13297 Hadrogyps n. gen. aigialeus n. sp.   3  53351
## 1:8 150135 occ 13298      Primapus n. gen. lacki n. sp.   3  53337
##                      mna mra    mid           oei  oli    eag     lag
## 1:3 Ornimegalonyx oteroi   3 290147   Pleistocene <NA>  2.588  0.0117
## 1:4    Anhinga subvolans   3 110890 Hemingfordian <NA> 20.430 15.9700
## 1:5  Promilio floridanus   3 117615 Hemingfordian <NA> 20.430 15.9700
## 1:6    Buteo fluviaticus   3 100015       Orellan <NA> 33.900 33.3000
## 1:7  Hadrogyps aigialeus   3  53351      Langhian <NA> 15.970 13.8200
## 1:8       Primapus lacki   3  53337      Ypresian <NA> 56.000 47.8000
##           rid  cll   cln      phl   phn           idt         ids eag.1
## 1:3 4396;4396 Aves 36616 Chordata 33815 Ornimegalonyx      oteroi    NA
## 1:4 4414;4414 Aves 36616 Chordata 33815 Phalacrocorax   subvolans    NA
## 1:5 4414;4414 Aves 36616 Chordata 33815    Proictinia   floridana    NA
## 1:6 4415;4415 Aves 36616 Chordata 33815         Buteo fluviaticus    NA
## 1:7 4416;4416 Aves 36616 Chordata 33815     Hadrogyps   aigialeus    NA
## 1:8 4417;4417 Aves 36616 Chordata 33815      Primapus       lacki    NA
##     lag.1 cxi ein lin         lng      lat           gnl    gnn
## 1:3    NA  33  33  33  -83.666664 22.58333 Ornimegalonyx  39405
## 1:4    NA 102 102 102  -82.599998 29.70000       Anhinga  39686
## 1:5    NA 102 102 102  -82.599998 29.70000      Promilio 117610
## 1:6    NA 105 105 105 -104.866669 40.90000         Buteo  39325
## 1:7    NA 101 101 101 -118.500000 35.30000     Hadrogyps  53352
## 1:8    NA 109 109 109   -0.683333 50.78333      Primapus  39422
##                  fml   fmn            odl   odn    rss     rst eid  idf
## 1:3        Strigidae 39403   Strigiformes 39397   <NA>    <NA>  NA <NA>
## 1:4       Anhingidae 39685 Pelecaniformes 36634 n. sp.    <NA>  NA <NA>
## 1:5     Accipitridae 39323  Falconiformes 39316 n. sp.    <NA>  NA <NA>
## 1:6     Accipitridae 39323  Falconiformes 39316 n. sp.    <NA>  NA <NA>
## 1:7      Cathartidae 99060           <NA>    NA n. sp. n. gen.  NA <NA>
## 1:8 Aegialornithidae 39419    Apodiformes 39417 n. sp. n. gen.  NA <NA>
##      rsf
## 1:3 <NA>
## 1:4 <NA>
## 1:5 <NA>
## 1:6 <NA>
## 1:7 <NA>
## 1:8 <NA>

The function is provided here, and it takes a few arguments:

The function automatically writes the output to the current working directory, with the name specified when the function is called.

source("make.inp.format.R")

library(dplyr)

make.inp.format(pbdb.data = valid.aves.spp,
                age.interval=2,
                max.age = 66,
                file.out="myFile",
                target.orders = "Passeriformes")

We can load the output back into R to have a look at it

output <- readLines("myFile.inp")

head(output)
## [1] "000000000000000000000000000000011 0 1 ;"
## [2] "000000000000000000000011110000000 0 1 ;"
## [3] "000000000000000000000011110000000 0 1 ;"
## [4] "000000000000000010000000000000000 0 1 ;"
## [5] "000000000000000000000000011000000 0 1 ;"
## [6] "000001111100000000000000000000000 0 1 ;"