Displaying 1 result from an estimated 1 matches for "default_frequency".
2011 Mar 03
1
Applying function to multiple data
...ver I am not able to figure out how to apply
the function to multiple sets of data.
# MY QUERY
Suppose I am having following data.frame
df = data.frame(k = c(1:8), ratings = c("A", "B", "C", "D", "E", "F", "G",
"H"),
default_frequency =
c(0.00229,0.01296,0.01794,0.04303,0.04641,0.06630,0.06862,0.06936))
# -------------------------------
DP = function(k, ODF, ratings)
{
n <- length(ODF)
tot_klnODF <- sum(k*log(ODF))
tot_k <- sum(k)
tot_lnODF <- sum(log(ODF))
tot_k2...