cran

How Igraph handle weights?

ぃ、小莉子 提交于 2020-01-06 08:44:34
问题 Good day to everyone. I have a really simple question that I wasn't able to find an answer, because of lack of terminology I am afraid. In r's package igraph how are considered weights? Are they considered a cost, therefore reducing the capacity of an edge or are they considered indeed as the capacity of the edge? Thank you very much 回答1: In igraph, weights are edge-attributes that represent the friction or cost of traveling that edge in a parth, not the capacity or bandwidth of the edge. Low

Redirect system2 stdout to a file on windows

一世执手 提交于 2019-12-31 01:52:07
问题 According to the manual, the stdout argument of the system2 function can redirect output to a file. This seems to work on unix, however I can't get it to work on windows. The toy example below, no out.txt or err.txt files are created. I tried sending it to an existing file, or expand the full file path, but with no success: setwd(tempdir()) system2("whoami", stdout="out.txt", stderr="err.txt") file.exists("out.txt") Am I doing something wrong or is this a limitation in system2 ? 回答1: I'm

Homebrew R build missing Cairo

空扰寡人 提交于 2019-12-30 06:43:26
问题 I installed R on an OSX 10.7.5 server using brew: brew install R Everything seems so OK far, however Cairo is not working: > svg(tempfile()) Warning messages: 1: In svg(tempfile()) : unable to load shared object '/usr/local/Cellar/r/2.15.2/R.framework/Resources/library/grDevices/libs//cairo.so': dlopen(/usr/local/Cellar/r/2.15.2/R.framework/Resources/library/grDevices/libs//cairo.so, 6): image not found 2: In svg(tempfile()) : failed to load cairo DLL The shared object file seems to be

R, passing variables to a system command

风格不统一 提交于 2019-12-30 05:00:14
问题 Using R, I am looking to create a QR code and embed it into an Excel spreadsheet (hundreds of codes and spreadsheets). The obvious way seems to be to create a QR code using the command line, and use the "system" command in R. Does anyone know how to pass R variables through the "system" command? Google is not too helpful as "system" is a bit generic, ?system does not contain any examples of this. Note - I am actually using data matrices rather than QR codes, but using the term "data matrix"

Using un-exported function from another R package?

爱⌒轻易说出口 提交于 2019-12-28 13:47:07
问题 I often use utility type functions from other packages that are un-exported: pkg:::fun() . I am wondering if I can use such a function within new functionality/scope in my own R package. What is the correct approach here? Is including the package in my description file enough? 回答1: Another trick is using getFromNamespace fun = getFromNamespace("fun", "pkg") The only advantage over ::: is that you don't get any NOTEs and it's allowed on CRAN. Of course this is not good practice as a hidden

Combining S4 and S3 methods in a single function

↘锁芯ラ 提交于 2019-12-28 04:08:29
问题 What is a good way of defining a general purpose function which should have implementations for both S3 and S4 classes? I have been using something like this: setGeneric("myfun", function(x, ...){ standardGeneric("myfun"); }); setMethod("myfun", "ANY", function(x, ...) { if(!isS4(x)) { return(UseMethod("myfun")); } stop("No implementation found for class: ", class(x)); }); This succeeds: myfun.bar <- function(x, ...){ return("Object of class bar successfully dispatched."); } object <-

Combining S4 and S3 methods in a single function

﹥>﹥吖頭↗ 提交于 2019-12-28 04:08:28
问题 What is a good way of defining a general purpose function which should have implementations for both S3 and S4 classes? I have been using something like this: setGeneric("myfun", function(x, ...){ standardGeneric("myfun"); }); setMethod("myfun", "ANY", function(x, ...) { if(!isS4(x)) { return(UseMethod("myfun")); } stop("No implementation found for class: ", class(x)); }); This succeeds: myfun.bar <- function(x, ...){ return("Object of class bar successfully dispatched."); } object <-

Put figure directly into Knitr document (without saving file of it in folder) Part 2

对着背影说爱祢 提交于 2019-12-25 04:15:29
问题 I am extending a question I recently posted here (Put figure directly into Knitr document (without saving file of it in folder)). I am writing an R package that generates a .pdf file for users that outputs summarizations of data. I have a .Rnw script in the package (here, my MWE of it is called test.Rnw). The user can do: 1) knit("test.Rnw") to create a test.tex file 2) "pdflatex test.tex" to create the test.pdf summary output file. The .Rnw file generates many images. Originally, these all

install latest version of R 3.2.1 (World-Famous Astronaut) on Linux Mint 17.1 (MATE)

☆樱花仙子☆ 提交于 2019-12-24 14:28:44
问题 I just switched from Mac to Linux, so while I have a basic understanding of Linux structure, there are still some things Im trying to clear up. This is one of them. I have tried multiple ways (referencing multiple forum posts) to install the latest version of R (3.2.1 "World-Famous Astronaut") on Linux Mint 17.1 (MATE). I tried different sources lists, the most recent being: deb http://cran.rstudio.com/bin/linux/debian wheezy-cran3/ but when I call: apt-cache showpkg r-base-dev with each of

What does the “0-cloud” mirror stands for in R? [closed]

∥☆過路亽.° 提交于 2019-12-24 11:44:07
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . What does 0-cloud mirror stands for in R 3.x.x ? Just after installation R 3.0.1 I spotted that there is new mirror called "0-cloud" what is it ? I can't google it, I suppose that appeared just in 3.0.1 version. 回答1: It is a content-delivery network (CDN) created by RStudio to provide "local" CRAN mirrors. CDNs