Description Usage Arguments Details See Also Examples
Edit an object in-place using the built-in edit
function.
If the first argument to ed
is an integer, it will attempt
to edit the last n
lines, excluding references to ed
or lastn
.
1 2 |
obj |
ANY. It will be modified in place, i.e., calling
|
tweak |
multiple. See |
verbose |
logical. If |
echo |
logical. Whether or not to edit the history in-place
as well so that it shows up in the interactive command line.
The default is |
show.attributes |
logical. Whether or not to show attributes
when editing. The attributes will simply be copied over on editing
if this is |
by |
numeric. If |
to |
character. If |
One can choose the editor by passing an editor
argument.
The default value for this is getOption("editor")
as in
the edit
function; possible values are "vi", "emacs",
"pico", "xemacs", "xedit", and potentially more (OS specific).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ## Not run:
some_function <- function(x) { x + 1 }
ed(some_function) # opens an in-line editor to mess with some_function
x <- 1:5
ed(x) # Will edit x in-place
ed(2) # Will edit a file containing
# some_function <_ function(x) { x + 1 }
# x <- 1:5
# Editing and leaving the file will trigger its execution
x <- 10; attr(x, "y") <- 5
ed(x, v = T, e = T, s = T) # Will print a message containing the modified change
# as well as echoing the results to the history, and showing attributes
# in the editing pane.
ed("1:5", to = "10") # Edit the last two lines -- they are found through regular expressions
ed("1:5", "10") # This actually works too :)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.