Dear all,
I'm creating a list (which is a tbl_graph) by a function, and assign the
result to a variable:
subnet_MYSUBNET <- my_function(MYSUBNET)
# MYSUBNET: a tbl_graph
Because there are multiple subnets to create, I can get the names of the
subnets (MYSUBNET1, MYSUBNET2, MYSUBNET3, etc.) from a row in a
dataframe column.
subnet_MYSUBNET <- my_function(datatable$column[i])
Because I know how many subnets to create - nrow(dataframe) I want to
assign the subnets to variables whose names contain the name of the subnet
For this to work I have to assign a variable name which is contained in
an other variable name:
#################
for(i in 1:nrow(datatable)) {
val <- datatable$column[i]
result <- assign(paste("subnet_", val, sep = "")
result <- my_function(val)
}
this works in bash, but seems not to work in R - I don't succeed at least.
Am I wrong?
Where is my mistake?
Many thanks in advance for any hint.
Wolfgang
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.