Collection of functions used for performing range of common tasks. Convert columns to factors, get fiscal year from a date, query postgreSQL database, write to clipboard, send email from Outlook, kill a windows process, a ggplot theme
All contributions are welcome
The package is not available on CRAN but can be installed from GitHub
devtools::install_github("amit-agni/cutlery")
Notes * During installation, you may get an error that a dependency package is not available. In such cases, install the mentioned packages and then install cutlery + For example : ERROR: dependency ‘DBI’ is not available for package ‘cutlery’
Convert multiple columns for a dataframe to factor
DT <- data.frame(c1=c("a","b","c")
,c11 = c("a","b","c")
,c2 = 1:3
,c3 = c(1.1,1.2,1.3)
,stringsAsFactors = F)
DT <- DTconvert2factor(DT,"int")
Notes * The repo folder is stored in Onedrive and sync'd on Mac and Windows. There were issues due to the different line endings on both the platforms. Windows adds CRLF whereas Mac adds LF. So when the repo was commited on Windows and Onedrive was sync'd, on Mac it would recognise the line endings as modified changes. This was solved by adding .attributes file
DISCLAIMER : Some of these functions are modifications to the functions from the already existing CRAN/github packages. For example the cutlery::fiscal_quarter()
is a modified version of lubridate::quarter()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.