r - ggvis integrated into a function -
i trying create basic function enter currency , function returns ggvis linegraph, issue occurs due quotation marks
current code:
ggcurr<-function(curr="aud"){ fx<-read.csv("rates.csv") fx$date<-as.character(fx$date) fx$date<-as.posixct(fx$date) gginput<-noquote(paste("~",curr,sep="")) fx%>%ggvis(~date,gginput)%>% layer_lines() } this code returns straight line.
i have attempted as.name() no avail
many thanks!
all solved, parse function worked, thank's helped!
in addition solution found parse, sort of thing prop function ggvis can used for.
for example, if wanted take simple line graph
mtcars %>% ggvis(~mpg, ~wt) %>% layer_lines() with y-variable wt given string doing in function, this:
curr = "wt" mtcars %>% ggvis(~mpg, prop("y", as.name(curr))) %>% layer_lines()
Comments
Post a Comment