Best of luck.
On Sat, 8 Feb 2020 at 10:36, Yawo Kokuvi wrote:
> Thanks again - I realized after posting that sjlabelled is indirectly
> referencing haven's read_sav function. For a moment I thought you were
> referring to the read.spss under the older foreign package. But then
> realized that
Thanks again - I realized after posting that sjlabelled is indirectly
referencing haven's read_sav function. For a moment I thought you were
referring to the read.spss under the older foreign package. But then
realized that read_sav and read_spss are equivalent. So that's clear now.
And I also r
"use a different function (read_spss) as John has suggested to import the
file. "
No! As far as I can see sjlabelled is simply using haven"s function "
read_sav()" to read in the data. It is just wrapped in the "read.spss()
function.There should be no difference between read_sav(sdata.sav) and
rea
Thanks so much for all your assistance. I admit R's learning curve is a
bit steep, but I am eager to learn ... and hopefully teach with it.
with regard to my problem, I can now see two options: either declare each
categorical variable as factors, specifying the needed levels and labels.
OR
use
Hi Yawo Kokuvi;
As an R newbie transitioning from SPSS to R expect culture shock and the
possible feeling that yor brain is twisting within your skull but it is
well worth.
Try something like this:
##+
dat1 <- structure(list(Animal =
Hello,
Try
aux_fun <- function(x){
levels <- attr(x, "labels")
factor(x, labels = names(levels), levels = levels)
}
newCatsDogs <- as.data.frame(lapply(CatsDogs, aux_fun))
str(newCatsDogs)
#'data.frame': 10 obs. of 3 variables:
# $ Animal : Factor w/ 2 levels "Cat","Dog": 1 1 1 1 1 1 1
6 matches
Mail list logo