r,ggplot2,radar-chart,aesthetics

Sorry, I was beeing stupid. This seems to work: library(ggplot2) # Define a new coordinate system coord_radar <- function(...) { structure(coord_polar(...), class = c("radar", "polar", "coord")) } is.linear.radar <- function(coord) TRUE # rescale all variables to lie between 0 and 1 scaled <- as.data.frame(lapply(mtcars, ggplot2:::rescale01)) scaled$model <- rownames(mtcars) # add...

Inside a function you need to use substitute instead of quote: data(iris) te <- function(data,x,y){ x <- substitute(x) y <- substitute(y) g <- ggplot(data,aes_q(x=x,y=y)) + scale_x_discrete() + scale_y_continuous() + geom_point() return(g) } te(iris,x=Species,y=Petal.Length) This will work perfect. P.S. I changed scale_x_continuous to scale_x_discrete because Species is discrete ...

Your x axis (period) is a factor rather than numeric, so it doesn't connect them. You can fix this by setting group = 1 in the aesthetics, which tells ggplot2 to group them all together into a single line: ggplot(plot.tab, aes(x = period, y = def.percent, group = 1)) +...

aes saves you some typing as you don't need the quotes. That is all. You are of course free to always use aes_string. You should use aes_string if you want to pass the variable names programmatically. Internally aes uses match.call for the non-standard evaluation. Here is a simple example for...