9 Useful Functions
9.1 RStudio Keyboard Shortcuts
| Command | Description |
|---|---|
cmd+return |
execute current line or selection |
ctrl+l |
clear console output |
ctrl+1/2/3 |
move cursor to source/console/help respectively |
9.2 Workspace
| Function | Function function |
|---|---|
getwd() |
Return your working directory |
setwd() |
Assign a working directory to use for the current session |
ls() |
List the objects in an environment |
rm(x) |
Remove an object from the workspace (in this example, x) |
rm(list=ls()) |
Remove all objects from the workspace |
history() |
Show the last 25 commands |
9.3 Objects
| Function | Function function |
|---|---|
| typeof | Get object’s base type |
| pryr::otype | Get object’s type system (base, S3, S4, RC) |
| names(x) | Gets the object’s names, eg. for dataframes, the column names |
9.4 Functions
| Function | Function function |
|---|---|
| args(fxn) | prints the arguments and defaults of function fxn |
9.5 Iteration
| Function | Function function |
|---|---|
txtProgressBar |
Keep track of how things are going |