Skip to content
Prev 295217 / 398506 Next

Problem with function

Hello,

There's nothing wrong with having 'thisCol' and 'thatCol' already defined or
not.
The problem is that your function does NOT return a value. Get rid of the
assignment and it will work.


CompFunct <- function(thisCol, thatCol) {cbind(finalTable[, thisCol],
finalTable[, thatCol])}


I would also include a data.frame argument,

CompFunct2 <- function(x, thisCol, thatCol) {cbind(x[, thisCol], x[,
thatCol])}
CompFunct2(finalTable, 2, 3)

(But the function is so simple that maybe it's purpose is to save some
keystrokes.)


Hope this helps,

Rui Barradas

acnunn wrote
--
View this message in context: http://r.789695.n4.nabble.com/Problem-with-function-tp4630805p4630808.html
Sent from the R help mailing list archive at Nabble.com.