Questions tagged [labelled]

8 questions
2
votes
2 answers

rename variables with variable labels in R

I am forever working with collaborators in SPSS and STata so clear variable labels are really important to communiate what has been done to any given variable and what it records. How do I rename variables with their variable labels most efficiently…
spindoctor
  • 1,719
  • 1
  • 18
  • 42
1
vote
1 answer

Using label as value while having negative values

im trying to use the labels from a dataset as the values instead. The dataset was imported from a .sav file using haven. I tried (and suceeded with different data) with this: df %>% mutate(state = get_labels(state)[state]) Now i have two…
1
vote
2 answers

Modify encodings of accented characters in value labels

I am having a very hard time with accented characters in a stata file I have to import into R. I solved one problem over here, but there's another problem. After import, anytime I use the lookfor command in the labelled package I get this…
spindoctor
  • 1,719
  • 1
  • 18
  • 42
0
votes
1 answer

Turn a Character Vector into Numeric Vector with labels

This seems extremely basic but I cannot find an efficient way to do this: I have character vector s<-c("LabelB","LabelX", "LabelE", "LabelE", "LabelX", "LabelD", "LabelB") What I want is a numeric vector where the numbers can be interpreted…
Zahra
  • 17
  • 4
0
votes
0 answers

I wanted to know if there are datasets available for sentiment analysis in spanish with labelled data like positive and negative

I have been searching for a sentiment analysis dataset which contains the data in spanish and labelled data with positive and negative remarks which can be used to train/fine tune a pre-trained model. I have been searching for a dataset but could…
0
votes
1 answer

How to Add Column Labels When Piping in R with dplyr and labelled?

Is it possible to create column labels while piping in R with dplyr? E.g. something like: df <- mtcars %>% some_lovely_function_for_labels(mpg = 'Miles per gallon') Perhaps the solution could work for a list of variable-labels pairs. I've…
Brendan
  • 166
  • 1
  • 4
0
votes
1 answer

How to filter a labelled tibble in R

I want to filter df tibble using the variable s2 with values 2 and 3. I get a new tibble df2 that keeps showing also the value 1 of s2. How can I create a new tibble with only the filtered values of df? library(dplyr) #> #> Attaching package:…
sbac
  • 1,897
  • 1
  • 18
  • 31
0
votes
1 answer

R labelled values functions to sort labels or drop unused labels do nothing. Why?

My question relates to library(haven) library(labelled) library(sjlabelled) What I am trying to do is clean up some labelled data from SPSS prior to conversion for factors so I can run regressions that make sense. This means getting rid of those…
Peter King
  • 91
  • 8