texttordata               package:CTFS               R Documentation

_C_r_e_a_t_e_s _C_T_F_S _R _d_a_t_a_s_e_t _f_r_o_m _a_n_y _t_a_b _d_e_l_i_m_i_t_e_d _t_e_x_t _f_i_l_e

_D_e_s_c_r_i_p_t_i_o_n:

     Creates an rdata file from a text file and makes the first column
     the rownames, effectively duplicating the information in the first
     column.

_U_s_a_g_e:

     texttordata(text.in,missvalue=NA)       

_A_r_g_u_m_e_n_t_s:

 text.in: any text file with defined columns, file name must be in
          quotes. Either change to the directory in which the file is
          located or provide the full path name and file name in
          quotes.  Use 'getwd' to find out the full path name if
          necessary to use, or use 'setwd' to change to the directory
          where the text file is located.

missvalue: any value that should be considered missing and replaced
          with NA. 'missvalue' can be a vector of strings which are to
          be interpreted as NA values.  Blank or empty fields are also
          considered to be missing values.

_D_e_t_a_i_l_s:

     Rownames are numbers.  Column names are taken from the first row
     in the text file.  This function uses the R function 'read.table'.
     If the default values of 'texttordata' are not sufficient, read
     the help pages for 'read.table'.



     read.table(text.in,as.is=TRUE,header=TRUE,sep="\t",quote="",commen
     t.char="",na.strings=missvalue)

     'as.is' indicates that variable formats should be retained
     'header' indicates that the first row of the text file provides
     the column (variable) names 'sep' indicates the separator, default
     is 'tab'

_V_a_l_u_e:

     Returns a *dataframe* with rownames as an additional column.

_A_u_t_h_o_r(_s):

     Rick Condit

_S_e_e _A_l_s_o:

     'CTFS.readwrite'

_E_x_a_m_p_l_e_s:

     ## Not run: 
     > texttordata("bcispp.info.txt",missvalue=c("."))->info.test
     > str(info.test)
     `data.frame':   318 obs. of  8 variables:
      $ sp      : chr  "acacme" "acaldi" "acalma" "ade1tr" ...
      $ genus   : chr  "Acacia" "Acalypha" "Acalypha" "Adelia" ...
      $ species : chr  "melanoceras" "diversifolia" "macrostachya" "triloba" ...
      $ family  : chr  "Fabaceae:Mimos." "Euphorbiaceae" "Euphorbiaceae" "Euphorbiaceae" ...
      $ grform  : chr  "U" "S" "U" "U" ...
      $ repsize : int  4 2 2 10 4 20 16 4 4 20 ...
      $ breedsys: chr  "B" "M" "M" "D" ...
      $ maxht   : int  6 6 5 5 15 15 -1 6 10 15 ...
     > info.test[1:10,]
            sp      genus       species          family grform repsize breedsys maxht
     1  acacme     Acacia   melanoceras Fabaceae:Mimos.      U       4        B     6
     2  acaldi   Acalypha  diversifolia   Euphorbiaceae      S       2        M     6
     3  acalma   Acalypha  macrostachya   Euphorbiaceae      U       2        M     5
     4  ade1tr     Adelia       triloba   Euphorbiaceae      U      10        D     5
     5  aegipa  Aegiphila    panamensis     Verbenaceae      M       4        B    15
     6  alchco  Alchornea costaricensis   Euphorbiaceae      T      20        D    15
     7  alchla  Alchornea     latifolia   Euphorbiaceae      M      16        D    -1
     8  alibed  Alibertia        edulis       Rubiaceae      U       4        D     6
     9  allops Allophylus  psilospermus     Sapindaceae      M       4        P    10
     10 alsebl     Alseis     blackiana       Rubiaceae      T      20        B    15
     ...
     ## End(Not run)

