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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Jan 19 19:32:21 CET 2009


Author: romain
Date: 2009-01-19 19:32:21 +0100 (Mon, 19 Jan 2009)
New Revision: 95

Added:
   pkg/svTools/R/read.INDEX.R
Log:


Added: pkg/svTools/R/read.INDEX.R
===================================================================
--- pkg/svTools/R/read.INDEX.R	                        (rev 0)
+++ pkg/svTools/R/read.INDEX.R	2009-01-19 18:32:21 UTC (rev 95)
@@ -0,0 +1,16 @@
+read.INDEX <- function( file ){
+  
+	EMPTY <- data.frame( index= character(), description=character(), stringsAsFactors=FALSE)
+	if( !file.exists(file ) ){
+		return( EMPTY )
+	}
+	rl <- readLines( file ) 
+	if( !length( rl ) ){
+		return( EMPTY )
+	}
+	lines <- rl %~% "^ "
+	index <- rl[!lines] %-~% " +.*$"
+  description <- rl[!lines] %-~% "^.*? +"
+  data.frame( index = index, description = description, stringsAsFactors = FALSE)
+}
+



More information about the Sciviews-commits mailing list