taca, an Irish word meaning 'support'
Handling Data in R
R is an extremely useful tool for data analytics. However its powerfulness can also be its undoing. Its command-line approach can mean that seemingly small tasks can take a long time to complete.
The taca
project is a draft package for R that will help simplify some common tasks within the R software environment, improving upon existing base functions and introducing new commands.
The package currently contains functions to:
- generate test datasets
- do quick object exports
- sink console output more effectively
- identify duplicate data
- generate date intervals
- check the system timezone, and
- provide a detailed summary of the user's current workspace.
R Command Line Command Guide
The following commands may provide further assistance to R users. They are designed primarily for Linux terminal users but may also be of assistance to users of R GUIs, including those on alternative operating systems (e.g. Mac or Windows).
Session Management
- Open R from Command Line:
R
- Quit R:
q()
- Terminate R (only do if you have no alternative ways of ending the session):
ctrl+z
Package Management
- Get list of packages already installed:
.packages(TRUE)
- Get detailed info on packages already installed:
installed.packages()
- List all functions in a package:
ls("package:nameOfPackage")
- Update packages:
update.packages()
- Uninstall package:
remove.packages(nameOfPackage)
Workspace Management
- Reload a saved workspace:
load(filePath)
- List workspace content:
ls()
- Save workspace:
save.image(filePath, compress=TRUE)
- Save part of workspace:
save(listOfObjectNamesToSave, filePath)
- Clear workspace:
rm(list=ls())
or to use regular expressions to remove a subset of objects with related names:rm(list=ls(pattern="RegularExpression"))
- Clear workspace, but keep specific object:
rm(list=setdiff(ls(), "objectToKeep"))
or to use regular expressions to keep a subset of objects with related names:
rm(list=setdiff(ls(), ls(pattern="RegularExpression")))
Command Writing/Running
- Autocomplete or get a list of autocomplete options:
tab
- Interrupt a running command:
ctrl+c
- Get help on a function:
?functionName
- Leave a help page:
q
- Read and run a script file direct from disk:
source(filePath)
- Measure time taken to run code:
system.time(codeToRun)
- Save console output to disk:
sink(filePath)
- Stop saving console output to disk:
sink(file=NULL)
Sundry Topics
- Add colour to R command line interface when running Linux, open R and run the following lines:
download.file("http://www.lepem.ufc.br/jaa/vimr/colorout_1.1-0.tar.gz", destfile = "colorout_1.0-3.tar.gz"); install.packages("colorout_1.0-3.tar.gz", type = "source", repos = NULL); library("colorout")
- Change the width of your console (print more on screen simultaneously):
options(width=120)
- Set all numbers to decimalised:
options(scipen=99999)
- Convert scientific number to decimalised:
format(2.2e-16, scientific=FALSE)
Authors and Contributors
Dara O'Neill (@daraonl) has authored the taca
package and the contents of this page.
Users of this site and the taca
software are advised that they are in draft form and caution is therefore required in their use. The author of this site and the code accepts no responsibility or liability for their use.
Help
For help on installing the package, check out Karl Broman's helpful guide. Further documentation on the package will be generated in due course.