Skip to content

add warning that alerts user when they inadvertently attempt to remove index from tsibble? #308

@david-romano

Description

@david-romano

Before:

library(tidyverse)
library(tsibble)

tsibble(
  a = parse_date('1/1/24', format = '%m/%d/%y'),
  b = 1,
)
#> Using `a` as index variable.
#> # A tsibble: 1 x 2 [?]
#>   a              b
#>   <date>     <dbl>
#> 1 2024-01-01     1

After select(-a):

tsibble(
  a = parse_date('1/1/24', format = '%m/%d/%y'),
  b = 1,
) |> 
  select(-a)
#> Using `a` as index variable.
#> # A tsibble: 1 x 2 [?]
#>       b a         
#>   <dbl> <date>    
#> 1     1 2024-01-01

Created on 2024-03-18 with reprex v2.0.2

(See discussion at Behavior of select when trying to remove the index from a tsibble.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions