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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Nov 18 20:25:35 CET 2011


Author: romain
Date: 2011-11-18 20:25:35 +0100 (Fri, 18 Nov 2011)
New Revision: 3385

Modified:
   pkg/int64/NAMESPACE
   pkg/int64/R/int64.R
Log:
implementing john's advice, step 1

Modified: pkg/int64/NAMESPACE
===================================================================
--- pkg/int64/NAMESPACE	2011-11-18 17:19:51 UTC (rev 3384)
+++ pkg/int64/NAMESPACE	2011-11-18 19:25:35 UTC (rev 3385)
@@ -16,4 +16,6 @@
 S3method( format, int64 )
 S3method( format, uint64 )
 
+S3method( as.data.frame , int64 )
+S3method( as.data.frame , uint64 )
 

Modified: pkg/int64/R/int64.R
===================================================================
--- pkg/int64/R/int64.R	2011-11-18 17:19:51 UTC (rev 3384)
+++ pkg/int64/R/int64.R	2011-11-18 19:25:35 UTC (rev 3385)
@@ -214,18 +214,14 @@
   .Call( int64_as_character_int64, x, TRUE)  
 })
 setGeneric("as.data.frame")
-setMethod( "as.data.frame", "int64", function(x,row.names = NULL, optional = FALSE, ...){
+as.data.frame.int64 <- as.data.frame.uint64 <- function(x,row.names = NULL, optional = FALSE, ...){
    res <- data.frame( x =  seq_len(length(x)) )
    names(res) <- deparse( substitute(x ) )
    res[[1L]] <- x
    res
-})
-setMethod( "as.data.frame", "uint64", function(x,row.names = NULL, optional = FALSE, ...){
-   res <- data.frame( x =  seq_len(length(x)) )
-   names(res) <- deparse( substitute(x ) )
-   res[[1L]] <- x
-   res
-})
+}
+setMethod( "as.data.frame", "int64" , as.data.frame.int64  )
+setMethod( "as.data.frame", "uint64", as.data.frame.uint64 )
          
 format.int64 <- format.uint64 <- function(x, ...){
     as.character(x)   



More information about the Rcpp-commits mailing list