tran.import-export {RSurvey}R Documentation

Import and Export Transect Data

Description

This function imports and exports transect data.

Usage

tran.import(type, id, file = NULL)
tran.export(type, id, file = NULL)

Arguments

type a character string giving the desired data type (transect, profile, and raster). See Format section.
id the name of the transect.
file either a character string naming a file or a connection.

Format

For transect data the text file, ‘*.txt’, contains the deparsed tran.dat object.

For profile data the tab delineated text file, ‘*.txt’, reserves the first [1,] row for column descriptors and contains the following components:
[,1] numeric the distance along the local x-axis measured from the vertex origin.
[,2] numeric z values along the profile.

For raster data the tab delineated text file, ‘*.txt’, reserves the first [1,] and second [2,] rows for column descriptors and contains the following components:
[,1] numeric the distance along the local x-axis measured from the vertex origin.
[,2] numeric local z values.
[,3:] numeric raster state variable(s).

Value

The transect option replaces or creates the id component in tran.dat. The profile and raster options replace the prof and data.ras components in tran.dat, respectively.

Author(s)

Fisher, J. C.

See Also

dput, read.table

Examples

## A sample transect file:

## structure(list(id = "T1", vertices = structure(c(679163.534, 679238.561, 
## 4135735.518, 4135730.43), .Dim = c(2L, 2L), .Dimnames = list(c("1", "2"), 
## c("x", "y"))), fix.zero = "R", h.offset = 21, grid.dx = 0.05, grid.dy = 0.005, 
## asp.ratio = 5, v.origin = 11.379, v.offset = -0.18, data.file = "T1.txt"), 
## .Names = c("id", "vertices", "fix.zero", "h.offset", "grid.dx", "grid.dy", 
## "asp.ratio", "v.origin", "v.offset", "data.file"))

f <- system.file("RSurvey-ex/confluence-T1.txt", package = "RSurvey")
tran.import("transect", "T1", f)

f <- paste(getwd(), "/test.txt", sep="")
tran.export("transect", "T1", f)


## A sample profile file including a header and two rows of data.

## Distance     Elevation
## 14   10.499
## 16   10.429

f <- system.file("RSurvey-ex/confluence-profile-T1.txt", package = "RSurvey")
con <- file(f, open = "r", encoding = "latin1")
tran.import(type = "profile", id = "T1", file = con)

f <- paste(getwd(), "/test.txt", sep="")
con <- file(f, open = "w")
tran.export(type = "profile", id = "T1", file = con)

## A sample raster file including a header and two rows of data.

## motoX        motoY   temp    pH      SpCond
## m    m       degC    units   uS/cm
## 0    -0.11   24.55   8.00    569.38
## 2    0       24.58   7.99    646.01

f <- system.file("RSurvey-ex/confluence-raster-T1.txt", package = "RSurvey")
con <- file(f, open = "r", encoding = "latin1")
tran.import(type = "raster", id = "T1", file = con)

f <- paste(getwd(), "/test.txt", sep="")
con <- file(f, open = "w")
tran.export("T1", type="raster", file = con)


[Package RSurvey version 0.4.5 Index]