I think you need to pass the resulting expression to R.print :
R.qplot("erase_rate", "components",f) |> R.print
The problem with using ggplot2 through a provider like F # is that the ggplot2 library is a bit smart. I have been playing with this for a while, and it seems to work quite well, as long as you use only the qplot function. If you want to do something more bizarre, then it's probably easier to just write R code as a string and call R.eval . For this you need:
// Helper function to make calling 'eval' easier let eval (text:string) = R.eval(R.parse(namedParams ["text", text ])) eval("library(\"ggplot2\")") // Assuming we have dataframe 'ohlc' with 'Date' and 'Open' eval(""" print( ggplot(ohlc, aes(x=Date, y=Open)) + geom_line() + geom_smooth() ) """)
I also spent some time figuring out how to transfer data from F # to R (i.e., creating an R data frame based on data from F #, for example, a CSV type provider). So, to populate the ohlc data ohlc , I used this (where SampleData is the CSV provider for Yahoo):
let df = [ "Date", box [| for r in SampleData.msftData -> r.Date |] "Open", box [| for r in SampleData.msftData -> r.Open |] "High", box [| for r in SampleData.msftData -> r.High |] "Low", box [| for r in SampleData.msftData -> r.Low |] "Close", box [| for r in SampleData.msftData -> r.Close |] ] |> namedParams |> R.data_frame R.assign("ohlc", df)
source share