processx | Execute and Control Subprocesses from R | Monitoring library
kandi X-RAY | processx Summary
kandi X-RAY | processx Summary
Execute and Control System Processes. Tools to run system processes in the background, read their standard output and error and kill them. processx can poll the standard output and error of a single process, or multiple processes, using the operating system’s polling and waiting facilities, with a timeout.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of processx
processx Key Features
processx Examples and Code Snippets
Community Discussions
Trending Discussions on processx
QUESTION
I am plotting two different types of data in r on the same x axis with the plot_ly library. I have two independent y axes. The data here is a quick mockup to represent the dataset with which I am working. I have a family of explanatory variables (i.e. actuals 1-10), their coefficients, and the normalized amount of times they appeared in a fictitious model, and NA values to pad the vectors in order to make data-frames:
...ANSWER
Answered 2021-Dec-02 at 18:48In short, the answer so far is no. Thanks to @neuron for their work going through ggplotly and ruling that approach out.
However, with some better range calculations and replacing the NA values with 0, it is possible to use the range=c()
argument in layout()
to ensure all the scatter points are not occluded by the bars. I tested this on the data set above as well as my actual data and it worked in all 696 cases.
QUESTION
I am plotting 4 plot_ly plots on the same "page" with the subplot
function in the plot_ly library. The data here is a quick mockup to represent the dataset with which I am working. I have 4 families of explanatory variables (i.e. actuals 1-10, bias 25,50,70,100), their coefficients, and the normalized amount of times they appeared in a fictitious model, and NA values to pad the vectors in order to make data-frames:
ANSWER
Answered 2021-Nov-30 at 22:11Turns out this is a known bug with a workaround posted on GitHub here:
https://github.com/plotly/plotly.R/issues/954#issuecomment-453872899
QUESTION
Since a few months, ggplot2 started to save png files with a transparent background. The code output in Rstudio and when saved as pdf looks great. It happens mainly with the use of themes when I omit the gray panel background. I tested it on my macbook with "Preview" and on a Windows Computer with the "foto viewer" there.
...ANSWER
Answered 2021-Nov-11 at 14:11Maybe indeed worth an answer for posterity...
Specify ggsave("test.png", dpi = 300, bg = "white")
Background (pun intended): the argument will be passed to grDevices::png
via the ...
argument. bg
controls the background of the device.
QUESTION
I have a process (let's call it ProcessX) that runs by default with only Terminate
, Synchronize
, and Query Limited Information
permissions.
When I look at ProcessX in Process Hacker, I can see the permission (ACE, Owner, etc). I can see that I'm the owner of ProcessX, I can see the 3 limited permissions associated with it (Terminate
, Synchronize
, and Query Limited Information
), and I can even edit the permissions (for instance, set Full Control
on it).
However, when I run the code below to check the DACL of ProcessX, with the same user that owns ProcessX, I'm getting an error code 5 (Access Denied) on the GetSecurityInfo()
function.
Same results with AccessChk and Process Explorer on ProcessX.
However, Process Hacker is perfectly able to read the DACL of ProcessX and modify it.
I don't understand. How is that possible? Why is my code unable to read the DACL for ProcessX?
I've read in MS documents that to read the DACL, I must use OpenProcess()
with READ_CONTROL
.
But READ_CONTROL
is not an available ACE on the process for my user. So, I can't open the process with it (OpenProcess()
errors if I try, which is logical).
So, I'm the owner of the process, but I can't modify the ACE, but Process Hacker can.
Can anybody help me understand?
...ANSWER
Answered 2021-Oct-22 at 15:02Problem solved !
I've assumed that READ_CONTROL
will be refused because it wasn't available on the DACL of the running process.
Turns out, when you own an object, you have implicit READ_CONTROL
and WRITE_DAC
permission on it, even if zero ACE are set on the object for the user owning it.
QUESTION
TL;DR I’m wondering if readr or tibble or anything base/tidyverse can make a tibble from a character vector of CSV rows (as if I had done read_lines() on some CSV file).
More explanation: I am collecting output (from stdout of a processx object) into a character vector, and this output is actually lines of a CSV, being created by the subprocess. I would like to make this into a tibble, but the only function I can find that does this is data.table::fread (via the ‘text’ arg). This is in a package and I don’t really want to take a dependency on data.table solely for this one function.
I’ve looked through the tidyverse docs and I can’t find anything. I realize I could write my own parser, and I started doing it with map_def and str_split but then I realized there are subtleties like “ignore the comma if it’s within quotes”, etc. maybe I’m just being lazy, but I don’t really want to implement a full csv parser when there are millions that already exist. Not to mention, speed concerns. This vector is sometimes 10k+ rows and I’m sure my homemade approach would not be the most optimized.
Any thoughts are welcome. Maybe I should just bite the bullet and either write the parser or use data.table but I feel like I can’t be the first person to want to do this and there must be something g built in that I’m missing. Thanks!
...ANSWER
Answered 2021-Oct-20 at 13:12Does read.csv
not work?
QUESTION
I tried to install a companion R package called Rling from this website https://benjamins.com/sites/z.195/content/package.html. In vain. There was an answer to the same question before Error trying to install Rling package in R. So I installed devtools with no problem. Then I used devtools::install_local to install Rling:
...ANSWER
Answered 2021-Oct-08 at 12:12processx
is a package on CRAN:
https://cran.r-project.org/web/packages/processx/index.html
It was updated in March 2021 to version 3.5.0 and in April to 3.5.1. The error message suggests to update as in
QUESTION
I am using Shiny with a local server installed.
My Shiny app runs a heavy local program using system/system2/processx::run. I am running it synchronously (wait=T). If the user closes the browser window of the Shiny, I would love the heavy program to end. If the user re-opens the browser window, I want the Shiny app to be ready again for executing the local program.
How can this be achieved?
When I use system/system2/processx::run, it seems that the app waits for the heavy program to finish and does not stop it upon close.
Reprex:
...ANSWER
Answered 2021-Sep-29 at 12:10@PorkChop's comment is pointing in the right direction. However, I'd recommend using processx::process
rather than run
as it provides us with methods to control the started process from within R. See ?process
. (run
by the way is also based on the process class.)
The main problem here is, that running the process synchronously (wait=TRUE
) blocks the R session. Accordingly onStop
won't fire until R is back in control.
Therefore you can't trigger anything once the browser window was closed because the shiny-session continues to run until the external program is finished and R can close the shiny-session.
On session end, the below code checks if the asynchronously started process is still alive and kills it if necessary (tested on windows only).
QUESTION
I am writing a function for my app that will call a process in the background, and monitor the moment it stops. Upon closing the session, the process should be killed, so I want it to be available outside of the function. If I assign the process with the <<-
sign, something strange happens...
ANSWER
Answered 2021-Sep-27 at 09:50The problem is that everytime you call runAsync()
you add a new observeEvent
call, a quick fix would be to introduce a reactive value that checks if the function was already called and then do not add a new observeEvent
as shown in that example:
QUESTION
I’m creating a Shiny app that uses the caret package to do some SVM free-text analysis.
The app runs fine without any error in my computer. I’m using R x64 4.0.4 and R studio 1.3.1093
I’m deploying app to an internal enterprise server https://rconnect.xxxx.com/connect/#/apps/####
This app is deployed in the server and started.
But when I reach the line where I run the train function:
ANSWER
Answered 2021-Aug-05 at 01:15Errors like this in Shiny apps are almost always a result of missing packages, which the logs confirm.
Turns out in this case I think the missing package is kernlab
, which I only found by reading the documentation given here: https://topepo.github.io/caret/train-models-by-tag.html#Support_Vector_Machines. It's a suggested package, not imported, so the command suggested in the comments by heds1 would sort this out.
QUESTION
Unable to install any package from GitHub, System Error 267
I've newly setup R (v4.1), Rstudio and just installed devtools. I also additionally installed Rtools40 and added it to my path (global environment)
Rtools seems to work properly as validated with: Sys.which("make")
& maketools::rtools_find()
(output below)
I am unable to install any package from GitHub, e.g. rstudio/gt. The error is nearly identical for any GitHub Package, allways stating system error 267
ANSWER
Answered 2021-Jul-16 at 11:39The standalone mode of the remotes package solved the issue for me, as suggested by the maintainer of processx (Gábor Csárdi) here
devtools::install_github()
only calls remotes::install_github()
.
However, for the remotes, there is the option to be exectued in standalone mode
Source: Cran
Standalone mode
remotes will use the curl, git2r and pkgbuild packages if they are installed to provide faster implementations for some aspects of the install process. However if you are using remotes to install or update these packages (or their reverse dependencies) using them during installation may fail (particularly on Windows).
If you set the environment variable R_REMOTES_STANDALONE="true" (e.g. in R Sys.setenv(R_REMOTES_STANDALONE="true")) you can force remotes to operate in standalone mode and use only its internal R implementations. This will allow successful installation of these packages
With the following lines of code, gt was finally successfull installed from github.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install processx
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page