Re: [R] keep track of variables created in each chapter of a knitr book

2014-01-25 Thread William Dunlap
Subject: Re: [R] keep track of variables created in each chapter of a knitr > book > > You could initialize one list per chapter, > > > x1 <- list( "Chapter One" ) > > and then crate your variables as list members > > > x1$A <- c( 1

Re: [R] keep track of variables created in each chapter of a knitr book

2014-01-25 Thread Rainer Schuermann
You could initialize one list per chapter, > x1 <- list( "Chapter One" ) and then crate your variables as list members > x1$A <- c( 1, 2, 3 ) > x1$B <- "bla" > x1$tv.data <- data.frame( m = sample( LETTERS, 5 ), n = round( runif( 5 ), 2 ) ) > x1 [[1]] [1] "Chapter O

Re: [R] keep track of variables created in each chapter of a knitr book

2014-01-24 Thread Ista Zahn
I'm not sure what exactly you want to remove in the cleanup step, but to list the objects assigned in a particular chapter can't you just put prev.vars <- ls() at the beginning of the chapter and vars.this.chapter <- setdiff(ls(), prev.vars) at the end? Best, Ista On Fri, Jan 24, 2014 at 9:14

[R] keep track of variables created in each chapter of a knitr book

2014-01-24 Thread Michael Friendly
In a book project using knitr, I'm creating a large number of variable and objects in chunks within chapters. I'd like to find a way of keeping track of all of those for each chapter, and clean up at the end of each chapter, without having to manually list their names as shown below. The book