Comments (10)
I have posted an "example workflow" in my blog, maybe this is helpful, too:
https://strengejacke.wordpress.com/2016/12/22/exploring-the-european-social-survey-ess-pipe-friendly-workflow-with-sjmisc-part-2-rstats-tidyverse/
from sjmisc.
I think it is useful to know that if you have defined categories, to see if these have counts or not. Especially if you're not yet familiar with the data, you can see what information is missing, which might be of interest.
Typically, you should call drop_labels()
directly after loading the data, if you really don't need the labels:
d <- read_stata('GLES_Vorwahlquerschnitt_ZA5700_v1-0-0.dta')
vars <- select(d, q41, q119a, q192, q11ba) %>% drop_labels()
sjt.xtab(vars$q41, vars$q11ba)
I'm just curious why haven does not tag values as NA - don't these variables have any defined missings in the original Stata file?
from sjmisc.
Nope they don't. They are just regular (most of the time negative) numbers.
from sjmisc.
It looks like you're using public data - I bet there's an SPSS-file you could use.
from sjmisc.
As I am also dealing with this kind of question at the moment: I was wondering if one could directly manipulate the labels by using attributes()
? In my case I would like to keep or drop some of them and change others.
from sjmisc.
You can use set_labels()
with named vectors, or directly attr(x, "labels") <- ...
.
from sjmisc.
Given this case:
> get_labels(dt_imp_org[[9]])
[1] "homme" "femme" "pas d'indication"
> attr(dt_imp_org[[9]], "labels")
homme femme pas d'indication
1 2 7
How can I remove "pas d'indication" but keep the other labels by using set_labels()
?
from sjmisc.
You can use remove_labels()
to remove specific labels, or set only those labels you like with
set_labels(dt_imp_org[[9]]) <- c(`homme` = 1, `femme` = 2)
Following online-vignette might be interesting for you as well: http://strengejacke.de/sjPlot/sjmisc/
from sjmisc.
Btw, @pascaltanner you can also print values in get_labels()
:
get_labels(dt_imp_org[[9]], include.values = "n")
get_labels(dt_imp_org[[9]], include.values = "p")
from sjmisc.
Thank you.
from sjmisc.
Related Issues (20)
- Rec bug with "lo" characters
- select_helpers not working HOT 1
- Important bug in Rec HOT 2
- the speed of "rec" function slow when I use mutate with large dataset
- `move_columns` does not work when passed a variable in .after HOT 1
- rec and space strings
- Frequency of characters coercible as numerics
- Use str_contains for dataframe? HOT 2
- merge_imputations only providing a subset of variables
- Merges multiple imputed data frames into a single data frame HOT 3
- row_means() proportion of datapoints HOT 2
- FR: allow more printing formatting for frq HOT 1
- weights argument fails when using dplyr group_by
- frq fails when used for more than 1 variable and after `dplyr::group_by`
- Does not merge when data are in long format HOT 1
- Feature request: use -c syntax for descr "show" argument
- Issue with weighted percentage in `flat_table()`
- Issue with rec() else=copy not passing old labels
- sjmisc::rec() - val.labels function is not working
- sjmisc::rec generated factors not in the expected order
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 sjmisc.