[Rsiena-help] reading composition change dat files in R
Ruth M. Ripley
ruth at stats.ox.ac.uk
Fri May 28 13:01:47 CEST 2010
Dear Maarten,
Try using the function sienaCompositionChangeFromFile, which should cope
with the unusual data format. You need an even number of numbers on each
row. If you only have one set of data for an actor, eg wave 2 out of
three, I would suggest 1.5 2.5 or some such so that the actor does
participate a little in the simulation (assuming that they could!).
For the other errors, please can you send me the result of calling the
sessionInfo() command. You might try a 'clean' working directory too.
Regards,
Ruth
--
On Fri, 28 May 2010, Maarten Selfhout wrote:
> 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
>
More information about the Rsiena-help
mailing list