TryHarder01
TryHarder01

Reputation: 48

How to do "Weight by..." (SPSS function) in R?... Trying to weigh Likert Scale responses

My boss asked me to help look at some survey data, but they don't have an extra SPSS or STATA license to run on my computer, so they can't show me how to do this from my setup the way they do it. Instead they "allowed me" to download R and try to do it.

I know in SPSS there's a "Weight by..." Option, and you choose the column with the weights and poof... then you do all your calculations.

I'm trying to figure out how to do this from R, and I've been reading the Weights package and Survey package.

The first calculation I need to run is from a Likert scale column and my WEIGHT vector has these large numbers:

121958 125463
99638 125463 102539 181061 126367 125463

The only other time I've done this was when I took a stats test as part of the interview process, and they let me use SPSS and then I just applied the weights... I don't remember how, but I feel like the Likert analysis was a lot easier on SPSS too.

They want (as a %) Very and Extremely / the total responses....

It's not helping that I'm furious about this internship. My boss made it sound like they were doing me a favor by actually letting me try and do something with the data, but they have no idea how to program in R and they don't have any open seats with SPSS or STATA, which they know how to use... So they can't actually give me any direction about how to accomplish this.... And of course they said "don't worry, we don't need you to do it..." But I'm dying to do something at this internship, and I really want to know HOW to do this thing... I just don't know how to find out how to do it.

I saw this on Stack Overflow, but even while looking at the xtabs help files I can't find a way to apply that to my data file. I tried this code

xtabs(weight ~ FWGT, data=data2)

Error in as.data.frame.default(data, optional = TRUE) : 
  cannot coerce class ""function"" to a data.frame`

Then tried:

xtabs(weight ~ FWGT, data2=df)0

Error in eval(expr, envir, enclos) : object 'weight' not found

My Weight vector is FWGT, and my data set is data2

Here's what I found when I searched around Stack Overflow:

In SPSS I would write

WEIGHT BY weight.

and all procedures after that command will weight the data accordingly. In R I can do that with stabs with the command

xtabs(weight ~ UH6401, data=df)

From https://stackoverflow.com/a/7026980

Upvotes: 0

Views: 2166

Answers (1)

rmuc8
rmuc8

Reputation: 2989

there is a package called likert in R

type in

install.packages("likert")

to install it.

you can find the documentation here http://cran.r-project.org/web/packages/likert/likert.pdf

Upvotes: 1

Related Questions