askrm {cgwtools} | R Documentation |
Interactive application of selected function a list of objects.
Description
This function was originally written to do the same as the unix rm -i
command. The user supplies a list of items and the name of a function which is optionally applied to each item in turn.
Usage
askrm(items = ls(parent.frame()), fn = "rm", ask = TRUE)
Arguments
items |
A character vector of names of the objects to be acted upon (such as |
fn |
The name of the function to be applied, supplied as a character string. Possible future upgrades may allow function names to be entered without quotes. |
ask |
If |
Value
A list with three elements.
func |
Echo back the input function, for archival reference. |
selected |
All the items from the input list to which the function |
evout |
A list of the value(s) returned by the function, if any, each time it was executed. |
Author(s)
Carl Witthoft, carl@witthoft.com
See Also
When interactive prompting is not desired, sapply
or its brethren are recommended.
Examples
# get rid of junky objects left around from testing
foo<-1
afoo<-c(foo,2)
foob <- c('a','b','d')
askrm(ls(pattern="foo") )
x<- rep(1,10)
y<- runif(10)
askrm(c('x','y'),'sd',ask=FALSE)