[Rsiena-help] reading composition change dat files in R
Maarten Selfhout
maarten.vanzalk at oru.se
Fri May 28 10:14:03 CEST 2010
Dear Ruth,
I'm trying to include composition change variables and R, but having
troubles getting the files in the right format.
This is what I get from the Rsiena guide:
I have three waves. So anybody with all data should be
1 3
and someone with only data on wave 1 and 2 could be
1 2.5
someone who has data on wave 1, not at wave 2, and again has data on
wave 3 should be
1 1.5 2.5 3
However, when using this format, I get the following message:
> library(RSiena)
> library(snow)
> library(rlecuyer)
> setwd('/Users/maartenselfhout/Desktop/sex and friends/school1')
> net.w1 <- as.matrix(read.table("W1SIENA.dat"))
> net.w2 <- as.matrix(read.table("W2SIENA.dat"))
> net.w3 <- as.matrix(read.table("W3SIENA.dat"))
> sex <- as.matrix(read.table("sex.dat"))
> mat <- as.matrix(read.table("mat.dat"))
> comp <- as.matrix(read.table("joinleave.dat"))
Error in scan(file, what, nmax, sep, dec, quote, skip, nlines,
na.strings, :
line 85 did not have 2 elements
And when I tried to do the following for people who only have 1 wave
of data
1 1
for wave 1
or
2 2 for wave 2
R reads the data without problems, but I get the following error
> comp2 <- sienaCompositionChange(comp)
Error in sienaCompositionChange(comp) : changelist must be a list
What am I doing wrong in the format? I've attached my latest file
(joinleave.dat)
Here is thew whole syntax as well thus far
> library(RSiena)
> library(snow)
> library(rlecuyer)
> setwd('/Users/maartenselfhout/Desktop/sex and friends/school1')
> net.w1 <- as.matrix(read.table("W1SIENA.dat"))
> net.w2 <- as.matrix(read.table("W2SIENA.dat"))
> net.w3 <- as.matrix(read.table("W3SIENA.dat"))
> sex <- as.matrix(read.table("sex.dat"))
> mat <- as.matrix(read.table("mat.dat"))
> comp <- as.matrix(read.table("joinleave.dat"))
Error in scan(file, what, nmax, sep, dec, quote, skip, nlines,
na.strings, :
line 85 did not have 2 elements
> comp <- as.matrix(read.table("joinleave.dat"))
> comp2 <- sienaCompositionChange(comp)
Error in sienaCompositionChange(comp) : changelist must be a list
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: joinleave.dat
Type: application/octet-stream
Size: 1860 bytes
Desc: not available
URL: <http://lists.r-forge.r-project.org/pipermail/rsiena-help/attachments/20100528/2ed1a512/attachment.obj>
-------------- next part --------------
Thank you so much for your help!
Maarten
More information about the Rsiena-help
mailing list