Displaying 2 results from an estimated 2 matches for "my_calc".
2011 Sep 24
1
Can't reliably use RefClass methods in Snowfall
...have not heard back. Any
help is greatly appreciated!
Henry Bryant
Texas A&M University
library("snowfall")
library("methods")
# set up a simple reference class
calculator <- setRefClass("calculator")
calculator$methods(do_calc = function(x) {print(x*x)})
my_calc <- calculator$new()
wrapper <- function(x) {my_calc$do_calc(x)}
# STANZA 2: use snowfall without wrapper -- WORKING
#sfInit(parallel=TRUE, cpus=2, type="SOCK")
#sfExport("calculator")
#sfExport("my_calc")
#results <- sfLapply(1:10,my_calc$do_calc)
#sfStop()
#...
2010 Nov 16
0
renaming a list of data frames y calculating with lapply
...$ COD : Factor w/ 2 levels "FE","O": 2 2 2 2 2 2 2 2 2 2 ...
..$ piece: num [1:456] -0.874 -0.874 -0.874 -0.874 -0.66 ...
...
on a single a data frame it is possible to use names or <- to change column
name "piece" for something more meaningful to me like "my_calc" i don't
know how generalize that to a list of dataframes perhaps something like
lapply(data, names,...)
"piece" is in fact the result of few lines of ugly code with rapply, sapply
and llply the names were lost somewhere...
1. How do i change "piece" name?
I need t...