【发布时间】:2019-05-09 11:40:58
【问题描述】:
我正在 R-studio 中编码,并且有一个名为 saveResults() 的函数。需要:
-
sce- 单细胞实验对象。 -
opt- 包含五件事的清单 -
clusterLabels- 包含两列的简单数据框
重要的是我收到一条错误消息:
Error: unexpected symbol in:
"saveResults(sce = sce, opt = opt, clusteInputs()
zhengMix"
这与我传递给函数的参数完全不同。您可以在下面代码块的最后一行看到这一点:我传递了正确的参数,但我收到一个错误,提示我传递了 clusteInputs() 和 zhengMix 而不是 clusterLabels。我没有名为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)
有人知道发生了什么吗?我很坚持这一点。
【问题讨论】:
-
你是如何运行这段代码的。您是否复制/粘贴到 RStudio 中?好像你的输入在那里有一个坏字符。你试过重新输入吗?
-
我使用 bash 命令 Rscript 从终端调用 R 文件中的代码。
-
那么,您是在该文件中键入了所有这些命令还是在任何时候复制粘贴?听起来你只是在某个地方有一个错误的换行符。
标签: r debugging rstudio unexpected-token