r - Couple several results in a single object -


i'm writing set of r functions online, publicly available, i'd clean job here...for first time.

basically there function f receives dataframe , computes 5 real-valued numbers, call them x1,x2,x3,x4 , x5. then, 1 can call set of other functions g1,g2,g3 that, based on 5 numbers, compute other things. i'd 5 numbers integrated in single object, speak. maybe let g_i functions part of object, method, or link original data generated them.

right f function returns vector named entries, i'd clean, have it's own print function, etc.

what best way this? i'm thinking of similar lm function , model objects. r objects? i've never done in r, pointer appreciated.

have thought of f function returning list? set return bit as

return.list <- list(x1=x1.val , x2=x2.val, x3=x3.val, x4=x4.val, x5=x5.val) return(return.list) 

then can access variables want calling return.list$x1 , on. works returning more complicated things data frames, tables or lists of lists.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

qt - Errors in generated MOC files for QT5 from cmake -