Comments (7)
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.
Le problème étant bien documenté et le coût de la surcharge minimal, je vote pour 👍 !
from questionr.
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.
Pull request proposée
from questionr.
After some thoughts, I'm not totally happy with the current function implementation. Please see Issue #18 for further discussion.
from questionr.
Would the issue go away if you called the function na.level
or na.char
for instance?
from questionr.
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)
- Bugs in irec()? HOT 5
- Remove `dplyr::recode` in `irec`
- Fix error in `irec` when `forcats` or `dplyr` are not loaded
- Utiliser fct_relevel pour réordonner les modalités d'un facteur HOT 2
- Découpage interactif avec des années HOT 4
- error message styler HOT 2
- na.rm et na.show avec wtd.table HOT 7
- Easy ggplot2 from survey objects HOT 5
- Syntax forcats des add-in HOT 8
- Error in describe for a labelled vector with only NAs HOT 1
- questionr deprecated functions na.rm & na.show HOT 3
- Inclure la borne supérieure par défaut dans `icut` ? HOT 2
- Erreur avec questionr:::irec() HOT 6
- Levels recoding not working HOT 6
- Level recoding HOT 3
- error in factor ordering and recoding when colnames starts with a number HOT 2
- Problème d'installation du package questionr HOT 5
- Erreur au chargement de questionr : "erreur : spécification de version incorrecte ‘1,5’" HOT 6
- Remove Linux requirement HOT 3
- `wtd.table` ne marche pas avec des vecteurs `labelled`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from questionr.