Giter Site home page Giter Site logo

crosswalkr's Introduction

Packages

Course/lessons focused on coding/quantitative research

Replication files

Each paper is linked in the repository README or on my webpage (contact me if you need access)

General

crosswalkr's People

Contributors

btskinner avatar northeastloon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

northeastloon

crosswalkr's Issues

Bug in renamefrom() resulting in an error with labelled version 2.1.0

Dear @btskinner

Labelled version 2.1.0 will be released soon. In this new version, additional checking have been added to var_label(). The examples provided with renamefrom() with now produce an error.

It seems that the problem is

labelled::var_label(.data) <- null_label_list

When exploring the problem with the debugger, it appeared that the value of null_label_list was

$<NA>
NULL

Best regards

Test failure with dev version of haven

   > test_check("crosswalkr")
    1. Failure: Failed to assign proper values (@test-encodefrom.R#67) 
    haven::zap_labels(vec) not equal to `act_vals`.
    Attributes: < Modes: list, NULL >
    Attributes: < Lengths: 2, 0 >
    Attributes: < names for target but not for current >
    Attributes: < current is not list-like >
    target is labelled, current is character

I'm not sure exactly what is causing this, but it's probably related to the changes to the labelled class.

Could you please take a look? I'm planning on submitting haven 2.0 to CRAN on November 7

Drop of columns with upper-case names

Dear @btskinner, first of all, thank you so much for the package!

There is a question relating to the case_ignore and drop_extra arguments. It seems that if both of them are TRUE, it leads to an undeliberate drop is the upper-case names of the .data data frame, as reported in this question.

As I can see, that is connected with the following renamefrom_( ) code chunk

names_ <- names(.data)
if (case_ignore) {
    names_ <- tolower(names_)
}
if (drop_extra) {
    .data <- .data[names_ %in% cw[[raw]]]
    names_ <- names(.data)
    if (case_ignore) {
        names_ <- tolower(names_)
    }
}

So, if case_ignore == TRUE, we first change all the column names to the lower case. Then if drop_extra == TRUE we compare these lower-cased names with the raw ones, which leads to the drop of the columns which names we have just modified ourselves.

Probably, it makes sense to add an additional case_ignore -check into the drop_extra-statement? Something like this:

if (drop_extra) {
    if (case_ignore) {
        .data <- .data[names_ %in% tolower(cw[[raw]])]
    } else {
        .data <- .data[names_ %in% cw[[raw]]]
    }
    names_ <- names(.data)
}  

Best regards

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.