Giter Club home page Giter Club logo

Comments (10)

sjPlot avatar sjPlot commented on May 25, 2024 1

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.

sjPlot avatar sjPlot commented on May 25, 2024

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.

cschwem2er avatar cschwem2er commented on May 25, 2024

Nope they don't. They are just regular (most of the time negative) numbers.

from sjmisc.

sjPlot avatar sjPlot commented on May 25, 2024

It looks like you're using public data - I bet there's an SPSS-file you could use.

from sjmisc.

pascaltanner avatar pascaltanner commented on May 25, 2024

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.

sjPlot avatar sjPlot commented on May 25, 2024

You can use set_labels() with named vectors, or directly attr(x, "labels") <- ....

from sjmisc.

pascaltanner avatar pascaltanner commented on May 25, 2024

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.

sjPlot avatar sjPlot commented on May 25, 2024

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.

sjPlot avatar sjPlot commented on May 25, 2024

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.

pascaltanner avatar pascaltanner commented on May 25, 2024

Thank you.

from sjmisc.

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.