r

mcapply: all scheduled cores encountered errors in user code

↘锁芯ラ 提交于 2021-02-09 09:22:17
问题 The following is my code. I am trying get the list of all the files (~20000) that end with .idat and read each file using the function illuminaio::readIDAT . library(illuminaio) library(parallel) library(data.table) # number of cores to use ncores = 8 # this gets all the files with .idat extension ~20000 files files <- list.files(path = './', pattern = "*.idat", full.names = TRUE) # function to read the idat file and create a data.table of filename, and two more columns # write out as csv

mcapply: all scheduled cores encountered errors in user code

被刻印的时光 ゝ 提交于 2021-02-09 09:21:33
问题 The following is my code. I am trying get the list of all the files (~20000) that end with .idat and read each file using the function illuminaio::readIDAT . library(illuminaio) library(parallel) library(data.table) # number of cores to use ncores = 8 # this gets all the files with .idat extension ~20000 files files <- list.files(path = './', pattern = "*.idat", full.names = TRUE) # function to read the idat file and create a data.table of filename, and two more columns # write out as csv

mcapply: all scheduled cores encountered errors in user code

╄→尐↘猪︶ㄣ 提交于 2021-02-09 09:21:06
问题 The following is my code. I am trying get the list of all the files (~20000) that end with .idat and read each file using the function illuminaio::readIDAT . library(illuminaio) library(parallel) library(data.table) # number of cores to use ncores = 8 # this gets all the files with .idat extension ~20000 files files <- list.files(path = './', pattern = "*.idat", full.names = TRUE) # function to read the idat file and create a data.table of filename, and two more columns # write out as csv

How do I get rid of grids when using plot() in R?

血红的双手。 提交于 2021-02-09 09:13:47
问题 So I'm using R to perform a DCA (detrended correspondence analysis) through Vegan package and everytime I plot my results I get a grid in the middle of the plot. I want to get rid of it. Here is my code: dca <- decorana(dados) plot(dca, type = "n", ann = FALSE, origin = TRUE) text(dca, display = "sites") points(dca, display = "species", pch = 21, col="red", bg = "red", cex=0.5) mtext(side = 3, text = "Análise de Correspondência Retificada (DCA)", font=2, line = 2.5, cex=1.8, font.lab=6, cex

R & quosures - How to get names of symbols contained in a vector passed as function argument?

醉酒当歌 提交于 2021-02-09 08:56:28
问题 I want to write an R function arg2str that returns the names (that is a vector of strings) of the symbols that are fed as arguments. For the most simple case, I only have one input symbol: library ("rlang") arg2str.v0 <- function (arg) rlang::quo_name (enquo (arg)) arg2str.v0 (a) ## [1] "a" If I have multiple symbols, I can use the three-dots construct: arg2str.v1 <- function (...) sapply (enquos (...), rlang::quo_name) arg2str.v1 (a, b, c) ## ## "a" "b" "c" (Subsidiary question: why is the

How to overload S4 slot selector `@` to be a generic function

≯℡__Kan透↙ 提交于 2021-02-09 08:49:06
问题 I am trying to turn the @ operator in R into a generic function for the S3 system. Based on the chapter in Writing R extensions: adding new generic I tried implementing the generic for @ like so: `@` <- function(object, name) UseMethod("@") `@.default` <- function(object, name) base::`@`(object, name) However this doesn't seem to work as it breaks the @ for the S4 methods. I am using Matrix package as an example of S4 instance: Matrix::Matrix(1:4, nrow=2, ncol=2)@Dim Error in @.default

Why is the first bar so big in my R histogram?

你。 提交于 2021-02-09 08:44:05
问题 I'm playing around with R. I try to visualize the distribution of 1000 dice throws with the following R script: cases <- 1000 min <- 1 max <- 6 x <- as.integer(runif(cases,min,max+1)) mx <- mean(x) sd <- sd(x) hist( x, xlim=c(min - abs(mx/2),max + abs(mx/2)), main=paste(cases,"Samples"), freq = FALSE, breaks=seq(min,max,1) ) curve(dnorm(x, mx, sd), add = TRUE, col="blue", lwd = 2) abline(v = mx, col = "red", lwd = 2) legend("bottomleft", legend=c(paste('Mean (', mx, ')')), col=c('red'), lwd=2

Difference between AUPRC in caret and PRROC

自作多情 提交于 2021-02-09 08:37:23
问题 I'm working in a very unbalanced classification problem, and I'm using AUPRC as metric in caret. I'm getting very differents results for the test set in AUPRC from caret and in AUPRC from package PRROC. In order to make it easy, the reproducible example uses PimaIndiansDiabetes dataset from package mlbench: rm(list=ls()) library(caret) library(mlbench) library(PRROC) #load data, renaming it to 'datos' data(PimaIndiansDiabetes) datos=PimaIndiansDiabetes[,1:9] # training and test set.seed(998)

Create hexagonal grid over city and associate with lon / lat points (in R)

╄→гoц情女王★ 提交于 2021-02-09 08:35:18
问题 I've been researching this for a while now but haven't come across any solution that fit my needs or that I can transform sufficiently to work in my case: I have a large car sharing data set for multiple cities in which I have the charging demand per location (e.g. row = carID, 55.63405, 12.58818, charging demand). I now would like to split the area over the city (example above is Copenhagen) up into a hexagonal grid and tag every parking location with an ID (e.g. row = carID, 55.63405, 12

Difference between AUPRC in caret and PRROC

大憨熊 提交于 2021-02-09 08:34:51
问题 I'm working in a very unbalanced classification problem, and I'm using AUPRC as metric in caret. I'm getting very differents results for the test set in AUPRC from caret and in AUPRC from package PRROC. In order to make it easy, the reproducible example uses PimaIndiansDiabetes dataset from package mlbench: rm(list=ls()) library(caret) library(mlbench) library(PRROC) #load data, renaming it to 'datos' data(PimaIndiansDiabetes) datos=PimaIndiansDiabetes[,1:9] # training and test set.seed(998)