简体   繁体   English

R中与我的代码不匹配的意外符号错误

[英]Unexpected symbol error in R that doesn't match my code

I am coding in R-studio and have a function called saveResults() . 我在R-studio中编码,并且具有一个名为saveResults()的函数。 It takes: 它需要:

  • sce - a Single Cell Experiment object. sce单细胞实验对象。
  • opt - a list with five things opt -列出五件事
  • clusterLabels - simple dataframe with two columns clusterLabels具有两列的简单数据clusterLabels

The important thing is that I receive an error stating: 重要的是,我收到一条错误消息:

Error: unexpected symbol in:
"saveResults(sce = sce, opt = opt, clusteInputs()
zhengMix"

which doesn't agree at all with the parameters I pass into the function. 这与我传入函数的参数完全不同。 You can see this on the last line of the code block below: I pass in proper parameters, but I receive an error that says I have passed in clusteInputs() , and zhengMix instead of clusterLabels . 您可以在下面的代码块的最后一行看到这一点:我传入了正确的参数,但是收到一条错误消息,提示我已经传入clusteInputs()zhengMix而不是clusterLabels I don't have a function called clusteInputs() , and zhengMix was several lines above. 我没有名为clusteInputs()的函数,而zhengMix在上面几行。

# Save the clustering data
InstallAndLoadPackagesForSC3Clustering()
opt <- GetOptionInputs()
zhengMix <- FetchzhengMix(opt)
sce <- CreateSingleCellExperiment(zhengMix)
clusterLabels <- getClusterLabels(sce)
opt <- createNewDirectoriesToSaveData(opt)
saveResults <- function(sce, opt, clusterLabels){
    print("Beginning process of saving results...")
    maxClusters = ncol(clusterLabels)/2+1
    for (n in 2:maxClusters){
        savePCAasPDF(sce, opt, numOfClusters = n, clusterLabels)
        saveClusterLabelsAsRDS(clusterLabels, numOfClusters = n, opt)
    }
    saveSilhouetteScores(sce, opt)
    print("Done.")
}
saveResults(sce = sce, opt = opt, clusterLabels = clusterLabels)

Does anyone have an idea what is going on? 有人知道发生了什么吗? I'm pretty stuck on this. 我对此很固执。

这不是最好的解决方案,但是我解决了自己的问题,方法是从函数中删除代码并在其中运行它不会引起任何问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM