[Rcpp-commits] r3253 - in pkg/int64: . R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Nov 1 13:39:23 CET 2011


Author: romain
Date: 2011-11-01 13:39:22 +0100 (Tue, 01 Nov 2011)
New Revision: 3253

Added:
   pkg/int64/ChangeLog
   pkg/int64/man/unique-methods.Rd
Modified:
   pkg/int64/NAMESPACE
   pkg/int64/R/int64.R
Log:
implementation of unique

Added: pkg/int64/ChangeLog
===================================================================
--- pkg/int64/ChangeLog	                        (rev 0)
+++ pkg/int64/ChangeLog	2011-11-01 12:39:22 UTC (rev 3253)
@@ -0,0 +1,7 @@
+2011-11-01  Romain Francois  <romain at r-enthusiasts.com>
+
+    * R/int64.R: implementation of unique for int64 and uint64
+    
+    * man/unique-methods.Rd: documentation of the above
+
+

Modified: pkg/int64/NAMESPACE
===================================================================
--- pkg/int64/NAMESPACE	2011-10-31 22:23:27 UTC (rev 3252)
+++ pkg/int64/NAMESPACE	2011-11-01 12:39:22 UTC (rev 3253)
@@ -7,7 +7,7 @@
 exportMethods( 
     show, length, "[", Arith, Compare, Summary, as.character, format, 
     
-    as.data.frame, binary
+    as.data.frame, binary, unique
 )
 export( 
     int64, uint64, as.int64, as.uint64, numeric_limits

Modified: pkg/int64/R/int64.R
===================================================================
--- pkg/int64/R/int64.R	2011-10-31 22:23:27 UTC (rev 3252)
+++ pkg/int64/R/int64.R	2011-11-01 12:39:22 UTC (rev 3253)
@@ -164,7 +164,7 @@
 setMethod( "as.character", "uint64", function(x,...){
   .Call( int64_as_character_int64, x, TRUE)  
 })
-
+setGeneric("as.data.frame")
 setMethod( "as.data.frame", "int64", function(x,row.names = NULL, optional = FALSE, ...){
    res <- data.frame( x =  seq_len(length(x)) )
    names(res) <- deparse( substitute(x ) )
@@ -181,6 +181,7 @@
 format.int64 <- format.uint64 <- function(x, ...){
     as.character(x)   
 }
+setGeneric("format")
 setMethod( "format", "int64", format.int64 )
 setMethod( "format", "uint64", format.uint64 )
 
@@ -188,3 +189,11 @@
     .Call( int64_limits, type )
 }
 
+._unique_int64 <- function(x, incomparables = FALSE, ...){
+    new( "int64", data = unique( x at .Data, incomparables, ... ) )  
+}
+setGeneric( "unique" )
+setMethod( "unique", "int64", ._unique_int64 )
+setMethod( "unique", "uint64", ._unique_int64 )
+
+

Added: pkg/int64/man/unique-methods.Rd
===================================================================
--- pkg/int64/man/unique-methods.Rd	                        (rev 0)
+++ pkg/int64/man/unique-methods.Rd	2011-11-01 12:39:22 UTC (rev 3253)
@@ -0,0 +1,32 @@
+\name{unique-methods}
+\docType{methods}
+\alias{unique-methods}
+\alias{unique,ANY-method}
+\alias{unique,int64-method}
+\alias{unique,uint64-method}
+\title{Unique implementation for 64 bit integer vectors}
+\description{
+    Implementation of \code{\link{unique}} for 64 bit integer vectors 
+}
+\section{Methods}{
+\describe{
+
+\item{\code{signature(x = "ANY")}}{default implementation (from base)}
+
+\item{\code{signature(x = "int64")}}{
+    signed 64 bit integer vectors. \code{\linkS4class{int64}}
+}
+
+\item{\code{signature(x = "uint64")}}{
+    unsigned 64 bit integer vectors. \code{\linkS4class{uint64}}
+}
+}}
+\keyword{methods}
+\examples{
+    x <- as.int64( c(1:5, 1L, 5L) )
+    unique( x )
+
+    x <- as.uint64( c(1:5, 1L, 5L) )
+    unique( x )    
+}
+



More information about the Rcpp-commits mailing list