search for: freq_2

Displaying 1 result from an estimated 1 matches for "freq_2".

Did you mean: freq2
2009 Apr 17
1
cast function in package reshape
...s, get(namef)) } names(res) <- namesf } return(res) } df <- data.frame(id = 1:50, x = sample(c(NA, 1), 50, T), y = sample(1:2, 50, T), z = sample(letters[1:2], 50, T)) > freq1(df$x) $freq_1 function (x) { sum(!is.na(x)) } <environment: 0x03d99684> > freq1(df$y) $freq_2 function (x) { sum(x[!is.na(x)] == 2) } <environment: 0x03d6c930> $freq_1 function (x) { sum(x[!is.na(x)] == 1) } <environment: 0x03d6c930> I would like to use this list of functions with cast function (in package reshape by Hadley Wickham) : > cast(melt(df, id = c("...