import SPSS in LAVAAN

333 views
Skip to first unread message

bert verleysen

unread,
Apr 11, 2013, 8:17:46 AM4/11/13
to lav...@googlegroups.com
I have a R-file in "my documents'
in this R-file I have a file "hulp"
in this file 'hulp' I have a SPSS-file "HECHTING_DECEMBER_2012.sav"

my commands in script:

setwd("c:/hulp");

getwd();

install.packages("foreign"); library(foreign);

y=read.spss(file="HECHTING_DECEMBER_2012.sav", use.value.labels = FALSE,

to.data.frame = TRUE, max.value.labels = Inf, trim.factor.names = FALSE,

trim_values = TRUE, reencode = NA, use.missings = 0);

error-message:

> y=read.spss(file="HECHTING_DECEMBER_2012.sav", use.value.labels = FALSE,

+ to.data.frame = TRUE, max.value.labels = Inf, trim.factor.names = FALSE,

+ trim_values = TRUE, reencode = NA, use.missings = 0);

Error in read.spss(file = "HECHTING_DECEMBER_2012.sav", use.value.labels = FALSE,  :

  unable to open file: 'No such file or directory'


What have I done wrong?

Thank you very much
Bert Verleysen
be...@beverconsult.be






yrosseel

unread,
Apr 11, 2013, 8:44:16 AM4/11/13
to lav...@googlegroups.com
On 04/11/2013 02:17 PM, bert verleysen wrote:
> Error in read.spss(file = "HECHTING_DECEMBER_2012.sav", use.value.labels
> = FALSE, :
>
> unable to open file: 'No such file or directory'

This is more a question for R-help, since it is unrelated to lavaan.

But the error message tells you that the file
'HECHTING_DECEMBER_2012.sav' is simply not found in the current directory.

You could use a full path, like this:

file="c:/hulp/HECHTING_DECEMBER_2012.sav"

but you need to double check that the file is indeed in that directory
under that name.

Hth,

Yves.

Florian Bader

unread,
Apr 11, 2013, 10:22:47 AM4/11/13
to lav...@googlegroups.com

c:/hulp/x.sav is simply not C:\Users\x\Documents\rstuff\hulp\x.sav

use dir() (r-function) to check the files in your folders!

flo
Reply all
Reply to author
Forward
0 new messages