timetaken() could have more formatting options

Open
#7,708 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
55/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
r
Domain
data

Research direction

Use timetaken() as the entry point and inspect its implementation and nearby usage examples first. Define formatting options that can omit the CPU portion and/or the word "elapsed", while preserving the existing short- and long-duration formats; done means the requested output variants are supported.

Written by the indexing model from the issue text.

Description

timetaken is very handy function for formatting time taken in R code. It is currently limited to one type of format:

t0 = proc.time()
Sys.sleep(5)
timetaken(t0)
#[1] "5.007s elapsed (0.060s cpu)"

# then when something takes much longer
#[1] "01:01:33 elapsed (01:00:01 cpu)"

I would like to be able to tweak its format.
For example I would like to skip "cpu" time: "5.007s elapsed" / "01:01:33 elapsed"
Or skip elapsed word as well: "5.007s" / "01:01:33"

Dominant language
R
Stars
3.9k
Forks
1.1k
Avg merge
14h 4m
Merged PRs (30d)
4

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Rdatatable/data.table

All issues in Rdatatable/data.table

Similar issues

More R issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.