Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sudden "unused argument" error

Tags:

r

I have no idea why but I am quite sure the following did produce a plot a while back. Can you tell me what's wrong here?

library(ggplot2)
qplot(c(0, 2), stat="function", fun=exp, geom="line") 

This returns "Error in c(0, 2) : unused argument (2)." Why?

Edit: This is a general problem:

a <- c(0, 2)

gives the same error. What's going on here?

like image 948
johnl Avatar asked Jun 02 '14 23:06

johnl


1 Answers

Works for me with ggplot2 v 0.9.3.1. Based on your edit, I'm 99% sure you have a different c() function defined in your workspace/loaded somewhere in your search path (getAnywhere("c")$where), which is masking the built-in version.

To test, try starting from a clean session (with --vanilla if possible to skip reloading workspace/executing .Rprofile/etc.)

If you're lucky the problem is in your global workspace and rm("c") will work -- otherwise you have to track down which package is loading this booby trap ... (find("c") could be useful in that case ...)

like image 75
Ben Bolker Avatar answered Oct 01 '22 04:10

Ben Bolker