[R] edit.data() read-only?

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Tue Mar 26 11:20:59 CET 2013


On Tue, Mar 26, 2013 at 10:09 AM, Ted Harding <Ted.Harding at wlandres.net> wrote:
> Greetings All.
>
> The function edit.data() allows a convenient spreadsheet-like
> view of a dataframe with too many rows/columns to fit on the
> screen (especially when there are many columns). Very useful
> when scanning through a dataset (row & column are conveniently
> identified by the labels at the side and above).

 Do you mean:

d=data.frame(x=1:10,y=runif(10))
edit(d)

? Because I don't have an edit.data function (maybe its windows only).

> However, there seens to be no option to set it "read-only" on
> start-up, with the consequence that a clumsy key-press or
> mouse-click could cause a change in the data which would then
> be stored after quitting edit.data().
>
> Is there a possibility of a read-only option? Or some other
> function which could offer similar viewing capability without
> the risk of data change?

 If you just want to view the data, don't assign it back. The "edit"
function only updates the data if you assign it back, as in:

d=edit(d)

so a 'read only' version would be:

invisible(edit(d))

except the user here can change the values in the cells, they just
don't go anywhere. Except into .Last.value if you decide you really
did want to get the values...

Barry



More information about the R-help mailing list