@@ -37,7 +37,6 @@ relationalEventModeling <- function(jaspResults, dataset, options) {
37
37
# create a container for the main results that passes down dependencies to everything saved withiin
38
38
.remMainContainer(jaspResults , options )
39
39
40
-
41
40
ready <- (options [[" timeVariable" ]] != " " ) && (options [[" actorVariableSender" ]] != " " ) && (options [[" actorVariableReceiver" ]] != " " )
42
41
43
42
if (ready && ! options [[" syncAnalysisBox" ]]) {
@@ -49,7 +48,7 @@ relationalEventModeling <- function(jaspResults, dataset, options) {
49
48
50
49
if (ready && options [[" syncAnalysisBox" ]]) {
51
50
52
- dataset <- .remReadData (jaspResults , dataset , options )
51
+ dataset <- .remHandleData (jaspResults , dataset , options )
53
52
54
53
.remErrorHandling(jaspResults , dataset , options )
55
54
@@ -438,10 +437,7 @@ relationalEventModeling <- function(jaspResults, dataset, options) {
438
437
439
438
440
439
# ----------- Main analysis -------------
441
- .remReadData <- function (jaspResults , dataset , options ) {
442
-
443
- if (! is.null(dataset ))
444
- return (dataset )
440
+ .remHandleData <- function (jaspResults , dataset , options ) {
445
441
446
442
variables <- c(options $ timeVariable , options $ actorVariableSender , options $ actorVariableReceiver )
447
443
if (options $ weightVariable != " " ) {
@@ -461,10 +457,11 @@ relationalEventModeling <- function(jaspResults, dataset, options) {
461
457
tmp1 <- lapply(exoEffects , function (x ) names(x ) == " event" )
462
458
tmp2 <- unlist(lapply(tmp1 , any ))
463
459
eventNames <- unique(names(tmp2 [tmp2 ]))
464
- variables <- c(variables , jaspBase :: encodeColNames(eventNames ))
460
+ eventIndices <- which(eventNames == decodeColNames(colnames(dataset )))
461
+ variables <- c(variables , colnames(dataset )[eventIndices ])
465
462
}
466
463
467
- dataset <- .readDataSetToEnd( columns = variables )
464
+ dataset <- dataset [, variables ]
468
465
469
466
colnames(dataset )[1 : 3 ] <- jaspBase :: encodeColNames(c(" time" , " actor1" , " actor2" ))
470
467
@@ -677,7 +674,6 @@ relationalEventModeling <- function(jaspResults, dataset, options) {
677
674
return ()
678
675
}
679
676
680
-
681
677
# in the first round both states are created
682
678
statsObject <- try(remstats :: remstats(reh = rehObject , tie_effects = ties , sender_effects = senders ,
683
679
receiver_effects = receivers ,
@@ -1678,15 +1674,16 @@ relationalEventModeling <- function(jaspResults, dataset, options) {
1678
1674
exoEffects [ii ] <- sub(" (\\ '.*?)\\ '" , paste0(" \\ 1', " , dtName ), exoEffects [ii ])
1679
1675
}
1680
1676
1681
- } else { # everything that is not event and tie is also in the attr actors object
1682
- ma <- regexpr(" '(.*?)'" , exoEffects [ii ])
1683
- effVarName <- gsub(" '" , " " , regmatches(exoEffects [ii ], ma ), fixed = TRUE )
1684
- ind <- grep(effVarName , actorVarNames )
1685
- if (length(ind ) > 0 ) {
1686
- dtName <- actorDataNames [[ind ]]
1687
- exoEffects [ii ] <- sub(" (\\ '.*?)\\ '" , paste0(" \\ 1', " , dtName ), exoEffects [ii ])
1677
+ } else { # everything that is not event and tie is also in the attr actors object (if that exists)
1678
+ if (! is.null(actorDataList )) {
1679
+ ma <- regexpr(" '(.*?)'" , exoEffects [ii ])
1680
+ effVarName <- gsub(" '" , " " , regmatches(exoEffects [ii ], ma ), fixed = TRUE )
1681
+ ind <- grep(effVarName , actorVarNames )
1682
+ if (length(ind ) > 0 ) {
1683
+ dtName <- actorDataNames [[ind ]]
1684
+ exoEffects [ii ] <- sub(" (\\ '.*?)\\ '" , paste0(" \\ 1', " , dtName ), exoEffects [ii ])
1685
+ }
1688
1686
}
1689
-
1690
1687
}
1691
1688
1692
1689
exoDims <- append(exoDims , dimstmp )
0 commit comments