Did you know about fix()?


#1

I was watching a tutorial on something or other on youtube and the lecturer used fix() on a data frame. My mind is blown. Of course something like this exists, if it didn’t, it should. My only regret is that I didn’t find out about this years ago. It would have saved a lot of time doing little manual edits to my data.

For those who didn’t know, or can’t check it for themselves right now, it opens the data frame up in a new spreadsheet-like window, where you can edit the values.

That’s all. Just trying to spread my amazement, and maybe help save a few seconds here and there.


RStudio UI to create a table
#2

I would recommend against using fix since it goes against the idea of reproducibility, which I think statistical programming and R is all about. With fix you hide your data cleaning process behind the click of a mouse…


#3

I didn’t realize that you could open a text editor from RStudio! FYI, edit() also opens up the text editor.


#4

I totally get the concerns about reproducibility, and I understand the drawbacks of editing data in an interactive, spreadsheet-y way. However, there have been times in the past when I could have used this for data entry/creating a smaller dataset by hand. The alternative is typing out the data in R code, i.e. enclosing all strings in quotes, separating with commas etc.


#5

I wouldn’t use fix for entering data, but I use View a lot for viewing data.


#6

I suppose a theoretical way to solve the reproducibility issue would be a fix-like function that instead of editing the data, will return the code for said edit that you can run yourself.