read.coord: Read a List of Points from a txt File

Description Usage Arguments Details Value Author(s) Examples

Description

Marked set of points are read from a given input file. Both geographical and Cartesian coordinates are accepted.

Usage

1
read.coord(inputfile = "", type = "geographical")

Arguments

inputfile

Filename with complete path. By default, a Windows file dialog is open to choose the input file.

type

A character string naming the coordinate system in which points have been referenced. A partial matching is performed against these arguments: "geographical" and "cartesian".

Details

The input file should have three fields separated by commas. A header (i.e. first line) is required to differentiate latitude from longitude accurately. The first field must hold the species IDs. The second and third fields corresponds to the longitude and latitude indistinctly. If points are derived from a Cartesian system of coordinates, longitude and latitude fields will be interpreted as the abscissa and ordinate respectively.

Value

An object of class dnpoint, which is a list with elements:

Numpoints

Number of read points.

Points

Data frame with columns (1) indices for species, (2) Longitude and (3) Latitude. Coordinates are in decimal format.

Label

Character vector of species labels.

Type

String specifying the type of coordinate system passed as argument.

Author(s)

Daniel A. Dos Santos <dadossantos@csnat.unt.edu.ar>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
  #####
  # You can recognize the format of a typical input file
  # in the following created .txt:
  write(c("sp", "latitude", "longitude"), file= "proof.txt", 3, TRUE, sep = ",")
  for (i in 1:10) 
    write(c(LETTERS[i], i*1.5, i*-8.6),file= "proof.txt", 3, TRUE, sep = ",")
  proof <- read.coord("proof.txt") # Put getwd() to identify the path where
                                   # the file 'proof.txt' has been located
  
  #####
  unlink("proof.txt") # Delete

SyNet documentation built on May 2, 2019, 1:10 p.m.