Skip to content

more flexible #5

Open
Open

Description

@friendly

At present, twoway(x, ...) relies on x being a matrix or data.frame with the row labels being row.names(x).

we should allow a row.names = arg, to use a column in a data.frame or tibble, and remove this from the data.

Activity

  1. added
    enhancement
    on Jul 3, 2020
  2. rmheiberger commented on Jul 3, 2020

    @rmheiberger
    Collaborator
  3. friendly commented on Jul 3, 2020

    @friendly
    OwnerAuthor

    OK, this is good. But I was thinking of a more common case where a data.frame is read with it's first column being row names.

    > VermontPop <- as.data.frame(read_excel("VermontPop.xlsx"))
    > 
    > str(VermontPop)
    'data.frame':	14 obs. of  11 variables:
     $ County: chr  "Chittenden" "Rutland" "Washington" "Windsor" ...
     $ 1990  : num  5120 4793 4740 4733 4602 ...
     $ 1980  : num  5063 4766 4719 4708 4541 ...
     $ 1970  : num  4996 4721 4678 4644 4495 ...
     $ 1960  : num  4872 4669 4632 4628 4469 ...
     $ 1950  : num  4796 4662 4632 4612 4476 ...
     $ 1940  : num  4717 4659 4619 4578 4471 ...
     $ 1930  : num  4676 4685 4620 4573 4477 ...
     $ 1920  : num  4641 4665 4590 4568 4477 ...
     $ 1910  : num  4628 4682 4620 4527 4475 ...
     $ 1900  : num  4598 4646 4564 4508 4480 ...
    

    Here, manually, I would do:

    # make first column row.names
    row.names(VermontPop) <- VermontPop[,1]
    VermontPop <- VermontPop[,-1]
    
    twoway(VermontPop)
    

    But, that case might be handled internally via recognizing rownames=1 as a special case.

  4. rmheiberger commented on Jul 3, 2020

    @rmheiberger
    Collaborator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions