Skip to content

It can't work when I source the function in the other .R file. #23

Description

@EularTang

Hi,
Thanks for your great job!But I encountered trouble in using the package 'docstring'.
When I code the own function in the another .R file and source it, The function docstring will report an error and will not display any help files.Details are as follows:

source('/home/tangchen/vde/ls.R')
docstring(define_sce)
Error in docstring_to_roxygen(fun, fun_name = fun_name, default_title = default_title): This function doesn't have any detectable docstring
Traceback:


1. docstring(define_sce)

2. docstring_to_roxygen(fun, fun_name = fun_name, default_title = default_title)

3. stop("This function doesn't have any detectable docstring")

But if I input my own function in console, everything will be OK.The words following the #' can be showed.
So what should I do to be able to use your function normally when I source the another R file?

define_sce=function(df,coldata=TRUE){
#' Compute similarity [/home/tangchen/code/scRNA_code/scmap_lung.R]
#' define our database
  if (coldata==TRUE){
      coldata=data.frame(cell=colnames(df),cell_type1=colnames(df))
  }
  e <- SingleCellExperiment(assays = list(normcounts = as.matrix(df)), colData = coldata)
  logcounts(e) <- log2(normcounts(e) + 1)    
  rowData(e)$feature_symbol <- rownames(e)    
  isSpike(e, "ERCC") <- grepl("^ERCC-", rownames(e))    
  e <- e[!duplicated(rownames(e)), ] 
  return(e)
}

docstring(define_sce)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions