R:将库加载到MyPackage

时间:2015-08-10 14:45:16

标签: r ggplot2

我正在努力寻找如何将公共图书馆加载到我设置的软件包中。

MyPackage是我自己的Package ant,它使用ggplot2-library绘制一些曲线。但我不知道如何实现它。一旦我尝试使用Roxygen编译包,它就无法编译。

Hier是代码:

#' draw.data
#' 
#' Function to draw the curve(y = f(x)) related to a given matrix xy 
#' @param xy a matrix with two entries
#' @return plot of the matrix xy
#' @author
#' @export
    draw.data <- function(xy){
      # ggplot-library import?
      library(ggplot2)

      x.lab <- "concentration [M]"
      y.lab <- "normalised luminescence [%]"

      data.temp <- data.frame(xy)


      my_labels <- parse(text = paste("1E", seq(-10, -4, 1), sep = ""))

      ggp.temp <- ggplot(my.data) +
                  #geom_point(aes(x = x, y = y, color = as.factor(x))) +
                  #geom_point(aes(x = x, y = y)) +
                  geom_line(aes(x = x, y = y)) +
                  #geom_line(aes(x = x, y = y, color = as.factor(x))) +
                  scale_x_continuous(x.lab, breaks = seq(-10, -4, 1), labels = my_labels) + 
                  labs(title = "Graph", x = x.lab, y = y.lab)
      return (ggp.temp)
    }

0 个答案:

没有答案