Coder Social home page Coder Social logo

Comments (7)

juba avatar juba commented on July 27, 2024

Personnellement je pense que ça pourrait tout à fait intégrer questionr (sous réserve de l'accord de @briatte). La question serait de savoir si on fait une surcharge de addNA ou si on ajoute une fonction supplémentaire.

En tous cas si on surcharge addNA avec un argument as.string, il faut que ce dernier soit à FALSE par défaut pour ne pas modifier le comportement de code existant après chargement de questionr.

from questionr.

briatte avatar briatte commented on July 27, 2024

Le problème étant bien documenté et le coût de la surcharge minimal, je vote pour 👍 !

from questionr.

larmarange avatar larmarange commented on July 27, 2024

Il me semble plus pertinent de surcharger addNA en passant as.string à FALSE pour compatibilité. Par ailleurs, il est facile de permettre de personnaliser l'étiquette en passant directement une valeur texte à as.string ainsi :

addNA <- function (x, ifany = FALSE, as.string = FALSE)
{
    if (!is.factor(x)) 
        x <- factor(x)
    if (ifany & !any(is.na(x))) 
        return(x)
    ll <- levels(x)
    if (!any(is.na(ll))) 
        ll <- c(ll, NA)
    x <- factor(x, levels = ll, exclude = NULL)
    if (is.character(as.string)) {
         s <- as.string
         as.string <- TRUE
    } else
        s <- "NA"
    if(as.string) levels(x)[is.na(levels(x))] <- s
    x
}

from questionr.

larmarange avatar larmarange commented on July 27, 2024

Pull request proposée

from questionr.

juba avatar juba commented on July 27, 2024

After some thoughts, I'm not totally happy with the current function implementation. Please see Issue #18 for further discussion.

from questionr.

briatte avatar briatte commented on July 27, 2024

Would the issue go away if you called the function na.level or na.char for instance?

from questionr.

larmarange avatar larmarange commented on July 27, 2024

I would prefer a name as addNAstr

Joseph Larmarange
Le 7 nov. 2013 17:36, "François" [email protected] a écrit :

Would the issue go away if you called the function na.level or na.charfor instance?


Reply to this email directly or view it on GitHubhttps://github.com//issues/12#issuecomment-27981724
.

from questionr.

Related Issues (20)

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.