Last updated on 2020-03-07 11:48:32 CET.
Flavor | Version | Tinstall | Tcheck | Ttotal | Status | Flags |
---|---|---|---|---|---|---|
r-devel-linux-x86_64-debian-clang | 1.6.5 | 27.42 | 93.78 | 121.20 | ERROR | |
r-devel-linux-x86_64-debian-gcc | 1.6.5 | 20.31 | 72.96 | 93.27 | ERROR | |
r-devel-linux-x86_64-fedora-clang | 1.6.5 | 152.86 | ERROR | |||
r-devel-linux-x86_64-fedora-gcc | 1.6.5 | 142.73 | ERROR | |||
r-devel-windows-ix86+x86_64 | 1.6.5 | 79.00 | 139.00 | 218.00 | OK | |
r-devel-windows-ix86+x86_64-gcc8 | 1.6.5 | 60.00 | 141.00 | 201.00 | OK | |
r-patched-linux-x86_64 | 1.6.5 | 21.26 | 78.78 | 100.04 | OK | |
r-patched-solaris-x86 | 1.6.5 | 191.90 | OK | |||
r-release-linux-x86_64 | 1.6.5 | 22.39 | 78.05 | 100.44 | OK | |
r-release-windows-ix86+x86_64 | 1.6.5 | 53.00 | 127.00 | 180.00 | OK | |
r-release-osx-x86_64 | 1.6.5 | OK | ||||
r-oldrel-windows-ix86+x86_64 | 1.6.5 | 38.00 | 124.00 | 162.00 | OK | |
r-oldrel-osx-x86_64 | 1.6.5 | OK |
Version: 1.6.5
Check: examples
Result: ERROR
Running examples in 'tnam-Ex.R' failed
The error most likely occurred in:
> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: tnam
> ### Title: Fit (temporal) network autocorrelation models
> ### Aliases: tnam tnamdata
>
> ### ** Examples
>
> # The following example models delinquency among adolescents at
> # multiple time steps as a function of (1) their nodal attributes
> # like sex or religion, (2) their peers' delinquency levels, (3)
> # their own and their peers' past delinquency behavior, and (4)
> # their structural position in the network. See ?knecht for
> # details on the dataset. Before estimating the model, all data
> # should be labeled with the names of the nodes such that tnam
> # is able to merge the information on multiple nodes across time
> # points.
>
> library("tnam")
> data("knecht")
>
> # prepare the dependent variable y
> delinquency <- as.data.frame(delinquency)
> rownames(delinquency) <- letters
>
> # replace structural zeros (denoted as 10) and add row labels
> friendship[[3]][friendship[[3]] == 10] <- NA
> friendship[[4]][friendship[[4]] == 10] <- NA
> for (i in 1:length(friendship)) {
+ rownames(friendship[[i]]) <- letters
+ }
>
> # prepare the covariates sex and religion
> sex <- demographics$sex
> names(sex) <- letters
> sex <- list(t1 = sex, t2 = sex, t3 = sex, t4 = sex)
> religion <- demographics$religion
> names(religion) <- letters
> religion <- list(t1 = religion, t2 = religion, t3 = religion,
+ t4 = religion)
>
> # Estimate the model. The first term is the sex of the respondent,
> # the second term is the religion of the respondent, the third
> # term is the previous delinquency behavior of the respondent,
> # the fourth term is the delinquency behavior of direct friends,
> # the fifth term is the delinquency behavior of indirect friends
> # at a path distance of 2, the sixth effect is the past delinquency
> # of direct friends, the seventh term indicates whether the
> # respondent has any contacts at all, and the last term captures
> # the effect of the betweenness centrality of the respondent on
> # his or her behavior. Apparently, previous behavior, being an
> # isolate, and religion seem to have an effect on delinquency in
> # this dataset. There is also a slight positive trend over time,
> # and direct friends exert a minor effect (not significant).
> # Note that a linear model may not be the best specification for
> # modeling the ordered categorical delinquency variable, but it
> # suffice here for illustration purposes.
>
> model1 <- tnam(
+ delinquency ~
+ covariate(sex, coefname = "sex") +
+ covariate(religion, coefname = "religion") +
+ covariate(delinquency, lag = 1, exponent = 1) +
+ netlag(delinquency, friendship) +
+ netlag(delinquency, friendship, pathdist = 2, decay = 1) +
+ netlag(delinquency, friendship, lag = 1) +
+ degreedummy(friendship, deg = 0, reverse = TRUE) +
+ centrality(friendship, type = "betweenness"),
+ re.node = TRUE, time.linear = TRUE
+ )
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
tnam
--- call from context ---
checkDataTypes(y = y, networks = networks, lag = lag)
--- call from argument ---
if (class(networks[[i]]) != "matrix") {
tryCatch({
networks[[i]] <- as.matrix(networks[[i]])
}, error = function(e) {
stop(paste0("At t=", i, ", the object in the 'networks' list could ",
"not be converted to a matrix object."))
})
}
--- R stacktrace ---
where 1: checkDataTypes(y = y, networks = networks, lag = lag)
where 2: netlag(delinquency, friendship)
where 3: eval(parse(text = rhs[i]))
where 4: eval(parse(text = rhs[i]))
where 5: tnamdata(formula, center.y = center.y)
where 6: tnam(delinquency ~ covariate(sex, coefname = "sex") + covariate(religion,
coefname = "religion") + covariate(delinquency, lag = 1,
exponent = 1) + netlag(delinquency, friendship) + netlag(delinquency,
friendship, pathdist = 2, decay = 1) + netlag(delinquency,
friendship, lag = 1) + degreedummy(friendship, deg = 0, reverse = TRUE) +
centrality(friendship, type = "betweenness"), re.node = TRUE,
time.linear = TRUE)
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (y, networks = NULL, lag = 0)
{
if (is.null(y) && is.null(networks)) {
stop("No 'y' and 'networks' arguments were provided.")
}
stopmsg <- paste0("The data type of the 'y' argument is '",
class(y), "'. 'y' must be provided as a numeric vector, a list of numeric ",
"vectors, or a data frame with numeric columns.")
if (is.null(y)) {
}
else if (class(y) == "list") {
}
else if (class(y) == "data.frame") {
time.steps <- ncol(y)
y.copy <- y
y <- list()
for (i in 1:ncol(y.copy)) {
y[[i]] <- y.copy[, i]
names(y[[i]]) <- rownames(y.copy)
}
rm(y.copy)
}
else if (class(y) == "matrix") {
stop(stopmsg)
}
else if (class(y) == "integer") {
current.names <- names(y)
y <- as.numeric(y)
names(y) <- current.names
y <- list(y)
}
else if (class(y) == "numeric") {
y <- list(y)
}
else if (class(y) == "character") {
y <- list(y)
}
else {
tryCatch({
current.names <- names(y)
y <- as.numeric(y)
names(y) <- current.names
y <- list(y)
}, error = function(e) {
stop(stopmsg)
})
}
if (!is.null(y)) {
for (i in 1:length(y)) {
cl <- class(y[[i]])
stopmsg <- paste0("At t=", i, ", 'y' contains ",
cl, " objects. 'y' ", "must be provided as a numeric vector, a list of numeric vectors, ",
"or a data frame with numeric columns.")
if (is.integer(y[[i]])) {
current.names <- names(y[[i]])
y[[i]] <- as.numeric(y[[i]])
names(y[[i]]) <- current.names
}
else if (cl == "character") {
stop(stopmsg)
}
else {
tryCatch({
current.names <- names(y[[i]])
y[[i]] <- as.numeric(y[[i]])
names(y[[i]]) <- current.names
}, error = function(e) {
stop(stopmsg)
})
}
}
}
if (is.null(networks)) {
}
else if (class(networks) == "matrix") {
networks <- list(networks)
}
else if (class(networks) == "network") {
networks <- list(as.matrix(networks))
}
else if (class(networks) == "list") {
}
else {
networks <- list(networks)
}
if (!is.null(networks)) {
for (i in 1:length(networks)) {
if (class(networks[[i]]) != "matrix") {
tryCatch({
networks[[i]] <- as.matrix(networks[[i]])
}, error = function(e) {
stop(paste0("At t=", i, ", the object in the 'networks' list could ",
"not be converted to a matrix object."))
})
}
if (storage.mode(networks[[i]]) != "numeric") {
tryCatch({
storage.mode(networks[[i]]) <- "numeric"
}, error = function(e) {
stop(paste0("At t=", i, ", the matrix in the 'networks' list does ",
"not contain numeric values."))
})
}
}
}
if (!is.null(y) && !is.null(networks) && length(y) != length(networks)) {
if (length(y) == 1 && length(networks) > 1) {
stop(paste("'y' has only one time step, but the network has multiple ",
"time steps."))
}
else if (length(y) > 1 && length(networks) == 1) {
for (i in length(y)) {
networks[[i]] <- networks[[1]]
}
}
else {
stop(paste0("There should be the same number of elements in 'y' and ",
"'networks'. There are ", length(y), " elements in 'y' and ",
length(networks), " elements in 'networks'."))
}
}
if (!is.null(y) && !is.null(networks)) {
for (i in 1:length(y)) {
if (length(y[[i]]) != nrow(networks[[i]])) {
if (is.null(rownames(networks[[i]]))) {
stop(paste0("The dimensions of 'y' and 'networks' differ at t=",
i, ", and the network (matrix) does not contain row names."))
}
else if (is.null(names(y[[i]]))) {
stop(paste0("The dimensions of 'y' and 'networks' differ at t=",
i, ", and the elements in 'y' are not named."))
}
else {
message(paste0("Dimensions of 'y' and 'networks' do not match at ",
"t=", i, ". Trying to adjust them mutually."))
y[[i]] <- xergm.common::adjust(y[[i]], networks[[i]],
add = FALSE)
networks[[i]] <- xergm.common::adjust(networks[[i]],
y[[i]], add = FALSE)
}
}
if (!is.null(names(y[[i]])) && !is.null(rownames(networks[[i]])) &&
!all(names(y[[i]]) == rownames(networks[[i]]))) {
warning(paste("At t=", i, "the names of 'y' and the row names of",
"'networks' do not match."))
}
if (is.null(rownames(networks[[i]])) && !is.null(names(y[[i]]))) {
rownames(networks[[i]]) <- names(y[[i]])
}
else if (is.null(names(y[[i]])) && !is.null(rownames(networks[[i]]))) {
names(y[[i]]) <- rownames(networks[[i]])
}
else if (is.null(rownames(networks[[i]])) && is.null(names(y[[i]]))) {
names(y[[i]]) <- 1:length(y[[i]])
rownames(networks[[i]]) <- 1:nrow(networks[[i]])
}
}
}
if (is.null(y)) {
for (i in 1:length(networks)) {
if (is.null(rownames(networks[[i]]))) {
rownames(networks[[i]]) <- 1:nrow(networks[[i]])
if (i > 1) {
if (nrow(networks[[i]]) != nrow(networks[[i -
1]])) {
stop(paste0("No row names in 'networks' at t=",
i, ". Tried to ", "create custom row names, but the dimensions differ from ",
"the previous time point."))
}
if (!all(rownames(networks[[i]]) == rownames(networks[[i -
1]]))) {
stop(paste0("At t=", i, ", the row names of the network matrix ",
"do not match the row names of the previous time step."))
}
}
}
}
}
if (is.null(networks)) {
for (i in 1:length(y)) {
if (is.null(names(y[[i]]))) {
names(y[[i]]) <- 1:length(y[[i]])
if (i > 1) {
if (length(y[[i]]) != length(y[[i - 1]])) {
stop(paste0("No names in 'y' vector at t=",
i, ". Tried to ", "create custom names, but the length differs from ",
"the previous time point."))
}
if (!all(names(y[[i]]) == names(y[[i - 1]]))) {
stop(paste0("At t=", i, ", the names of the 'y' vector ",
"do not match the names of the previous time step."))
}
}
}
}
}
if (!is.null(y)) {
n <- length(y)
}
else {
n <- length(networks)
}
if (!is.numeric(lag)) {
stop("The 'lag' argument must be numeric.")
}
else if (length(lag) > 1) {
stop("The 'lag' argument must be of length 1.")
}
else if (lag < 0) {
stop("The 'lag' argument must be >= 0.")
}
else if (n - lag < 1) {
if (n == 1) {
stop(paste("A lag of", lag, "was specified, but there is only",
"one time step."))
}
else {
stop(paste("A lag of", lag, "was specified, but there are only",
n, "time steps."))
}
}
objects <- list()
objects$y <- y
objects$networks <- networks
objects$time.steps <- n
if (!is.null(y)) {
objects$n <- lapply(y, length)
objects$nodelabels <- unlist(lapply(y, names))
}
else {
objects$n <- lapply(networks, nrow)
objects$nodelabels <- unlist(lapply(networks, rownames))
}
names(objects$nodelabels) <- NULL
return(objects)
}
<bytecode: 0x61aa4e8>
<environment: namespace:tnam>
--- function search by body ---
Function checkDataTypes in namespace tnam has this body.
----------- END OF FAILURE REPORT --------------
Error in if (class(networks[[i]]) != "matrix") { :
the condition has length > 1
Calls: tnam ... tnamdata -> eval -> eval -> netlag -> checkDataTypes
Execution halted
Flavor: r-devel-linux-x86_64-debian-clang
Version: 1.6.5
Check: examples
Result: ERROR
Running examples in ‘tnam-Ex.R’ failed
The error most likely occurred in:
> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: tnam
> ### Title: Fit (temporal) network autocorrelation models
> ### Aliases: tnam tnamdata
>
> ### ** Examples
>
> # The following example models delinquency among adolescents at
> # multiple time steps as a function of (1) their nodal attributes
> # like sex or religion, (2) their peers' delinquency levels, (3)
> # their own and their peers' past delinquency behavior, and (4)
> # their structural position in the network. See ?knecht for
> # details on the dataset. Before estimating the model, all data
> # should be labeled with the names of the nodes such that tnam
> # is able to merge the information on multiple nodes across time
> # points.
>
> library("tnam")
> data("knecht")
>
> # prepare the dependent variable y
> delinquency <- as.data.frame(delinquency)
> rownames(delinquency) <- letters
>
> # replace structural zeros (denoted as 10) and add row labels
> friendship[[3]][friendship[[3]] == 10] <- NA
> friendship[[4]][friendship[[4]] == 10] <- NA
> for (i in 1:length(friendship)) {
+ rownames(friendship[[i]]) <- letters
+ }
>
> # prepare the covariates sex and religion
> sex <- demographics$sex
> names(sex) <- letters
> sex <- list(t1 = sex, t2 = sex, t3 = sex, t4 = sex)
> religion <- demographics$religion
> names(religion) <- letters
> religion <- list(t1 = religion, t2 = religion, t3 = religion,
+ t4 = religion)
>
> # Estimate the model. The first term is the sex of the respondent,
> # the second term is the religion of the respondent, the third
> # term is the previous delinquency behavior of the respondent,
> # the fourth term is the delinquency behavior of direct friends,
> # the fifth term is the delinquency behavior of indirect friends
> # at a path distance of 2, the sixth effect is the past delinquency
> # of direct friends, the seventh term indicates whether the
> # respondent has any contacts at all, and the last term captures
> # the effect of the betweenness centrality of the respondent on
> # his or her behavior. Apparently, previous behavior, being an
> # isolate, and religion seem to have an effect on delinquency in
> # this dataset. There is also a slight positive trend over time,
> # and direct friends exert a minor effect (not significant).
> # Note that a linear model may not be the best specification for
> # modeling the ordered categorical delinquency variable, but it
> # suffice here for illustration purposes.
>
> model1 <- tnam(
+ delinquency ~
+ covariate(sex, coefname = "sex") +
+ covariate(religion, coefname = "religion") +
+ covariate(delinquency, lag = 1, exponent = 1) +
+ netlag(delinquency, friendship) +
+ netlag(delinquency, friendship, pathdist = 2, decay = 1) +
+ netlag(delinquency, friendship, lag = 1) +
+ degreedummy(friendship, deg = 0, reverse = TRUE) +
+ centrality(friendship, type = "betweenness"),
+ re.node = TRUE, time.linear = TRUE
+ )
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
tnam
--- call from context ---
checkDataTypes(y = y, networks = networks, lag = lag)
--- call from argument ---
if (class(networks[[i]]) != "matrix") {
tryCatch({
networks[[i]] <- as.matrix(networks[[i]])
}, error = function(e) {
stop(paste0("At t=", i, ", the object in the 'networks' list could ",
"not be converted to a matrix object."))
})
}
--- R stacktrace ---
where 1: checkDataTypes(y = y, networks = networks, lag = lag)
where 2: netlag(delinquency, friendship)
where 3: eval(parse(text = rhs[i]))
where 4: eval(parse(text = rhs[i]))
where 5: tnamdata(formula, center.y = center.y)
where 6: tnam(delinquency ~ covariate(sex, coefname = "sex") + covariate(religion,
coefname = "religion") + covariate(delinquency, lag = 1,
exponent = 1) + netlag(delinquency, friendship) + netlag(delinquency,
friendship, pathdist = 2, decay = 1) + netlag(delinquency,
friendship, lag = 1) + degreedummy(friendship, deg = 0, reverse = TRUE) +
centrality(friendship, type = "betweenness"), re.node = TRUE,
time.linear = TRUE)
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (y, networks = NULL, lag = 0)
{
if (is.null(y) && is.null(networks)) {
stop("No 'y' and 'networks' arguments were provided.")
}
stopmsg <- paste0("The data type of the 'y' argument is '",
class(y), "'. 'y' must be provided as a numeric vector, a list of numeric ",
"vectors, or a data frame with numeric columns.")
if (is.null(y)) {
}
else if (class(y) == "list") {
}
else if (class(y) == "data.frame") {
time.steps <- ncol(y)
y.copy <- y
y <- list()
for (i in 1:ncol(y.copy)) {
y[[i]] <- y.copy[, i]
names(y[[i]]) <- rownames(y.copy)
}
rm(y.copy)
}
else if (class(y) == "matrix") {
stop(stopmsg)
}
else if (class(y) == "integer") {
current.names <- names(y)
y <- as.numeric(y)
names(y) <- current.names
y <- list(y)
}
else if (class(y) == "numeric") {
y <- list(y)
}
else if (class(y) == "character") {
y <- list(y)
}
else {
tryCatch({
current.names <- names(y)
y <- as.numeric(y)
names(y) <- current.names
y <- list(y)
}, error = function(e) {
stop(stopmsg)
})
}
if (!is.null(y)) {
for (i in 1:length(y)) {
cl <- class(y[[i]])
stopmsg <- paste0("At t=", i, ", 'y' contains ",
cl, " objects. 'y' ", "must be provided as a numeric vector, a list of numeric vectors, ",
"or a data frame with numeric columns.")
if (is.integer(y[[i]])) {
current.names <- names(y[[i]])
y[[i]] <- as.numeric(y[[i]])
names(y[[i]]) <- current.names
}
else if (cl == "character") {
stop(stopmsg)
}
else {
tryCatch({
current.names <- names(y[[i]])
y[[i]] <- as.numeric(y[[i]])
names(y[[i]]) <- current.names
}, error = function(e) {
stop(stopmsg)
})
}
}
}
if (is.null(networks)) {
}
else if (class(networks) == "matrix") {
networks <- list(networks)
}
else if (class(networks) == "network") {
networks <- list(as.matrix(networks))
}
else if (class(networks) == "list") {
}
else {
networks <- list(networks)
}
if (!is.null(networks)) {
for (i in 1:length(networks)) {
if (class(networks[[i]]) != "matrix") {
tryCatch({
networks[[i]] <- as.matrix(networks[[i]])
}, error = function(e) {
stop(paste0("At t=", i, ", the object in the 'networks' list could ",
"not be converted to a matrix object."))
})
}
if (storage.mode(networks[[i]]) != "numeric") {
tryCatch({
storage.mode(networks[[i]]) <- "numeric"
}, error = function(e) {
stop(paste0("At t=", i, ", the matrix in the 'networks' list does ",
"not contain numeric values."))
})
}
}
}
if (!is.null(y) && !is.null(networks) && length(y) != length(networks)) {
if (length(y) == 1 && length(networks) > 1) {
stop(paste("'y' has only one time step, but the network has multiple ",
"time steps."))
}
else if (length(y) > 1 && length(networks) == 1) {
for (i in length(y)) {
networks[[i]] <- networks[[1]]
}
}
else {
stop(paste0("There should be the same number of elements in 'y' and ",
"'networks'. There are ", length(y), " elements in 'y' and ",
length(networks), " elements in 'networks'."))
}
}
if (!is.null(y) && !is.null(networks)) {
for (i in 1:length(y)) {
if (length(y[[i]]) != nrow(networks[[i]])) {
if (is.null(rownames(networks[[i]]))) {
stop(paste0("The dimensions of 'y' and 'networks' differ at t=",
i, ", and the network (matrix) does not contain row names."))
}
else if (is.null(names(y[[i]]))) {
stop(paste0("The dimensions of 'y' and 'networks' differ at t=",
i, ", and the elements in 'y' are not named."))
}
else {
message(paste0("Dimensions of 'y' and 'networks' do not match at ",
"t=", i, ". Trying to adjust them mutually."))
y[[i]] <- xergm.common::adjust(y[[i]], networks[[i]],
add = FALSE)
networks[[i]] <- xergm.common::adjust(networks[[i]],
y[[i]], add = FALSE)
}
}
if (!is.null(names(y[[i]])) && !is.null(rownames(networks[[i]])) &&
!all(names(y[[i]]) == rownames(networks[[i]]))) {
warning(paste("At t=", i, "the names of 'y' and the row names of",
"'networks' do not match."))
}
if (is.null(rownames(networks[[i]])) && !is.null(names(y[[i]]))) {
rownames(networks[[i]]) <- names(y[[i]])
}
else if (is.null(names(y[[i]])) && !is.null(rownames(networks[[i]]))) {
names(y[[i]]) <- rownames(networks[[i]])
}
else if (is.null(rownames(networks[[i]])) && is.null(names(y[[i]]))) {
names(y[[i]]) <- 1:length(y[[i]])
rownames(networks[[i]]) <- 1:nrow(networks[[i]])
}
}
}
if (is.null(y)) {
for (i in 1:length(networks)) {
if (is.null(rownames(networks[[i]]))) {
rownames(networks[[i]]) <- 1:nrow(networks[[i]])
if (i > 1) {
if (nrow(networks[[i]]) != nrow(networks[[i -
1]])) {
stop(paste0("No row names in 'networks' at t=",
i, ". Tried to ", "create custom row names, but the dimensions differ from ",
"the previous time point."))
}
if (!all(rownames(networks[[i]]) == rownames(networks[[i -
1]]))) {
stop(paste0("At t=", i, ", the row names of the network matrix ",
"do not match the row names of the previous time step."))
}
}
}
}
}
if (is.null(networks)) {
for (i in 1:length(y)) {
if (is.null(names(y[[i]]))) {
names(y[[i]]) <- 1:length(y[[i]])
if (i > 1) {
if (length(y[[i]]) != length(y[[i - 1]])) {
stop(paste0("No names in 'y' vector at t=",
i, ". Tried to ", "create custom names, but the length differs from ",
"the previous time point."))
}
if (!all(names(y[[i]]) == names(y[[i - 1]]))) {
stop(paste0("At t=", i, ", the names of the 'y' vector ",
"do not match the names of the previous time step."))
}
}
}
}
}
if (!is.null(y)) {
n <- length(y)
}
else {
n <- length(networks)
}
if (!is.numeric(lag)) {
stop("The 'lag' argument must be numeric.")
}
else if (length(lag) > 1) {
stop("The 'lag' argument must be of length 1.")
}
else if (lag < 0) {
stop("The 'lag' argument must be >= 0.")
}
else if (n - lag < 1) {
if (n == 1) {
stop(paste("A lag of", lag, "was specified, but there is only",
"one time step."))
}
else {
stop(paste("A lag of", lag, "was specified, but there are only",
n, "time steps."))
}
}
objects <- list()
objects$y <- y
objects$networks <- networks
objects$time.steps <- n
if (!is.null(y)) {
objects$n <- lapply(y, length)
objects$nodelabels <- unlist(lapply(y, names))
}
else {
objects$n <- lapply(networks, nrow)
objects$nodelabels <- unlist(lapply(networks, rownames))
}
names(objects$nodelabels) <- NULL
return(objects)
}
<bytecode: 0x558087e492a8>
<environment: namespace:tnam>
--- function search by body ---
Function checkDataTypes in namespace tnam has this body.
----------- END OF FAILURE REPORT --------------
Error in if (class(networks[[i]]) != "matrix") { :
the condition has length > 1
Calls: tnam ... tnamdata -> eval -> eval -> netlag -> checkDataTypes
Execution halted
Flavor: r-devel-linux-x86_64-debian-gcc
Version: 1.6.5
Check: examples
Result: ERROR
Running examples in ‘tnam-Ex.R’ failed
The error most likely occurred in:
> ### Name: tnam
> ### Title: Fit (temporal) network autocorrelation models
> ### Aliases: tnam tnamdata
>
> ### ** Examples
>
> # The following example models delinquency among adolescents at
> # multiple time steps as a function of (1) their nodal attributes
> # like sex or religion, (2) their peers' delinquency levels, (3)
> # their own and their peers' past delinquency behavior, and (4)
> # their structural position in the network. See ?knecht for
> # details on the dataset. Before estimating the model, all data
> # should be labeled with the names of the nodes such that tnam
> # is able to merge the information on multiple nodes across time
> # points.
>
> library("tnam")
> data("knecht")
>
> # prepare the dependent variable y
> delinquency <- as.data.frame(delinquency)
> rownames(delinquency) <- letters
>
> # replace structural zeros (denoted as 10) and add row labels
> friendship[[3]][friendship[[3]] == 10] <- NA
> friendship[[4]][friendship[[4]] == 10] <- NA
> for (i in 1:length(friendship)) {
+ rownames(friendship[[i]]) <- letters
+ }
>
> # prepare the covariates sex and religion
> sex <- demographics$sex
> names(sex) <- letters
> sex <- list(t1 = sex, t2 = sex, t3 = sex, t4 = sex)
> religion <- demographics$religion
> names(religion) <- letters
> religion <- list(t1 = religion, t2 = religion, t3 = religion,
+ t4 = religion)
>
> # Estimate the model. The first term is the sex of the respondent,
> # the second term is the religion of the respondent, the third
> # term is the previous delinquency behavior of the respondent,
> # the fourth term is the delinquency behavior of direct friends,
> # the fifth term is the delinquency behavior of indirect friends
> # at a path distance of 2, the sixth effect is the past delinquency
> # of direct friends, the seventh term indicates whether the
> # respondent has any contacts at all, and the last term captures
> # the effect of the betweenness centrality of the respondent on
> # his or her behavior. Apparently, previous behavior, being an
> # isolate, and religion seem to have an effect on delinquency in
> # this dataset. There is also a slight positive trend over time,
> # and direct friends exert a minor effect (not significant).
> # Note that a linear model may not be the best specification for
> # modeling the ordered categorical delinquency variable, but it
> # suffice here for illustration purposes.
>
> model1 <- tnam(
+ delinquency ~
+ covariate(sex, coefname = "sex") +
+ covariate(religion, coefname = "religion") +
+ covariate(delinquency, lag = 1, exponent = 1) +
+ netlag(delinquency, friendship) +
+ netlag(delinquency, friendship, pathdist = 2, decay = 1) +
+ netlag(delinquency, friendship, lag = 1) +
+ degreedummy(friendship, deg = 0, reverse = TRUE) +
+ centrality(friendship, type = "betweenness"),
+ re.node = TRUE, time.linear = TRUE
+ )
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
tnam
--- call from context ---
checkDataTypes(y = y, networks = networks, lag = lag)
--- call from argument ---
if (class(networks[[i]]) != "matrix") {
tryCatch({
networks[[i]] <- as.matrix(networks[[i]])
}, error = function(e) {
stop(paste0("At t=", i, ", the object in the 'networks' list could ",
"not be converted to a matrix object."))
})
}
--- R stacktrace ---
where 1: checkDataTypes(y = y, networks = networks, lag = lag)
where 2: netlag(delinquency, friendship)
where 3: eval(parse(text = rhs[i]))
where 4: eval(parse(text = rhs[i]))
where 5: tnamdata(formula, center.y = center.y)
where 6: tnam(delinquency ~ covariate(sex, coefname = "sex") + covariate(religion,
coefname = "religion") + covariate(delinquency, lag = 1,
exponent = 1) + netlag(delinquency, friendship) + netlag(delinquency,
friendship, pathdist = 2, decay = 1) + netlag(delinquency,
friendship, lag = 1) + degreedummy(friendship, deg = 0, reverse = TRUE) +
centrality(friendship, type = "betweenness"), re.node = TRUE,
time.linear = TRUE)
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (y, networks = NULL, lag = 0)
{
if (is.null(y) && is.null(networks)) {
stop("No 'y' and 'networks' arguments were provided.")
}
stopmsg <- paste0("The data type of the 'y' argument is '",
class(y), "'. 'y' must be provided as a numeric vector, a list of numeric ",
"vectors, or a data frame with numeric columns.")
if (is.null(y)) {
}
else if (class(y) == "list") {
}
else if (class(y) == "data.frame") {
time.steps <- ncol(y)
y.copy <- y
y <- list()
for (i in 1:ncol(y.copy)) {
y[[i]] <- y.copy[, i]
names(y[[i]]) <- rownames(y.copy)
}
rm(y.copy)
}
else if (class(y) == "matrix") {
stop(stopmsg)
}
else if (class(y) == "integer") {
current.names <- names(y)
y <- as.numeric(y)
names(y) <- current.names
y <- list(y)
}
else if (class(y) == "numeric") {
y <- list(y)
}
else if (class(y) == "character") {
y <- list(y)
}
else {
tryCatch({
current.names <- names(y)
y <- as.numeric(y)
names(y) <- current.names
y <- list(y)
}, error = function(e) {
stop(stopmsg)
})
}
if (!is.null(y)) {
for (i in 1:length(y)) {
cl <- class(y[[i]])
stopmsg <- paste0("At t=", i, ", 'y' contains ",
cl, " objects. 'y' ", "must be provided as a numeric vector, a list of numeric vectors, ",
"or a data frame with numeric columns.")
if (is.integer(y[[i]])) {
current.names <- names(y[[i]])
y[[i]] <- as.numeric(y[[i]])
names(y[[i]]) <- current.names
}
else if (cl == "character") {
stop(stopmsg)
}
else {
tryCatch({
current.names <- names(y[[i]])
y[[i]] <- as.numeric(y[[i]])
names(y[[i]]) <- current.names
}, error = function(e) {
stop(stopmsg)
})
}
}
}
if (is.null(networks)) {
}
else if (class(networks) == "matrix") {
networks <- list(networks)
}
else if (class(networks) == "network") {
networks <- list(as.matrix(networks))
}
else if (class(networks) == "list") {
}
else {
networks <- list(networks)
}
if (!is.null(networks)) {
for (i in 1:length(networks)) {
if (class(networks[[i]]) != "matrix") {
tryCatch({
networks[[i]] <- as.matrix(networks[[i]])
}, error = function(e) {
stop(paste0("At t=", i, ", the object in the 'networks' list could ",
"not be converted to a matrix object."))
})
}
if (storage.mode(networks[[i]]) != "numeric") {
tryCatch({
storage.mode(networks[[i]]) <- "numeric"
}, error = function(e) {
stop(paste0("At t=", i, ", the matrix in the 'networks' list does ",
"not contain numeric values."))
})
}
}
}
if (!is.null(y) && !is.null(networks) && length(y) != length(networks)) {
if (length(y) == 1 && length(networks) > 1) {
stop(paste("'y' has only one time step, but the network has multiple ",
"time steps."))
}
else if (length(y) > 1 && length(networks) == 1) {
for (i in length(y)) {
networks[[i]] <- networks[[1]]
}
}
else {
stop(paste0("There should be the same number of elements in 'y' and ",
"'networks'. There are ", length(y), " elements in 'y' and ",
length(networks), " elements in 'networks'."))
}
}
if (!is.null(y) && !is.null(networks)) {
for (i in 1:length(y)) {
if (length(y[[i]]) != nrow(networks[[i]])) {
if (is.null(rownames(networks[[i]]))) {
stop(paste0("The dimensions of 'y' and 'networks' differ at t=",
i, ", and the network (matrix) does not contain row names."))
}
else if (is.null(names(y[[i]]))) {
stop(paste0("The dimensions of 'y' and 'networks' differ at t=",
i, ", and the elements in 'y' are not named."))
}
else {
message(paste0("Dimensions of 'y' and 'networks' do not match at ",
"t=", i, ". Trying to adjust them mutually."))
y[[i]] <- xergm.common::adjust(y[[i]], networks[[i]],
add = FALSE)
networks[[i]] <- xergm.common::adjust(networks[[i]],
y[[i]], add = FALSE)
}
}
if (!is.null(names(y[[i]])) && !is.null(rownames(networks[[i]])) &&
!all(names(y[[i]]) == rownames(networks[[i]]))) {
warning(paste("At t=", i, "the names of 'y' and the row names of",
"'networks' do not match."))
}
if (is.null(rownames(networks[[i]])) && !is.null(names(y[[i]]))) {
rownames(networks[[i]]) <- names(y[[i]])
}
else if (is.null(names(y[[i]])) && !is.null(rownames(networks[[i]]))) {
names(y[[i]]) <- rownames(networks[[i]])
}
else if (is.null(rownames(networks[[i]])) && is.null(names(y[[i]]))) {
names(y[[i]]) <- 1:length(y[[i]])
rownames(networks[[i]]) <- 1:nrow(networks[[i]])
}
}
}
if (is.null(y)) {
for (i in 1:length(networks)) {
if (is.null(rownames(networks[[i]]))) {
rownames(networks[[i]]) <- 1:nrow(networks[[i]])
if (i > 1) {
if (nrow(networks[[i]]) != nrow(networks[[i -
1]])) {
stop(paste0("No row names in 'networks' at t=",
i, ". Tried to ", "create custom row names, but the dimensions differ from ",
"the previous time point."))
}
if (!all(rownames(networks[[i]]) == rownames(networks[[i -
1]]))) {
stop(paste0("At t=", i, ", the row names of the network matrix ",
"do not match the row names of the previous time step."))
}
}
}
}
}
if (is.null(networks)) {
for (i in 1:length(y)) {
if (is.null(names(y[[i]]))) {
names(y[[i]]) <- 1:length(y[[i]])
if (i > 1) {
if (length(y[[i]]) != length(y[[i - 1]])) {
stop(paste0("No names in 'y' vector at t=",
i, ". Tried to ", "create custom names, but the length differs from ",
"the previous time point."))
}
if (!all(names(y[[i]]) == names(y[[i - 1]]))) {
stop(paste0("At t=", i, ", the names of the 'y' vector ",
"do not match the names of the previous time step."))
}
}
}
}
}
if (!is.null(y)) {
n <- length(y)
}
else {
n <- length(networks)
}
if (!is.numeric(lag)) {
stop("The 'lag' argument must be numeric.")
}
else if (length(lag) > 1) {
stop("The 'lag' argument must be of length 1.")
}
else if (lag < 0) {
stop("The 'lag' argument must be >= 0.")
}
else if (n - lag < 1) {
if (n == 1) {
stop(paste("A lag of", lag, "was specified, but there is only",
"one time step."))
}
else {
stop(paste("A lag of", lag, "was specified, but there are only",
n, "time steps."))
}
}
objects <- list()
objects$y <- y
objects$networks <- networks
objects$time.steps <- n
if (!is.null(y)) {
objects$n <- lapply(y, length)
objects$nodelabels <- unlist(lapply(y, names))
}
else {
objects$n <- lapply(networks, nrow)
objects$nodelabels <- unlist(lapply(networks, rownames))
}
names(objects$nodelabels) <- NULL
return(objects)
}
<bytecode: 0x6888950>
<environment: namespace:tnam>
--- function search by body ---
Function checkDataTypes in namespace tnam has this body.
----------- END OF FAILURE REPORT --------------
Error in if (class(networks[[i]]) != "matrix") { :
the condition has length > 1
Calls: tnam ... tnamdata -> eval -> eval -> netlag -> checkDataTypes
Execution halted
Flavor: r-devel-linux-x86_64-fedora-clang
Version: 1.6.5
Check: examples
Result: ERROR
Running examples in ‘tnam-Ex.R’ failed
The error most likely occurred in:
> ### Name: tnam
> ### Title: Fit (temporal) network autocorrelation models
> ### Aliases: tnam tnamdata
>
> ### ** Examples
>
> # The following example models delinquency among adolescents at
> # multiple time steps as a function of (1) their nodal attributes
> # like sex or religion, (2) their peers' delinquency levels, (3)
> # their own and their peers' past delinquency behavior, and (4)
> # their structural position in the network. See ?knecht for
> # details on the dataset. Before estimating the model, all data
> # should be labeled with the names of the nodes such that tnam
> # is able to merge the information on multiple nodes across time
> # points.
>
> library("tnam")
> data("knecht")
>
> # prepare the dependent variable y
> delinquency <- as.data.frame(delinquency)
> rownames(delinquency) <- letters
>
> # replace structural zeros (denoted as 10) and add row labels
> friendship[[3]][friendship[[3]] == 10] <- NA
> friendship[[4]][friendship[[4]] == 10] <- NA
> for (i in 1:length(friendship)) {
+ rownames(friendship[[i]]) <- letters
+ }
>
> # prepare the covariates sex and religion
> sex <- demographics$sex
> names(sex) <- letters
> sex <- list(t1 = sex, t2 = sex, t3 = sex, t4 = sex)
> religion <- demographics$religion
> names(religion) <- letters
> religion <- list(t1 = religion, t2 = religion, t3 = religion,
+ t4 = religion)
>
> # Estimate the model. The first term is the sex of the respondent,
> # the second term is the religion of the respondent, the third
> # term is the previous delinquency behavior of the respondent,
> # the fourth term is the delinquency behavior of direct friends,
> # the fifth term is the delinquency behavior of indirect friends
> # at a path distance of 2, the sixth effect is the past delinquency
> # of direct friends, the seventh term indicates whether the
> # respondent has any contacts at all, and the last term captures
> # the effect of the betweenness centrality of the respondent on
> # his or her behavior. Apparently, previous behavior, being an
> # isolate, and religion seem to have an effect on delinquency in
> # this dataset. There is also a slight positive trend over time,
> # and direct friends exert a minor effect (not significant).
> # Note that a linear model may not be the best specification for
> # modeling the ordered categorical delinquency variable, but it
> # suffice here for illustration purposes.
>
> model1 <- tnam(
+ delinquency ~
+ covariate(sex, coefname = "sex") +
+ covariate(religion, coefname = "religion") +
+ covariate(delinquency, lag = 1, exponent = 1) +
+ netlag(delinquency, friendship) +
+ netlag(delinquency, friendship, pathdist = 2, decay = 1) +
+ netlag(delinquency, friendship, lag = 1) +
+ degreedummy(friendship, deg = 0, reverse = TRUE) +
+ centrality(friendship, type = "betweenness"),
+ re.node = TRUE, time.linear = TRUE
+ )
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
tnam
--- call from context ---
checkDataTypes(y = y, networks = networks, lag = lag)
--- call from argument ---
if (class(networks[[i]]) != "matrix") {
tryCatch({
networks[[i]] <- as.matrix(networks[[i]])
}, error = function(e) {
stop(paste0("At t=", i, ", the object in the 'networks' list could ",
"not be converted to a matrix object."))
})
}
--- R stacktrace ---
where 1: checkDataTypes(y = y, networks = networks, lag = lag)
where 2: netlag(delinquency, friendship)
where 3: eval(parse(text = rhs[i]))
where 4: eval(parse(text = rhs[i]))
where 5: tnamdata(formula, center.y = center.y)
where 6: tnam(delinquency ~ covariate(sex, coefname = "sex") + covariate(religion,
coefname = "religion") + covariate(delinquency, lag = 1,
exponent = 1) + netlag(delinquency, friendship) + netlag(delinquency,
friendship, pathdist = 2, decay = 1) + netlag(delinquency,
friendship, lag = 1) + degreedummy(friendship, deg = 0, reverse = TRUE) +
centrality(friendship, type = "betweenness"), re.node = TRUE,
time.linear = TRUE)
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (y, networks = NULL, lag = 0)
{
if (is.null(y) && is.null(networks)) {
stop("No 'y' and 'networks' arguments were provided.")
}
stopmsg <- paste0("The data type of the 'y' argument is '",
class(y), "'. 'y' must be provided as a numeric vector, a list of numeric ",
"vectors, or a data frame with numeric columns.")
if (is.null(y)) {
}
else if (class(y) == "list") {
}
else if (class(y) == "data.frame") {
time.steps <- ncol(y)
y.copy <- y
y <- list()
for (i in 1:ncol(y.copy)) {
y[[i]] <- y.copy[, i]
names(y[[i]]) <- rownames(y.copy)
}
rm(y.copy)
}
else if (class(y) == "matrix") {
stop(stopmsg)
}
else if (class(y) == "integer") {
current.names <- names(y)
y <- as.numeric(y)
names(y) <- current.names
y <- list(y)
}
else if (class(y) == "numeric") {
y <- list(y)
}
else if (class(y) == "character") {
y <- list(y)
}
else {
tryCatch({
current.names <- names(y)
y <- as.numeric(y)
names(y) <- current.names
y <- list(y)
}, error = function(e) {
stop(stopmsg)
})
}
if (!is.null(y)) {
for (i in 1:length(y)) {
cl <- class(y[[i]])
stopmsg <- paste0("At t=", i, ", 'y' contains ",
cl, " objects. 'y' ", "must be provided as a numeric vector, a list of numeric vectors, ",
"or a data frame with numeric columns.")
if (is.integer(y[[i]])) {
current.names <- names(y[[i]])
y[[i]] <- as.numeric(y[[i]])
names(y[[i]]) <- current.names
}
else if (cl == "character") {
stop(stopmsg)
}
else {
tryCatch({
current.names <- names(y[[i]])
y[[i]] <- as.numeric(y[[i]])
names(y[[i]]) <- current.names
}, error = function(e) {
stop(stopmsg)
})
}
}
}
if (is.null(networks)) {
}
else if (class(networks) == "matrix") {
networks <- list(networks)
}
else if (class(networks) == "network") {
networks <- list(as.matrix(networks))
}
else if (class(networks) == "list") {
}
else {
networks <- list(networks)
}
if (!is.null(networks)) {
for (i in 1:length(networks)) {
if (class(networks[[i]]) != "matrix") {
tryCatch({
networks[[i]] <- as.matrix(networks[[i]])
}, error = function(e) {
stop(paste0("At t=", i, ", the object in the 'networks' list could ",
"not be converted to a matrix object."))
})
}
if (storage.mode(networks[[i]]) != "numeric") {
tryCatch({
storage.mode(networks[[i]]) <- "numeric"
}, error = function(e) {
stop(paste0("At t=", i, ", the matrix in the 'networks' list does ",
"not contain numeric values."))
})
}
}
}
if (!is.null(y) && !is.null(networks) && length(y) != length(networks)) {
if (length(y) == 1 && length(networks) > 1) {
stop(paste("'y' has only one time step, but the network has multiple ",
"time steps."))
}
else if (length(y) > 1 && length(networks) == 1) {
for (i in length(y)) {
networks[[i]] <- networks[[1]]
}
}
else {
stop(paste0("There should be the same number of elements in 'y' and ",
"'networks'. There are ", length(y), " elements in 'y' and ",
length(networks), " elements in 'networks'."))
}
}
if (!is.null(y) && !is.null(networks)) {
for (i in 1:length(y)) {
if (length(y[[i]]) != nrow(networks[[i]])) {
if (is.null(rownames(networks[[i]]))) {
stop(paste0("The dimensions of 'y' and 'networks' differ at t=",
i, ", and the network (matrix) does not contain row names."))
}
else if (is.null(names(y[[i]]))) {
stop(paste0("The dimensions of 'y' and 'networks' differ at t=",
i, ", and the elements in 'y' are not named."))
}
else {
message(paste0("Dimensions of 'y' and 'networks' do not match at ",
"t=", i, ". Trying to adjust them mutually."))
y[[i]] <- xergm.common::adjust(y[[i]], networks[[i]],
add = FALSE)
networks[[i]] <- xergm.common::adjust(networks[[i]],
y[[i]], add = FALSE)
}
}
if (!is.null(names(y[[i]])) && !is.null(rownames(networks[[i]])) &&
!all(names(y[[i]]) == rownames(networks[[i]]))) {
warning(paste("At t=", i, "the names of 'y' and the row names of",
"'networks' do not match."))
}
if (is.null(rownames(networks[[i]])) && !is.null(names(y[[i]]))) {
rownames(networks[[i]]) <- names(y[[i]])
}
else if (is.null(names(y[[i]])) && !is.null(rownames(networks[[i]]))) {
names(y[[i]]) <- rownames(networks[[i]])
}
else if (is.null(rownames(networks[[i]])) && is.null(names(y[[i]]))) {
names(y[[i]]) <- 1:length(y[[i]])
rownames(networks[[i]]) <- 1:nrow(networks[[i]])
}
}
}
if (is.null(y)) {
for (i in 1:length(networks)) {
if (is.null(rownames(networks[[i]]))) {
rownames(networks[[i]]) <- 1:nrow(networks[[i]])
if (i > 1) {
if (nrow(networks[[i]]) != nrow(networks[[i -
1]])) {
stop(paste0("No row names in 'networks' at t=",
i, ". Tried to ", "create custom row names, but the dimensions differ from ",
"the previous time point."))
}
if (!all(rownames(networks[[i]]) == rownames(networks[[i -
1]]))) {
stop(paste0("At t=", i, ", the row names of the network matrix ",
"do not match the row names of the previous time step."))
}
}
}
}
}
if (is.null(networks)) {
for (i in 1:length(y)) {
if (is.null(names(y[[i]]))) {
names(y[[i]]) <- 1:length(y[[i]])
if (i > 1) {
if (length(y[[i]]) != length(y[[i - 1]])) {
stop(paste0("No names in 'y' vector at t=",
i, ". Tried to ", "create custom names, but the length differs from ",
"the previous time point."))
}
if (!all(names(y[[i]]) == names(y[[i - 1]]))) {
stop(paste0("At t=", i, ", the names of the 'y' vector ",
"do not match the names of the previous time step."))
}
}
}
}
}
if (!is.null(y)) {
n <- length(y)
}
else {
n <- length(networks)
}
if (!is.numeric(lag)) {
stop("The 'lag' argument must be numeric.")
}
else if (length(lag) > 1) {
stop("The 'lag' argument must be of length 1.")
}
else if (lag < 0) {
stop("The 'lag' argument must be >= 0.")
}
else if (n - lag < 1) {
if (n == 1) {
stop(paste("A lag of", lag, "was specified, but there is only",
"one time step."))
}
else {
stop(paste("A lag of", lag, "was specified, but there are only",
n, "time steps."))
}
}
objects <- list()
objects$y <- y
objects$networks <- networks
objects$time.steps <- n
if (!is.null(y)) {
objects$n <- lapply(y, length)
objects$nodelabels <- unlist(lapply(y, names))
}
else {
objects$n <- lapply(networks, nrow)
objects$nodelabels <- unlist(lapply(networks, rownames))
}
names(objects$nodelabels) <- NULL
return(objects)
}
<bytecode: 0x632b530>
<environment: namespace:tnam>
--- function search by body ---
Function checkDataTypes in namespace tnam has this body.
----------- END OF FAILURE REPORT --------------
Error in if (class(networks[[i]]) != "matrix") { :
the condition has length > 1
Calls: tnam ... tnamdata -> eval -> eval -> netlag -> checkDataTypes
Execution halted
Flavor: r-devel-linux-x86_64-fedora-gcc