R/as.xyz.R

"as.xyz" <- function(x) {
  if(is.vector(x))
    x = matrix(x, nrow=1)
  
  dims <- dim(x)
  if(!(dims[2L]%%3==0))
    warning("number of cartesian coordinates not a multiple of 3")
  
  class(x) <- c("xyz", "matrix")
  return(x)
}

Try the bio3d package in your browser

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

bio3d documentation built on Oct. 27, 2022, 1:06 a.m.