Learn R Programming

gmt (version 1.0-0)

r2gmt: Prepare Data for GMT

Description

This function handles data that will be annotated on a GMT map, writing them to a temporary file. Although it is an internal function, users may find it handy for some tasks.

Usage

r2gmt(x, outfile, append=FALSE)

Arguments

x
data frame, matrix, or filename containing the data to be written to a temporary file
outfile
filename where the data will be written in GMT format, tab-separated without header
append
whether data should be appended to an existing file, separating segments with ">" lines

Value

  • The data frame that was written to outfile.

Details

If x is a filename, the data should be tabular with or without a header, separated by commas or whitespace. The first line is interpreted as header if the first non-whitespace character is not minus, point, or number.

See Also

scan and read.table are used to read in the data, write and write.table to write them to the temporary file.

Examples

Run this code
LonLat1 <- data.frame(Lon=1:3, Lat=4:6)
LonLat2 <- data.frame(Lon=7:8, Lat=9:10)
r2gmt(LonLat1, "temp.gmt")
r2gmt(LonLat2, "temp.gmt", append=TRUE)

Run the code above in your browser using DataLab