Fixing a multiple warning “unknown column”

前端 未结 8 2044
你的背包
你的背包 2020-12-12 12:12

I have a persistent multiple warning of \"unknown column\" for all types of commands (e.g., str(x) to installing updates on packages), and not sure how to debug this or fix

8条回答
  •  无人及你
    2020-12-12 12:41

    I get these warnings when I rename a column using dplyr::rename after reading it using the readr package.

    The old name of the column is not renamed in the spec attribute. So removing the the spec attribute makes the warnings go away. Also removing the "spec_tbl_df" class seems like a good idea.

    attr(dat, "spec") <- NULL
    class(dat) <- setdiff(class(dat), "spec_tbl_df")
    

提交回复
热议问题