2

I have recently learnt the command dput() thanks to SO users. The issue now is that I don't understand the output. I am wanting to understand the data for my variable edu.deg.level. I can see there are 10 values in a list format but I do not understand what 1L, 0L mean or what they are assigned to. Here's the code:

> dput(head(df1,10))
 structure(list(edu.degree.level = c(1L, 0L, 1L, 1L, 0L, 1L, 1L, 
 1L, 1L, 0L), immig.view = structure(c(7, 4, 5, 1, 7, 5, 7, 1, 3, 1), 
 label = "J1 Do you think immigration is good or bad for Britain's economy?", 
 labels = c(`Not stated` = -999, 
`Don`t know` = -1, `1 Bad for economy` = 1, `2` = 2, `3` = 3, 
`4` = 4, `5` = 5, `6` = 6, `7 Good for economy` = 7), class = "haven_labelled")), 
 row.names = c(NA, 10L), class = "data.frame")

Many thanks!

NelsonGon
  • 13,015
  • 7
  • 27
  • 57

1 Answers1

1

There are two main types "numeric" atomic vectors to think of in R. The first is "integers", or counting numbers, think of these as numbers like you would use for counting etc. -2, -1, 0, 1, 2, 3... The other is the "double" type or real numbers which is numbers that can be anywhere along an infinitely long number line, e.g. -8.43, -2.10, 0.001, 18.2797615.

Following the number with an L simply tells R they are integers not real numbers. In your dput it is simply that the column is full of 1s and 0s and that these are integers.

rg255
  • 4,119
  • 3
  • 22
  • 40
  • Thanks for the thorough explanation. Very useful! – Honey Badger Apr 08 '20 at 13:28
  • I now understand 10 integers for the variable as 1 or 0 but I still don't understand why the list has x10 when there are only x9 for the variable immig.view. Here is the r output: Labels: value label -999 Not stated -1 Don`t know 1 1 Bad for economy 2 2 3 3 4 4 5 5 6 6 7 7 Good for economy – Honey Badger Apr 08 '20 at 14:52