[R-gregmisc-users] SF.net SVN: r-gregmisc:[1919] trunk
                
                Brought to you by:
                
                    warnes
                    
                
            
            
        
        
        
    | 
      
      
      From: <wa...@us...> - 2015-04-08 19:55:43
      
     | 
| Revision: 1919
          http://sourceforge.net/p/r-gregmisc/code/1919
Author:   warnes
Date:     2015-04-08 19:55:41 +0000 (Wed, 08 Apr 2015)
Log Message:
-----------
Move first/last/left/right to from gtools to gdata
Modified Paths:
--------------
    trunk/gtools/NAMESPACE
Added Paths:
-----------
    trunk/gdata/R/first.R
    trunk/gdata/man/first.Rd
    trunk/gdata/man/left.Rd
Removed Paths:
-------------
    trunk/gtools/R/first.R
    trunk/gtools/man/first.Rd
    trunk/gtools/man/left.Rd
Copied: trunk/gdata/R/first.R (from rev 1914, trunk/gtools/R/first.R)
===================================================================
--- trunk/gdata/R/first.R	                        (rev 0)
+++ trunk/gdata/R/first.R	2015-04-08 19:55:41 UTC (rev 1919)
@@ -0,0 +1,30 @@
+first <- function(x) UseMethod("first")
+last  <- function(x) UseMethod("last")
+
+left  <- function(x, n=6) UseMethod("left")
+right <- function(x, n=6) UseMethod("left")
+
+
+first.default <- function(x) x[1]
+last.default  <- function(x) x[length(x)] 
+
+
+first.list <- function(x) x[[1]]
+last.list  <- function(x) x[[length(x)]]
+
+
+left.data.frame <- function(x, n=6)
+{
+   n <- min(n, ncol(x))
+   x[, 1:n]
+}
+left.matrix <- left.data.frame
+
+
+right.data.frame <- function(x, n=6)
+{
+   n <- min(n, ncol(x))
+   x[, (ncol(x)-n+1):ncol(x)]
+}
+right.matrix <- right.data.frame
+
Copied: trunk/gdata/man/first.Rd (from rev 1913, trunk/gtools/man/first.Rd)
===================================================================
--- trunk/gdata/man/first.Rd	                        (rev 0)
+++ trunk/gdata/man/first.Rd	2015-04-08 19:55:41 UTC (rev 1919)
@@ -0,0 +1,47 @@
+\name{first}
+\alias{first}
+\alias{first.default}
+\alias{first.list}
+\alias{last}
+\alias{last.default}
+\alias{last.list}
+\title{Return first or last element of a vector or list}
+\description{
+  Return first or last element of a vector or list
+}
+\usage{
+first(x)
+last(x)
+\method{first}{default}(x)
+\method{last}{default}(x)
+\method{first}{list}(x)
+\method{last}{list}(x)
+}
+%- maybe also 'usage' for other objects documented here.
+\arguments{
+  \item{x}{vector or list}
+}
+\value{
+  The first or last element of \code{x}.
+}
+\author{
+  Gregory R. Warnes \email{gr...@wa...}
+}
+\seealso{
+  \code{\link[utils]{head}},
+  \code{\link[utils]{tail}},
+  \code{\link{left}},
+  \code{\link{right}}
+}
+\examples{
+## works for vectors..
+v <- 1:10
+first(v)
+last(v)
+
+## and for lists
+l <- list(a=1, b=2, c=3)
+first(l)
+last(l)
+}
+\keyword{ manip }
Copied: trunk/gdata/man/left.Rd (from rev 1913, trunk/gtools/man/left.Rd)
===================================================================
--- trunk/gdata/man/left.Rd	                        (rev 0)
+++ trunk/gdata/man/left.Rd	2015-04-08 19:55:41 UTC (rev 1919)
@@ -0,0 +1,39 @@
+\name{left}
+\alias{right}
+\alias{left}
+\title{Return the leftmost or rightmost columns of a matrix or dataframe}
+\description{
+  Return the leftmost or rightmost or  columns of a matrix or dataframe
+}
+\usage{
+right(x, n = 6)
+left(x, n=6)
+}
+\arguments{
+  \item{x}{Matrix or dataframe}
+  \item{n}{Number of columns to return}
+}
+\value{
+  An object consisting of the leftmost or rightmost  \code{n} columns
+  of \code{x}.
+}
+\author{
+  Gregory R. Warnes \email{gr...@wa...}
+}
+\seealso{
+  \code{\link{first}},
+  \code{\link{last}},
+  \code{\link[utils]{head}},
+  \code{\link[utils]{tail}}
+}
+\examples{
+ m <- matrix( 1:100, ncol=10 )
+ colnames(m) <- paste("Col",1:10, sep="_")
+ left(m)
+ right(m)
+
+ d <- as.data.frame(m)
+ left(d)
+ right(d)
+}
+\keyword{ manip }
Modified: trunk/gtools/NAMESPACE
===================================================================
--- trunk/gtools/NAMESPACE	2015-04-06 22:09:54 UTC (rev 1918)
+++ trunk/gtools/NAMESPACE	2015-04-08 19:55:41 UTC (rev 1919)
@@ -12,15 +12,12 @@
        ddirichlet,
        defmacro,
        even,
-       first,
        foldchange,
        foldchange2logratio,
        getDependencies,
        inv.logit,
        invalid,
        keywords,
-       last,
-       left,
        lastAdd,
        logit,
        logratio2foldchange,
@@ -30,7 +27,6 @@
        permutations,
        permute,
        quantcut,
-       right,
        rdirichlet,
        running,
        scat,
@@ -40,16 +36,3 @@
        stars.pval,
        strmacro
        )
-
-S3method(first, default)
-S3method(first, list   )
-
-S3method(last,  default)
-S3method(last,  list   )
-
-S3method(left,  data.frame)
-S3method(left,  matrix)
-
-S3method(right, data.frame)
-S3method(right, matrix)
-
Deleted: trunk/gtools/R/first.R
===================================================================
--- trunk/gtools/R/first.R	2015-04-06 22:09:54 UTC (rev 1918)
+++ trunk/gtools/R/first.R	2015-04-08 19:55:41 UTC (rev 1919)
@@ -1,30 +0,0 @@
-first <- function(x) UseMethod("first")
-last  <- function(x) UseMethod("last")
-
-left  <- function(x, n=6) UseMethod("left")
-right <- function(x, n=6) UseMethod("left")
-
-
-first.default <- function(x) x[1]
-last.default  <- function(x) x[length(x)] 
-
-
-first.list <- function(x) x[[1]]
-last.list  <- function(x) x[[length(x)]]
-
-
-left.data.frame <- function(x, n=6)
-{
-   n <- min(n, ncol(x))
-   x[, 1:n]
-}
-left.matrix <- left.data.frame
-
-
-right.data.frame <- function(x, n=6)
-{
-   n <- min(n, ncol(x))
-   x[, (ncol(x)-n+1):ncol(x)]
-}
-right.matrix <- right.data.frame
-
Deleted: trunk/gtools/man/first.Rd
===================================================================
--- trunk/gtools/man/first.Rd	2015-04-06 22:09:54 UTC (rev 1918)
+++ trunk/gtools/man/first.Rd	2015-04-08 19:55:41 UTC (rev 1919)
@@ -1,47 +0,0 @@
-\name{first}
-\alias{first}
-\alias{first.default}
-\alias{first.list}
-\alias{last}
-\alias{last.default}
-\alias{last.list}
-\title{Return first or last element of a vector or list}
-\description{
-  Return first or last element of a vector or list
-}
-\usage{
-first(x)
-last(x)
-\method{first}{default}(x)
-\method{last}{default}(x)
-\method{first}{list}(x)
-\method{last}{list}(x)
-}
-%- maybe also 'usage' for other objects documented here.
-\arguments{
-  \item{x}{vector or list}
-}
-\value{
-  The first or last element of \code{x}.
-}
-\author{
-  Gregory R. Warnes \email{gr...@wa...}
-}
-\seealso{
-  \code{\link[utils]{head}},
-  \code{\link[utils]{tail}},
-  \code{\link{left}},
-  \code{\link{right}}
-}
-\examples{
-## works for vectors..
-v <- 1:10
-first(v)
-last(v)
-
-## and for lists
-l <- list(a=1, b=2, c=3)
-first(l)
-last(l)
-}
-\keyword{ manip }
Deleted: trunk/gtools/man/left.Rd
===================================================================
--- trunk/gtools/man/left.Rd	2015-04-06 22:09:54 UTC (rev 1918)
+++ trunk/gtools/man/left.Rd	2015-04-08 19:55:41 UTC (rev 1919)
@@ -1,39 +0,0 @@
-\name{left}
-\alias{right}
-\alias{left}
-\title{Return the leftmost or rightmost columns of a matrix or dataframe}
-\description{
-  Return the leftmost or rightmost or  columns of a matrix or dataframe
-}
-\usage{
-right(x, n = 6)
-left(x, n=6)
-}
-\arguments{
-  \item{x}{Matrix or dataframe}
-  \item{n}{Number of columns to return}
-}
-\value{
-  An object consisting of the leftmost or rightmost  \code{n} columns
-  of \code{x}.
-}
-\author{
-  Gregory R. Warnes \email{gr...@wa...}
-}
-\seealso{
-  \code{\link{first}},
-  \code{\link{last}},
-  \code{\link[utils]{head}},
-  \code{\link[utils]{tail}}
-}
-\examples{
- m <- matrix( 1:100, ncol=10 )
- colnames(m) <- paste("Col",1:10, sep="_")
- left(m)
- right(m)
-
- d <- as.data.frame(m)
- left(d)
- right(d)
-}
-\keyword{ manip }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 |