R/utils_float.R

Defines functions as.floatraw floatraw2numeric floatraw

Documented in as.floatraw floatraw floatraw2numeric

# Package: rdyncall
# File: R/utils_float.R
# Description: Support for C float vectors in R

as.floatraw <- function(x) 
{
  x <- .Call("r_as_floatraw", as.numeric(x), PACKAGE="rdyncall")
  class(x) <- "floatraw"
  x
}

floatraw2numeric <- function(x) 
{
  stopifnot(is.raw(x))
  stopifnot(class(x) == "floatraw")
  stopifnot(length(x) >= 4)
  .Call("r_floatraw2numeric", x, PACKAGE="rdyncall")
}

floatraw <- function(n)
{
  x <- raw(n*4)
  class(x) <- "floatraw"
  x
}

Try the rdyncall package in your browser

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

rdyncall documentation built on May 2, 2019, 6:15 p.m.