Let's say that I'm trying to write a functions that will allow me to
automate a process
where I examine all possible combinations of various string groupings. Each
time I run
the one function, I want to include the new values to the end of a data
frame. The data
frame will basically be one column with a lot of rows.

roots <- c("car insurance", "auto insurance")
prefix <- c("cheap", "budget")
suffix <- c("rate", "rates")

one <- function(x, y, z=0) {
      nu <- do.call(paste, expand.grid(x, y, z))
      mydf <- data.frame(nu)
      print(mydf)
}

one(roots, suffix2)
one(prefix, roots)
one(prefix, roots, suffix2)

The code above just replaces each value in the data frame each time I run
the one function.

How can I add the new values to the end of the data frame?


Help!

I'm running R 2.13 on Ubuntu 10.10
WebRep
Overall rating

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
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.

Reply via email to