Skip to content

Commit

Permalink
think about decimal rules
Browse files Browse the repository at this point in the history
  • Loading branch information
alexhallam committed Jun 24, 2021
1 parent acb52e3 commit e1e73e9
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
20 changes: 16 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,30 @@ wget https://raw.githubusercontent.com/tidyverse/ggplot2/master/data-raw/diamond
cat diamonds.csv | head -n 35 | tv
```

# Rules

## Float

Print only the first three digits. The first three digits represent > 99.9% the value of a number.


# Tools to pair with tv

`tv` is a good compliment to command line data manipulation tools. I have listed some tools that I like to use with tv.

[xsv](https://github.com/BurntSushi/xsv)
[xsv](https://github.com/BurntSushi/xsv) - Command line csv data manipulaiton. Rust

[tsv-utils](https://github.com/eBay/tsv-utils)
[tsv-utils](https://github.com/eBay/tsv-utils) - Command line csv data manipulation toolkit. D

[q](https://github.com/zestyping/q)
[q](https://github.com/zestyping/q) - Command line csv data manipulation query-like. Python

[miller](https://github.com/johnkerl/miller)
[miller](https://github.com/johnkerl/miller) - Commane line data manipulaiton, statistics, and more. C

# Tools similar to tv

`column` Comes standard with linux.

# Inspiration

[pillar](https://pillar.r-lib.org/dev/articles/digits.html#trailing-dot-1) - R's tibble like formatting

3 changes: 3 additions & 0 deletions data/a.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
library(tidyverse)

print(read_csv("./a.csv"))
4 changes: 4 additions & 0 deletions data/a.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
name,value,bool,date
"abc",0.00000001,T,2021-01-01
"abc",0.0000001,T,2021-01-01
"abc",0.000001,T,2021-01-01
"abc",0.00001,T,2021-01-01
"abc",0.0001,T,2021-01-01
"abcde",0.001,F,2021-01-01
"abcdefgh",0.01,True,
Expand Down
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ fn main() {
vf[i] = datatype::trunc_strings(v[i].clone(), col_largest_width[i]);
} else if vec_datatypes[i] == "<dbl>" {
vf[i] = datatype::trunc_strings(v[i].clone(), col_largest_width[i]);
println!("{:?}",vf[i]);
} else {
vf[i] = datatype::trunc_strings(v[i].clone(), col_largest_width[i]);
}
Expand Down

0 comments on commit e1e73e9

Please sign in to comment.