R/read.pts.r

Defines functions read.pts

Documented in read.pts

#' reads pts files
#' 
#' reads Landmark data exported from the software Landmark from
#' http://graphics.idav.ucdavis.edu/research/EvoMorph
#' 
#' 
#' @param file pts file
#' @param na specifies a value that indicates missing values
#' @return
#' \item{matrix }{matrix containing landmark information rownames will be
#' the names given to the landmarks in Landmark}
#' @seealso \code{\link{read.pts}}
#' 
#' @examples
#' 
#' data(nose)
#' write.pts(shortnose.lm, filename="shortnose")
#' data <- read.pts("shortnose.pts")
#' 
#' @export
read.pts <- function(file="x", na=9999)
{	
    pts <- read.table(file,skip=2)
    
	try(suppressWarnings(rownames(pts) <- pts[,1]),silent = T)
	pts <- as.matrix(pts[,2:4])
        nas <- which(pts == na)
        if (length(nas) > 0)
            pts[nas] <- NA
	return(pts)
}

Try the Morpho package in your browser

Any scripts or data that you put into this service are public.

Morpho documentation built on Feb. 16, 2023, 10:51 p.m.