Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201867

Data frame calculated column not calculating correctly

$
0
0
deltas = 10^c(-1:-12)
df = data.frame(deltas)
df <- mutate(df, Num_H11 = -(
  Gamma_log_like(optout_gamma$par - c(df$deltas, 0), X)
  - 2 * Gamma_log_like(optout_gamma$par, X)
  + Gamma_log_like(optout_gamma$par + c(df$deltas, 0), X)) / (df$deltas^2)
  )

In the above code, if I replace df$deltas with a single delta value it all calculates correctly, but when i use a reference to a data frame column, the results are incorrect and I get the following warning:

longer object length is not a multiple of shorter object lengthlonger object length is not a multiple of shorter object length

Viewing all articles
Browse latest Browse all 201867

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>