Hello, Thanks in advance for any help!
How do I pass an unknown number of objects into the "..." (dot dot dot) parameter? Put another way, is there some standard way to pass multiple objects into "..." to "fool" the function into thinking the objects are passed in separately/explicitly with common separation (like "x,y,z" when x, y and z are objects to be passed into "...")? Details: I'm working with this parameter list and function: interval_intersection(x, ..., check_valid = TRUE) To illustrate... This works and I get the expected interval: library('intervals') # create individual Intervals objects z = Intervals(c(1,10)) y = Intervals(c(5,10)) x = Intervals(c(4,6)) > interval_intersection(x,y,z) Object of class Intervals 1 interval over R: [5, 6] ...but at run time I don't know how many Intervals objects I will have so I can't list them explicitly like this "x,y,z". So I build a matrix of Intervals (per the package manual) and the function doesn't work: > xyz = matrix(c(4,5,1,6,10,10),nrow=3) > xyz [,1] [,2] [1,] 4 6 [2,] 5 10 [3,] 1 10 > xyz_interval = Intervals(xyz) > interval_intersection(xyz_interval) Object of class Intervals 1 interval over R: [1, 10] ...[1,10] is unexpected/wrong because I want the intersection of the three intervals. So I conclude that I need to pass in the individual Intervals objects, but how do I do that if I don't know how many I have at run time? I tried putting them in a list, but that didn't work. I also tried using paste( ,sep=',') and get(). Is there some standard way to pass multiple objects into "..." to "fool" the function into thinking they are passed in separately/explicitly with common separation? Thanks! ben [[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.