search for: inddf

Displaying 2 results from an estimated 2 matches for "inddf".

Did you mean: indf
2002 Nov 26
2
URGENT Help required
...s in the same matrix (models) one after the other. # Set general variables & matrix myDataFrame <- read.table("path",header=T) models <- matrix(nrow = 20, ncol =8) X <- matrix(nrow = 1, ncol = 6) compt <- 1 deb <- 0 fin <- 0 # Runsanalysis myFunction <- function(IndDF) { indDF <- as.data.frame(IndDF) for (i in 2:(length(IndDF)-1)) { for (j in ((i+1):(length(IndDF)))) { for (k in 0:5) { deb <- dim(IndDF)[1]-k*21-100 fin <- dim(IndDF)[1]-k*21...
2002 Nov 26
0
scope (was URGENT Help required)
...print(x); x <- 5; print(x) } > f() [1] 10 [1] 5 > x [1] 10 I suppose the "usual" way of doing what you wanted to do is make the objects you want inside the function (rather than the workspace), and return a list containing them. E.g., something like: myFunction <- function(IndDF) { models <- matrix(nrow = 20, ncol =8) X <- matrix(nrow = 1, ncol = 6) compt <- 1 indDF <- as.data.frame(IndDF) for (i in 2:(length(IndDF)-1)) { [whatever you need to do...] } return(list(models = models, compt = compt)) } Andy -----Origin...