[Rsiena-commits] r223 - in pkg: RSiena RSiena/R RSiena/man RSienaTest RSienaTest/R RSienaTest/man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Jan 1 20:09:51 CET 2013
Author: ripleyrm
Date: 2013-01-01 20:09:51 +0100 (Tue, 01 Jan 2013)
New Revision: 223
Modified:
pkg/RSiena/DESCRIPTION
pkg/RSiena/R/sienaDataCreateFromSession.r
pkg/RSiena/changeLog
pkg/RSiena/man/RSiena-package.Rd
pkg/RSienaTest/DESCRIPTION
pkg/RSienaTest/R/sienaDataCreateFromSession.r
pkg/RSienaTest/changeLog
pkg/RSienaTest/man/RSiena-package.Rd
Log:
Assign objects locally rather than in global env, as using global env is forbidden.
Modified: pkg/RSiena/DESCRIPTION
===================================================================
--- pkg/RSiena/DESCRIPTION 2012-12-24 00:41:15 UTC (rev 222)
+++ pkg/RSiena/DESCRIPTION 2013-01-01 19:09:51 UTC (rev 223)
@@ -1,8 +1,8 @@
Package: RSiena
Type: Package
Title: Siena - Simulation Investigation for Empirical Network Analysis
-Version: 1.1-222
-Date: 2012-12-24
+Version: 1.1-223
+Date: 2013-01-01
Author: Various
Depends: R (>= 2.10.0)
Imports: Matrix
Modified: pkg/RSiena/R/sienaDataCreateFromSession.r
===================================================================
--- pkg/RSiena/R/sienaDataCreateFromSession.r 2012-12-24 00:41:15 UTC (rev 222)
+++ pkg/RSiena/R/sienaDataCreateFromSession.r 2013-01-01 19:09:51 UTC (rev 223)
@@ -233,8 +233,7 @@
{
return(getInternals())
}
- ActorSets <- NULL
- ActorSetsSize <- NULL
+ env <- sys.frame(sys.nframe())
if (!is.null(filename))
{
session <- sessionFromFile(filename)
@@ -395,7 +394,7 @@
tmp <- sienaNet(mylist, nodeSet=namesession[1,
"ActorSet"])
}
- assign(objnames[j], tmp, .GlobalEnv)
+ assign(objnames[j], tmp)
},
'bipartite' = {
nodesets <-
@@ -483,7 +482,7 @@
{
stop("Two-mode pajek nets not supported")
}
- assign(objnames[j], tmp, .GlobalEnv)
+ assign(objnames[j], tmp)
},
'behavior' = {
##miss <- gsub(" ", "|",
@@ -496,8 +495,7 @@
## namefiles[[1]][grep(miss, namefiles[[1]])] <- NA
assign(objnames[j],
sienaNet(namefiles[[1]], type = 'behavior',
- nodeSet=namesession[1, "ActorSet"]),
- .GlobalEnv)
+ nodeSet=namesession[1, "ActorSet"]))
},
'constant covariate' = {
## miss <- gsub(" ", "|",
@@ -509,11 +507,10 @@
namefiles[[1]][namefiles[[1]] %in% miss] <- NA
varnames <- strsplit(objnames[j], ' ')[[1]]
tmp <- sapply(1: ncol(namefiles[[1]]), function(x){
- assign(varnames[x],
+ assign(varnames[x], pos=env,
coCovar(namefiles[[1]][, x],
nodeSet=namesession[1,
- "ActorSet"]),
- .GlobalEnv)})
+ "ActorSet"]))})
},
'changing covariate' = {
## miss <- gsub(" ", "|",
@@ -525,8 +522,7 @@
namefiles[[1]][namefiles[[1]] %in% miss] <- NA
assign(objnames[j],
varCovar (namefiles[[1]],
- nodeSet=namesession[1, "ActorSet"]),
- .GlobalEnv)
+ nodeSet=namesession[1, "ActorSet"]))
},
'constant dyadic covariate' = {
miss <- namesession$MissingValues
@@ -564,7 +560,7 @@
x=myedgelist[, 3])
tmp <- coDyadCovar(myval, nodeSets=nodesets)
}
- assign(objnames[j], tmp, .GlobalEnv)
+ assign(objnames[j], tmp)
},
'changing dyadic covariate' = {
if (namesession[1, "ActorSet"] == "Actors")
@@ -643,7 +639,7 @@
)
tmp <- varDyadCovar(mylist, nodeSets=nodesets)
}
- assign(objnames[j], tmp, .GlobalEnv)
+ assign(objnames[j], tmp)
},
'exogenous event' = {
tmp <- namefiles[[1]]
@@ -668,7 +664,7 @@
})
tmp <- sienaCompositionChange(clist,
namesession$ActorSet[[1]])
- assign(objnames[j], tmp, .GlobalEnv)
+ assign(objnames[j], tmp)
},
{
if (is.null(filename))
@@ -687,9 +683,8 @@
}
## create the node sets
tmp <- lapply(1:length(ActorSets), function(x){
- assign(ActorSets[x], sienaNodeSet(ActorSetsSize[x],
- nodeSetName=ActorSets[x]),
- .GlobalEnv)
+ assign(ActorSets[x], pos=env, sienaNodeSet(ActorSetsSize[x],
+ nodeSetName=ActorSets[x]))
})
## create the group object
obj <- unlist(lapply(objnames, strsplit, split=" "))
@@ -704,18 +699,17 @@
stop(paste('Duplicate names',
obj[duplicated(obj)]))
}
- objlist <- mget(obj, .GlobalEnv)
- nodeSetList <- mget(ActorSets,.GlobalEnv)
+ objlist <- mget(obj, as.environment(-1))
+ nodeSetList <- mget(ActorSets, as.environment(-1))
names(nodeSetList) <- NULL
## arglist <- c(objlist, nodeSets=nodeSetList)
assign(gps[i], do.call(sienaDataCreate,
- c(objlist, nodeSets=list(nodeSetList))),
- .GlobalEnv)
+ c(objlist, nodeSets=list(nodeSetList))))
}
##join the groups
if (length(gps) > 1)
{
- mydata <- sienaGroupCreate(mget(gps, .GlobalEnv))
+ mydata <- sienaGroupCreate(mget(gps, as.environment(-1)))
}
else
{
Modified: pkg/RSiena/changeLog
===================================================================
--- pkg/RSiena/changeLog 2012-12-24 00:41:15 UTC (rev 222)
+++ pkg/RSiena/changeLog 2013-01-01 19:09:51 UTC (rev 223)
@@ -1,3 +1,8 @@
+2013-01-01 R-forge revision 223
+
+ * R/sienaDataCreateFromSession.R: change assignments to frame of
+ function rather than using global environment.
+
2012-12-24 R-forge revision 222 mostly RSienaTest only
* tests/slowtest.R (added), R/document.R, .Rbuildignore: Created function
Modified: pkg/RSiena/man/RSiena-package.Rd
===================================================================
--- pkg/RSiena/man/RSiena-package.Rd 2012-12-24 00:41:15 UTC (rev 222)
+++ pkg/RSiena/man/RSiena-package.Rd 2013-01-01 19:09:51 UTC (rev 223)
@@ -30,8 +30,8 @@
\tabular{ll}{
Package: \tab RSiena\cr
Type: \tab Package\cr
-Version: \tab 1.1-222\cr
-Date: \tab 2012-12-24\cr
+Version: \tab 1.1-223\cr
+Date: \tab 2013-01-01\cr
License: \tab GPL-2 \cr
LazyLoad: \tab yes\cr
}
Modified: pkg/RSienaTest/DESCRIPTION
===================================================================
--- pkg/RSienaTest/DESCRIPTION 2012-12-24 00:41:15 UTC (rev 222)
+++ pkg/RSienaTest/DESCRIPTION 2013-01-01 19:09:51 UTC (rev 223)
@@ -1,8 +1,8 @@
Package: RSienaTest
Type: Package
Title: Siena - Simulation Investigation for Empirical Network Analysis
-Version: 1.1-222
-Date: 2012-12-24
+Version: 1.1-223
+Date: 2013-01-01
Author: Various
Depends: R (>= 2.15.0)
Imports: Matrix
Modified: pkg/RSienaTest/R/sienaDataCreateFromSession.r
===================================================================
--- pkg/RSienaTest/R/sienaDataCreateFromSession.r 2012-12-24 00:41:15 UTC (rev 222)
+++ pkg/RSienaTest/R/sienaDataCreateFromSession.r 2013-01-01 19:09:51 UTC (rev 223)
@@ -233,8 +233,7 @@
{
return(getInternals())
}
- ActorSets <- NULL
- ActorSetsSize <- NULL
+ env <- sys.frame(sys.nframe())
if (!is.null(filename))
{
session <- sessionFromFile(filename)
@@ -395,7 +394,7 @@
tmp <- sienaNet(mylist, nodeSet=namesession[1,
"ActorSet"])
}
- assign(objnames[j], tmp, .GlobalEnv)
+ assign(objnames[j], tmp)
},
'bipartite' = {
nodesets <-
@@ -483,7 +482,7 @@
{
stop("Two-mode pajek nets not supported")
}
- assign(objnames[j], tmp, .GlobalEnv)
+ assign(objnames[j], tmp)
},
'behavior' = {
##miss <- gsub(" ", "|",
@@ -496,8 +495,7 @@
## namefiles[[1]][grep(miss, namefiles[[1]])] <- NA
assign(objnames[j],
sienaNet(namefiles[[1]], type = 'behavior',
- nodeSet=namesession[1, "ActorSet"]),
- .GlobalEnv)
+ nodeSet=namesession[1, "ActorSet"]))
},
'constant covariate' = {
## miss <- gsub(" ", "|",
@@ -509,11 +507,10 @@
namefiles[[1]][namefiles[[1]] %in% miss] <- NA
varnames <- strsplit(objnames[j], ' ')[[1]]
tmp <- sapply(1: ncol(namefiles[[1]]), function(x){
- assign(varnames[x],
+ assign(varnames[x], pos=env,
coCovar(namefiles[[1]][, x],
nodeSet=namesession[1,
- "ActorSet"]),
- .GlobalEnv)})
+ "ActorSet"]))})
},
'changing covariate' = {
## miss <- gsub(" ", "|",
@@ -525,8 +522,7 @@
namefiles[[1]][namefiles[[1]] %in% miss] <- NA
assign(objnames[j],
varCovar (namefiles[[1]],
- nodeSet=namesession[1, "ActorSet"]),
- .GlobalEnv)
+ nodeSet=namesession[1, "ActorSet"]))
},
'constant dyadic covariate' = {
miss <- namesession$MissingValues
@@ -564,7 +560,7 @@
x=myedgelist[, 3])
tmp <- coDyadCovar(myval, nodeSets=nodesets)
}
- assign(objnames[j], tmp, .GlobalEnv)
+ assign(objnames[j], tmp)
},
'changing dyadic covariate' = {
if (namesession[1, "ActorSet"] == "Actors")
@@ -643,7 +639,7 @@
)
tmp <- varDyadCovar(mylist, nodeSets=nodesets)
}
- assign(objnames[j], tmp, .GlobalEnv)
+ assign(objnames[j], tmp)
},
'exogenous event' = {
tmp <- namefiles[[1]]
@@ -668,7 +664,7 @@
})
tmp <- sienaCompositionChange(clist,
namesession$ActorSet[[1]])
- assign(objnames[j], tmp, .GlobalEnv)
+ assign(objnames[j], tmp)
},
{
if (is.null(filename))
@@ -687,9 +683,8 @@
}
## create the node sets
tmp <- lapply(1:length(ActorSets), function(x){
- assign(ActorSets[x], sienaNodeSet(ActorSetsSize[x],
- nodeSetName=ActorSets[x]),
- .GlobalEnv)
+ assign(ActorSets[x], pos=env, sienaNodeSet(ActorSetsSize[x],
+ nodeSetName=ActorSets[x]))
})
## create the group object
obj <- unlist(lapply(objnames, strsplit, split=" "))
@@ -704,18 +699,17 @@
stop(paste('Duplicate names',
obj[duplicated(obj)]))
}
- objlist <- mget(obj, .GlobalEnv)
- nodeSetList <- mget(ActorSets,.GlobalEnv)
+ objlist <- mget(obj, as.environment(-1))
+ nodeSetList <- mget(ActorSets, as.environment(-1))
names(nodeSetList) <- NULL
## arglist <- c(objlist, nodeSets=nodeSetList)
assign(gps[i], do.call(sienaDataCreate,
- c(objlist, nodeSets=list(nodeSetList))),
- .GlobalEnv)
+ c(objlist, nodeSets=list(nodeSetList))))
}
##join the groups
if (length(gps) > 1)
{
- mydata <- sienaGroupCreate(mget(gps, .GlobalEnv))
+ mydata <- sienaGroupCreate(mget(gps, as.environment(-1)))
}
else
{
Modified: pkg/RSienaTest/changeLog
===================================================================
--- pkg/RSienaTest/changeLog 2012-12-24 00:41:15 UTC (rev 222)
+++ pkg/RSienaTest/changeLog 2013-01-01 19:09:51 UTC (rev 223)
@@ -1,3 +1,8 @@
+2013-01-01 R-forge revision 223
+
+ * R/sienaDataCreateFromSession.R: change assignments to frame of
+ function rather than using global environment.
+
2012-12-24 R-forge revision 222 mostly RSienaTest only
* tests/slowtest.R (added), R/document.R, .Rbuildignore: Created function
Modified: pkg/RSienaTest/man/RSiena-package.Rd
===================================================================
--- pkg/RSienaTest/man/RSiena-package.Rd 2012-12-24 00:41:15 UTC (rev 222)
+++ pkg/RSienaTest/man/RSiena-package.Rd 2013-01-01 19:09:51 UTC (rev 223)
@@ -30,8 +30,8 @@
\tabular{ll}{
Package: \tab RSiena\cr
Type: \tab Package\cr
-Version: \tab 1.1-222\cr
-Date: \tab 2012-12-24\cr
+Version: \tab 1.1-223\cr
+Date: \tab 2013-01-01\cr
License: \tab GPL-2 \cr
LazyLoad: \tab yes\cr
}
More information about the Rsiena-commits
mailing list