Comments (4)
Do you have the latest version installed? When I run this on my computer it works.
Edit: Ah yep - you have tidytable 0.3.2 installed. Run this.
devtools::install_github("markfairbanks/tidytable")
tidytable is now on version 0.4.1
library(data.table)
library(tidytable)
x = iris %>% as.data.table() %>% dt_select(Sepal.Length, Sepal.Width)
y = iris %>% as.data.table() %>% dt_select(Sepal.Width, Sepal.Length)
dt_bind_rows(x, y)
#> Sepal.Length Sepal.Width
#> 1: 5.1 3.5
#> 2: 4.9 3.0
#> 3: 4.7 3.2
#> 4: 4.6 3.1
#> 5: 5.0 3.6
#> ---
#> 296: 6.7 3.0
#> 297: 6.3 2.5
#> 298: 6.5 3.0
#> 299: 6.2 3.4
#> 300: 5.9 3.0
from tidytable.
I didn't realize that I was so out-of-date! Sorry to waste your time
from tidytable.
No worries! It's worth noting that using by = list(col1, col2)
no longer works in the newer versions. See the example below:
test_df <- data.table(a = c("x","x","y"), b = c("x","x","y"), c = 1:3)
# Using by = list(a, b) no longer works
test_df %>%
dt_summarize(avg_c = mean(c), by = list(a, b))
#> Error: Using by = list(col1, col2) is deprecated. Please use by = c(col1, col2)
# Use by = c(a, b)
test_df %>%
dt_summarize(avg_c = mean(c), by = c(a, b))
#> a b avg_c
#> 1: x x 1.5
#> 2: y y 3.0
The new way allows you to do stuff like this:
test_df %>%
dt_summarize(avg_c = mean(c), by = is.character)
test_df %>%
dt_summarize(avg_c = mean(c), by = c(is.character, is.factor))
Also every function now has both a dt_verb()
and verb.()
alias:
test_df %>%
summarize.(avg_c = mean(c), by = is.character)
from tidytable.
@markfairbanks: not sure if I'm missing something even after checking the man
; dplyr::summarise_at/all/if()
are not yet implemented, ya?
Something like:
library(dplyr)
#> Warning: package 'dplyr' was built under R version 3.6.3
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
iris %>%
summarise_if(is.numeric, mean, na.rm = TRUE)
#> Sepal.Length Sepal.Width Petal.Length Petal.Width
#> 1 5.843333 3.057333 3.758 1.199333
iris %>%
summarise_at(vars(contains("Sepal")), sum, na.rm = TRUE)
#> Sepal.Length Sepal.Width
#> 1 876.5 458.6
from tidytable.
Related Issues (20)
- `distinct` not working with lists HOT 2
- using `pick()` inside `count()` leads to an unhelpful error HOT 5
- deprecated notation HOT 1
- Bug: unnest() HOT 2
- Failure with dev glue HOT 3
- Release v0.11.0 HOT 1
- When two tidytables are subtracted, the class `tidytable` gets lost on the way. HOT 2
- weird error using testthat HOT 2
- exposing list_flatten HOT 1
- summarize with across behaves in a strange way and gives an error when I use lapply inside
- Renaming in `group_by()` can lead to grouping by nonexistent columns
- ifelse and if_else HOT 1
- pmap is not working for data frames HOT 1
- Error "mutate_rowwise()" several columns. HOT 2
- Group_by bug with purrr::reduce HOT 4
- pmap() doesn't name list elements using existing names HOT 2
- `tidytable` objects are not printed after loading `quarto` HOT 4
- `group_by` + equality `filter` on column with `NA` values introduces `NA` rows HOT 2
- Allow paged printing in `rmarkdown`
- Release v0.11.1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tidytable.