r - why function rbind.data.frame behave different in do.call -


i have question do.call, pretty strange

1. trying do

i trying bind many data frames 1 single data frame, data frames in list t3, may see pic below:

list variable t3

2. methods

2.1 1 works

t4 <- do.call(rbind.data.frame, t3)

2.2 not works

t4 <- rbind.data.frame(t3)

the error message below:

error message

3. question

i think rbind.data.frame behave same if remove do.call, why works if using do.call? in advance.

the function do.call(fun, list) designed accept input function fun along list input list. applies function each element in list , aggregates results.

in call

t4 <- rbind.data.frame(t3) 

you trying rbind list of data frames, when rbind.data.frame function expecting single data frame instead of t3 input.

you use rbind.data.frame without do.call if wanted to. assuming had 5 elements in list t3, following should work:

t4 <- rbind.data.frame(t3[[1]], t3[[2]], t3[[3]], t3[[4]], t3[[5]]) 

as can see, tedious (and not readable) quickly. advantage of using do.call().


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -