Posts

dplyr mutate not applying to individual element of field

dplyr mutate not applying to individual element of field I'm trying to do a calculation using an home made function inside a mutate call and it's not doing what I'm expecting it to do. mutate Here is a reproducible example: library(dplyr) #the data dd <- structure(list(fire_zone = c("ET", "EJB", "WJB"), base_med = c(1, 1, 2)), class = "data.frame", row.names = c(NA, -3L)) # my home made function med2lambda <- function(med) polyroot(c(-0.02, 1/3 - med, 1)) %>% suppressWarnings(as.numeric(.)) %>% max So, what my function does is to estimate the lambda associated to the median from a Poisson distribution by calculating the root of a quadratic function. Despite the long explanation, it's actually pretty basic: med2lambda(1) [1] 0.695426 med2lambda(2) [1] 1.678581 Now, I want to use it in a mutate call to add a field giving the lambda associated to each median in the table: mutate dd %>% mutate(lambda = med2lambda(...

Finding Undisclosed Restaurants on the Adriatic Coast

Image
12 2 Along the Adriatic coast there are some bizarre looking fishing piers called 'Trabocchi'. Some of these are apparently several hundred years old. San Vito Chietino, for example is mentioned in the Wikipedia as... The town is home to the "La Costa dei Trabocchi". Trabocchi are giant wooden platforms built since 1400, in the middle of the sea. They can be seen from the town of Ortona to Fossacesia. For local fisherman this was one of the method to fish abundant catch for the residents. Source: Wiki entry for San Vito Chietino Check this photo... Source: Google Maps: The overflow "classic location for fishing from the shore I am informed that some of these 'traboccho' have been converted to combination fishing piers and restaurants, and eating a dish of "Luppa di Cozze" on one of these structures would be a fantastic culinary adventure. Question: The problem is that which ones contain a restaurant appears to be word-of-mouth onl...