You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cannot nest into a column with the same name as a column in the nested dataset.
library(tidyverse)
library(tsibble)
#> #> Attaching package: 'tsibble'#> The following object is masked from 'package:dplyr':#> #> idtourism %>%
as_tibble %>%
nest(-Purpose, .key="Trips")
#> # A tibble: 4 x 2#> Purpose Trips #> <chr> <list> #> 1 Business <tibble [6,080 × 4]>#> 2 Holiday <tibble [6,080 × 4]>#> 3 Other <tibble [6,080 × 4]>#> 4 Visiting <tibble [6,080 × 4]>tourism %>%
nest(-Purpose, .key="Trips")
#> Error in .subset2(x, i): attempt to select less than one element in get1index
Suppose the above was possible. unnest_tsibble() will incorrectly identify no tsibble columns that are being unnested.
library(tidyverse)
library(tsibble)
#> #> Attaching package: 'tsibble'#> The following object is masked from 'package:dplyr':#> #> idnested_tourism<-tourism %>%
as_tibble %>%
nest(-Purpose, .key="Trips") %>%
mutate(Trips= map(Trips, as_tsibble, key= c("Region", "State"), index=Quarter)) %>%
new_tibble(., nrow= NROW(.), subclass="lst_ts")
nested_tourism#> # A tibble: 4 x 2#> Purpose Trips #> <chr> <list> #> 1 Business <tsibble [6,080 × 4]>#> 2 Holiday <tsibble [6,080 × 4]>#> 3 Other <tsibble [6,080 × 4]>#> 4 Visiting <tsibble [6,080 × 4]>nested_tourism %>%
unnest_tsibble("Trips")
#> Unnested columns contain no tsibble object.nested_tourism %>%
as_tibble %>%
unnest(Trips)
#> # A tibble: 24,320 x 5#> Purpose Quarter Region State Trips#> <chr> <date> <chr> <chr> <dbl>#> 1 Business 1998-01-01 Adelaide South Australia 135.#> 2 Business 1998-04-01 Adelaide South Australia 110.#> 3 Business 1998-07-01 Adelaide South Australia 166.#> 4 Business 1998-10-01 Adelaide South Australia 127.#> 5 Business 1999-01-01 Adelaide South Australia 137.#> 6 Business 1999-04-01 Adelaide South Australia 200.#> 7 Business 1999-07-01 Adelaide South Australia 169.#> 8 Business 1999-10-01 Adelaide South Australia 134.#> 9 Business 2000-01-01 Adelaide South Australia 154.#> 10 Business 2000-04-01 Adelaide South Australia 169.#> # … with 24,310 more rows
nest()
Cannot nest into a column with the same name as a column in the nested dataset.
Created on 2019-06-05 by the reprex package (v0.2.1)
unnest_tsibble()
Suppose the above was possible.
unnest_tsibble()
will incorrectly identify no tsibble columns that are being unnested.Created on 2019-06-05 by the reprex package (v0.2.1)
The text was updated successfully, but these errors were encountered: