Re: [R] Terminating a cmd windows from R

2024-08-19 Thread Jiefei Wang
You can use a parallel computing package to do it. I haven't test the code below (as I do not have a long-running batch file) but I think it should work: library(parallel) cl <- makeCluster(1) ## run the command in a child R process clusterEvalQ(cl, { nm_log <- "c:/nm74g64/run/nmfe74" nmi

Re: [R] unexpected behavior in apply

2021-10-08 Thread Jiefei Wang
not stripped. I would say this is not a good design, and it might be worth not including the NA value in the format function. At the current stage, I will suggest using the function `lapply` to do what you want. > lapply(d, FUN=function(x)all(x[!is.na(x)] <= 3)) $d1 [1] FALSE $d2 [1] TRUE $d3

Re: [R] unexpected behavior in apply

2021-10-08 Thread Jiefei Wang
Hi, I guess this can tell you what happens behind the scene > d<-data.frame(d1 = letters[1:3], + d2 = c(1,2,3), + d3 = c(NA,NA,6)) > apply(d, 2, FUN=function(x)x) d1 d2 d3 [1,] "a" "1" NA [2,] "b" "2" NA [3,] "c" "3" " 6" > "a"<=3 [1] FALSE > "2"<=3 [1] TRUE >

Re: [R] USB devices?

2021-09-26 Thread Jiefei Wang
Hi, If you can talk with your device through the terminal. One option is using 'system2' in R to send the command to your OS. Best, Jiefei On Sun, Sep 26, 2021 at 9:14 PM Roger Coppock wrote: > > How do I communicate directly with USB devices in R? > > Specifically, I want to read data from thi

Re: [R] Reading File Sizes: very slow!

2021-09-26 Thread Jiefei Wang
What kind of disk do you use? The hardware differences might be important to this issue. Best, Jiefei Leonard Mada via R-help 于 2021年9月26日周日 下午9:04写道: > Dear Bill, > > > - using the Ms Windows Properties: ~ 15 s; > > [Windows new start, 1st operation, bulk size] > > - using R / file.info() (2nd

Re: [R] showing the complexity of r code.....

2021-08-27 Thread Jiefei Wang
Hi, It all depends on the R skill level of your audience. If they are also programmers, show them your Github page and a list of the packages you made would be great. If they do not have any R experience, do some work on R shiny, tell them you can do all kinds of magic things with the data, and vi

Re: [R] with replace na with 0?

2021-06-11 Thread Jiefei Wang
Hi, I did not follow your previous post but your code looks confusing to me with(datatable,ifelse(is.na(x),y,x)) Why do you have 'x' in the first place if all you want is to do the operation on y? It's like you want to count how many apples you have but your eyes are looking at peaches. Please r

Re: [R] Weird (wrong?) result for fft

2021-03-22 Thread Jiefei Wang
Hi Filippo, Why do you expect these two expressions to produce the same output? Especially the second expression contains the first expression. There is no way to have the same result unless the function "fft( * , inverse = TRUE)" does nothing but multiplies the input by the input's length. It doe

Re: [R] Rstudio crashed when I try to train a nnet model.

2021-03-22 Thread Jiefei Wang
ackage. What can I do to solve this problem? > > Best regards > Baki > > On Monday, March 22, 2021, 06:55:00 AM GMT+3, Jiefei Wang < > szwj...@gmail.com> wrote: > > > Hi Baki, > > This should be a different issue. It looks like there is no problem in the > R

Re: [R] Rstudio crashed when I try to train a nnet model.

2021-03-21 Thread Jiefei Wang
435 > initial value 55650.887782 > final value 55650.887782 > converged > > Program early converged. Program didn't any calculations. > > Best, > Baki > > On Sunday, March 21, 2021, 07:35:31 PM GMT+3, Jiefei Wang < > szwj...@gmail.com> wrote: >

Re: [R] Rstudio crashed when I try to train a nnet model.

2021-03-21 Thread Jiefei Wang
Hi Baki, Perhaps out of memory? Would you be able to run your code through the R terminal? It probably can give us more information to debug the issue. Best, Jiefei On Mon, Mar 22, 2021 at 12:23 AM Baki UNAL via R-help wrote: > Hi, > I tried to train a neural network with following code: > nn2

Re: [R] Surprising behavior and bugs in R 4.0.4

2021-03-20 Thread Jiefei Wang
FYI, you do not have to provide a full link to the function "install.packages". Please install the package just by install.package("package name") Best, Jiefei On Sun, Mar 21, 2021 at 9:41 AM Jiefei Wang wrote: > Hi Miso, > > It looks like you have a corrupted pac

Re: [R] Surprising behavior and bugs in R 4.0.4

2021-03-20 Thread Jiefei Wang
(7.6 MB) > > downloaded 7.6 MB > > > > Error: could not find function "api_create" > > Execution halted > > Warning message: > > In install.packages( > https://cran.r-project.org/src/contrib/Archive/spatstat/spatstat_1.64-1.tar.gz, > : > > inst

Re: [R] Surprising behavior and bugs in R 4.0.4

2021-03-20 Thread Jiefei Wang
Hi Miso, Have you tried to install Seurat from CRAN? What you were using is the GitHub version of the package and has been actively updating, so the problem might be from the package. Best, Jiefei On Sat, Mar 20, 2021 at 10:32 PM Miso Na wrote: > Dear helpers, > > Although I uninstalled and re

Re: [R] about a p-value < 2.2e-16

2021-03-19 Thread Jiefei Wang
Cyrus Mehta, founder of StatXact software. Of > > >> course, examining the C code source would determine this, but I don't > > care > > >> to attempt this. > > >> > > >> If this is (no longer?) correct, please point this out. > > &g

Re: [R] about a p-value < 2.2e-16

2021-03-19 Thread Jiefei Wang
10:57 PM Spencer Graves < spencer.gra...@effectivedefense.org> wrote: > > > On 2021-3-19 9:52 AM, Jiefei Wang wrote: > > After digging into the R source, it turns out that the argument `exact` > has > > nothing to do with the numeric precision. It only affects the stat

Re: [R] about a p-value < 2.2e-16

2021-03-19 Thread Jiefei Wang
l Message- > >From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Jiefei > Wang > >Sent: Friday, 19 March, 2021 15:52 > >To: Spencer Graves > >Cc: r-help; Bogdan Tanasa > >Subject: Re: [R] about a p-value < 2.2e-16 > > > >After digging into

Re: [R] about a p-value < 2.2e-16

2021-03-19 Thread Jiefei Wang
exact p-value from the true distribution of the statistic, not a permutation or MC p-value. Best, Jiefei On Fri, Mar 19, 2021 at 10:01 PM Jiefei Wang wrote: > Hey, > > I just want to point out that the word "exact" has two meanings. It can > mean the numerically accurate p

Re: [R] about a p-value < 2.2e-16

2021-03-19 Thread Jiefei Wang
Hey, I just want to point out that the word "exact" has two meanings. It can mean the numerically accurate p-value as Bogdan asked in his first email, or it could mean the p-value calculated from the exact distribution of the statistic(In this case, U stat). These two are actually not related, eve

Re: [R] Warning messages while parallel computing

2021-03-04 Thread Jiefei Wang
Hi Shah, The error usually means you started a cluster and forgot to close it. From the code you post, I cannot see any problem. Maybe you run `makeCluster` twice by accident? Best, Jiefei On Thu, Mar 4, 2021 at 5:53 PM Shah Alam wrote: > Hello everyone, > > I am using the "parallel" R package

Re: [R] uint8

2021-02-04 Thread Jiefei Wang
Hi Luca, The answer to your question depends on your application. What do you want to do with x3? Do you really need a native vector to represent x1 and x2? Or you just want an object that behaves like it is a joint of x1 and x2? I do not think you can have a native vector x3 without paying anythi

Re: [R] parallel: socket connection behind a NAT router

2021-01-19 Thread Jiefei Wang
1, 1:50 AM, "R-help on behalf of Henrik Bengtsson" < > r-help-boun...@r-project.org on behalf of henrik.bengts...@gmail.com> > wrote: > > On Mon, Jan 18, 2021 at 9:42 PM Jiefei Wang wrote: > > > > Thanks for introducing this interesting package to me! it

Re: [R] parallel: socket connection behind a NAT router

2021-01-19 Thread Jiefei Wang
some! Many thanks for your help!!! Best, Jiefei On Tue, Jan 19, 2021 at 2:50 PM Henrik Bengtsson wrote: > On Mon, Jan 18, 2021 at 9:42 PM Jiefei Wang wrote: > > > > Thanks for introducing this interesting package to me! it is great to > know a new powerful tool, but it seems li

Re: [R] parallel: socket connection behind a NAT router

2021-01-18 Thread Jiefei Wang
:makeClusterPSOCK(workers) > > should do it. It does this without admin rights and port forwarding. > See also the README in https://cran.r-project.org/package=parallelly. > > /Henrik > > On Mon, Jan 18, 2021 at 6:45 AM Jiefei Wang wrote: > > > > Hi all, > > &

[R] parallel: socket connection behind a NAT router

2021-01-18 Thread Jiefei Wang
Hi all, I have a few cloud instances and I want to use them to do parallel computing. I would like to create a socket cluster on my local machine to control the remote instances. Here is my network setup: local machine -- NAT -- Internet -- cloud instances In the parallel package, the server nee

Re: [R] How to perform package cleanup when R session is ending?

2020-12-18 Thread Jiefei Wang
en cleaned > $ R --quiet > > library(testFinalizer, lib="lib") > Loading testFinalizer from /home/bill/packages/lib > Installed finalizer for > > objects(all=TRUE) > character(0) > > q("no") > cleanup() > cleaning > > On Fri, Dec

[R] How to perform package cleanup when R session is ending?

2020-12-18 Thread Jiefei Wang
Hi, I am looking for a way to clean up my package resources before R is ended. It looks like the .onUnload function would not be helpful as it would not be called before R is ended. This behavior has been described in the document: *Note that packages are not detached nor namespaces unloaded at t

Re: [R] assistance programming R

2020-11-16 Thread Jiefei Wang
HI Ablaye, PLEASE do read the posting guide http://www.R-project.org/posting-guide.html before you post your question. This is not the place for posting your homework. Even if it is, your homework question is really hard to read. Cheers, Jiefei On M

Re: [R] string concatenation

2020-11-05 Thread Jiefei Wang
for your help > > > > > > > > Med venlig hilsen/ Best regards > > > > Vincent Edjabou > > Mobile: +45 31 95 99 33 > > linkedin.com/vincent > > <http://linkedin.com/in/vincent-maklawe-edjabou-9742a41b> > > > > Orcid: -0003

Re: [R] string concatenation

2020-11-04 Thread Jiefei Wang
Hi John, Try paste0(x,collapse = ", ") Best, Jiefei On Thu, Nov 5, 2020 at 1:16 PM John wrote: > Hi, > > I have a sequence of characters: > > x <- c("Alice", "Bob", "Charles") > > How can I produce the following results: > > "Alice, Bob, Charles" > > ? > > paste? merge? > > Thank you very much