tests/rrle.R

#$HeadURL: file:///srv/svn/sintro/pkg/sprof/tests/rrle.R $
#$Id: rrle.R 178 2013-07-23 19:13:13Z gsawitzki $
#$Revision: 178 $
#$Date: 2013-07-23 21:13:13 +0200 (Tue, 23 Jul 2013) $
#$Author: gsawitzki $

# setwd("")
#! To Do
#!
library(sprof)


x <- matrix(c(
	1,1,1,2,2,
	3,3,4,4,4,
	5,5,6,6,7,
	8,9,9,0,0
),nrow=4, ncol =5, byrow=TRUE)
xrrle <- rrle(x)
xrrle

t(sapply(xrrle, inverse.rle))



xf <- as.factor(x)
xfi <- levels(xf)
xrrlef <- rrle(x)
xrrlef1 <- lapply(xrrlef, function(xl) {xl$values <- factor(xl$values, levels=xfi); xl})
xrrlef1

t(sapply(xrrlef, inverse.rle))

Try the sprof package in your browser

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

sprof documentation built on May 2, 2019, 4:45 p.m.