[Sciviews-commits] r92 - pkg/svTools/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Jan 19 19:13:50 CET 2009


Author: romain
Date: 2009-01-19 19:13:50 +0100 (Mon, 19 Jan 2009)
New Revision: 92

Modified:
   pkg/svTools/R/checkUsage.R
   pkg/svTools/R/sidekick.R
Log:


Modified: pkg/svTools/R/checkUsage.R
===================================================================
--- pkg/svTools/R/checkUsage.R	2009-01-12 15:37:03 UTC (rev 91)
+++ pkg/svTools/R/checkUsage.R	2009-01-19 18:13:50 UTC (rev 92)
@@ -10,6 +10,10 @@
 #' @author Romain Francois \email{francoisromain@@free.fr}
 checkUsageFile <- function( file, encoding = "unknown" ){
 	
+	if( is.character(file) && file %~% '^rwd:' ){
+		file <- sub( '^rwd:', getwd(), file )
+	}
+	
 	if( encoding != "unknown" ){
 		old.op <- options( encoding = encoding )
 		on.exit( options( old.op ) )

Modified: pkg/svTools/R/sidekick.R
===================================================================
--- pkg/svTools/R/sidekick.R	2009-01-12 15:37:03 UTC (rev 91)
+++ pkg/svTools/R/sidekick.R	2009-01-19 18:13:50 UTC (rev 92)
@@ -19,6 +19,10 @@
 sidekick <- function( file, encoding = "unknown" ){
 	
 	if( is.character(file) ){
+		if( file %~% '^rwd:' ){
+			file <- sub( 'rwd:', getwd(), file ) 
+		}
+		
 		filename <- file
 		file <- file( filename, encoding = encoding )
 		on.exit( close( file ) )
@@ -70,16 +74,15 @@
 	atts <- attributes( p )
 	descriptions <- as.character( p )
 	hasAttrs <- "srcref" %in% names(atts)
+	ids <- maxId + 1:length(p)
 	if( hasAttrs ){
 		srcrefs <- t( sapply( attr(p, "srcref"), as.integer ) )  
 		colnames( srcrefs ) <- paste("srcref", 1:4 , sep = "")
 		srcrefs <- as.data.frame( srcrefs ) 
-		ids <- maxId + 1:length(p)
 		modes <- sapply( p, mode )
 		data <- data.frame( id = ids, 
-			srcrefs, description = descriptions, 
 			parent = rep( parent, length(p) ), 
-			mode = modes, 
+			mode = modes, srcrefs, description = descriptions, 
 			stringsAsFactors = FALSE)
 		env[["data"]] <- rbind( env[["data"]], data )
 	} 



More information about the Sciviews-commits mailing list