Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/65.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
尝试将列名传递给使用ggplot2的R函数_R_Function_Ggplot2 - Fatal编程技术网

尝试将列名传递给使用ggplot2的R函数

尝试将列名传递给使用ggplot2的R函数,r,function,ggplot2,R,Function,Ggplot2,我正在尝试构建一个自定义函数,该函数将使用ggplot2快速输出散点图。这是我当前的代码 quick.scatter <- function(x, y) { # Plot ggplot(data = train, aes(x = x, y = y)) + geom_point() } quick.scatter这已经存在于ggplot中:qplot(x,y,data=train)更重要的是,您需要搜索并阅读有关函数的内容aes\u string()。这是一个简单的方法

我正在尝试构建一个自定义函数,该函数将使用ggplot2快速输出散点图。这是我当前的代码

quick.scatter <- function(x, y) {

  # Plot
  ggplot(data = train, aes(x = x, y = y)) +
    geom_point()

}

quick.scatter这已经存在于ggplot中:
qplot(x,y,data=train)
更重要的是,您需要搜索并阅读有关函数的内容
aes\u string()
。这是一个简单的方法,或者你可以在谷歌上搜索并阅读有关准旋转的信息,这是ggplot2中最新支持的,但很难理解。我在构建ggplot相关函数时总是遇到问题。这个解释帮助了我: