Suppose I run the following code in the R session. At the last prompt '>', I want to retrieve the second command (staring with 'y'). But I have to type up arrow many times, which is very inconvenient. I'm wondering if there is a way to configure R to skip block of code in the history?> x=list(a=c(1,2),b=c(3,4,5)) > y=list(a=c(1,2),b=c(3,4,5)) > lapply(seq(along=x)+ ,function(i){ + cbind( + x[[i]] + ,y[[i]] + ) + } + ) [[1]] [,1] [,2] [1,] 1 1 [2,] 2 2 [[2]] [,1] [,2] [1,] 3 3 [2,] 4 4 [3,] 5 5>
Peng Yu wrote:> Suppose I run the following code in the R session. At the last prompt > '>', I want to retrieve the second command (staring with 'y'). But I > have to type up arrow many times, which is very inconvenient. I'm > wondering if there is a way to configure R to skip block of code in > the history?I don't think so, but since you are writing your code in an editor (hopefully), it is probably easier to submit the relevant part of the code from the editor to R again. Uwe Ligges> >> x=list(a=c(1,2),b=c(3,4,5)) >> y=list(a=c(1,2),b=c(3,4,5)) >> lapply(seq(along=x) > + ,function(i){ > + cbind( > + x[[i]] > + ,y[[i]] > + ) > + } > + ) > [[1]] > [,1] [,2] > [1,] 1 1 > [2,] 2 2 > > [[2]] > [,1] [,2] > [1,] 3 3 > [2,] 4 4 > [3,] 5 5 > > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
2009/12/2 Uwe Ligges <ligges at statistik.tu-dortmund.de>:> > > Peng Yu wrote: >> >> Suppose I run the following code in the R session. At the last prompt >> '>', I want to retrieve the second command (staring with 'y'). But I >> have to type up arrow many times, which is very inconvenient. I'm >> wondering if there is a way to configure R to skip block of code in >> the history? > > I don't think so, but since you are writing your code in an editor > (hopefully), it is probably easier to submit the relevant part of the code > from the editor to R again.It would be more convenient if there is a way to roll back a block of code in the history. Could the development team add this feature to the to-do list?>>> x=list(a=c(1,2),b=c(3,4,5)) >>> y=list(a=c(1,2),b=c(3,4,5)) >>> lapply(seq(along=x) >> >> + ? ? ,function(i){ >> + ? ? ? cbind( >> + ? ? ? ? ? x[[i]] >> + ? ? ? ? ? ,y[[i]] >> + ? ? ? ? ? ) >> + ? ? } >> + ? ? ) >> [[1]] >> ? ? [,1] [,2] >> [1,] ? ?1 ? ?1 >> [2,] ? ?2 ? ?2 >> >> [[2]] >> ? ? [,1] [,2] >> [1,] ? ?3 ? ?3 >> [2,] ? ?4 ? ?4 >> [3,] ? ?5 ? ?5 >> >> >> ______________________________________________ >> R-help at r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >