bionpad.blogg.se

Codebook spss
Codebook spss








codebook spss

# 9 ppltrst Most people can be trusted or you can't be too careful

#Codebook spss tv#

# 8 tvpol TV watching, news/politics/current affairs on average weekday # 7 tvtot TV watching, total time on average weekday # 5 idno Respondent's identification number This is how the command looks like: # let the magic happen Because this is in the wide format, having 600 variablesĪnd one row, we reshape it using the gather() command. Here we use a specific version of map which creates a dataset We simply apply the function that extracts the label attribute. Variable becomes x and then applies the function we want. Variables of a dataset and applies a function. We will us the map() function which is similar in spirit to a loop but it is moreĮfficient in R (it’s similar to sapply()). Need to use some programming skills to automate this. We don’t want to do this by hand for hundreds of variables so we This can be extracted using this code: attributes(df$tvtot)$label Here we will concentrate on extracting the # More than 2,5 hours, up to 3 hours More than 3 hours # More than 1,5 hours, up to 2 hours More than 2 hours, up to 2,5 hours # 0,5 hour to 1 hour More than 1 hour, up to 1,5 hours # "TV watching, total time on average weekday" # let's see attributes for tvtot variable We will use the attributes() command on the “tvtot” variable. Let’s check if it imported the attributes. We see it’s a moderately large dataset with around 40,000 cases and 600 # eimpcnt, impcntr, imbgeco, imueclt , # trstlgl, trstplc, trstplt, trstprt , # cptppol, ptcpplt, etapapl, trstprl , # polintr, psppsgv, actrolg, psppipl , with 40,175 more rows, and 591 more variables: pplhlp , # import data with labels from the "data" folder Get that info when only those are available. “tsv”, do not have labels so you might need to find an alternative way to I import the Stata version as this has the labels we want (otherįormats, like SPSS, also work). This is a freely available data that includes tens of countries and We will also use tidyverse which is a collection of packages that is useful for cleaning data.Īs an example I will be importing wave 7 of the European Social Survey. The advantage of such dataįormats is that it has information about the variables stored within. Other formats, such as from SPSS or Stata. We will use haven to import data saved in This is just anĮxample how you could do one in just a few lines. While there is no off the shelf way to get theĮquivalent it is very easy to create a codebook in R. ForĮxample, in SPSS you could easily see the variables codes, labels, Users miss is a way to see a description of all the variables in the data. There is also a relative steep learning curve compared to traditional Of the to go tools for statisticians and data scientists. The fact that it’s open source and incredibly flexible has made it one R is one of the most popular packages in the social and data sciences.










Codebook spss