Re: [R] Problem to run python code in r markdown

2023-01-20 Thread avi.e.gross
Kai, Just FYI, this is mainly an R mailing list and although there ware ways to combine python with R (or sort of alone) within environments like RSTUDIO, this may not be an optimal place to discuss this. You are discussing what is no longer really "R markdown" and more just plain "markdown"

Re: [R] Problem to run python code in r markdown

2023-01-20 Thread Milan Glacier
Maybe it is the order. You called py_install() first and then called use_condaenv(). Perhaps you need to switch to your conda env first and then call py_install(). On 01/20/23 16:20, Kai Yang via R-help wrote: Hi Team,I'm trying to run python in R markdown (flexdashboard). The code is below:

Re: [R] Problem to run python code in r markdown

2023-01-20 Thread Eric Berger
You don't specify what platform you are on (linux / Windows / other), and what tools you are using. I am running a linux system and I have virtual environments set up. I set the environment variable RETICULATE_PYTHON to point to python (in my virtual environment). I am using RStudio, and I use the

Re: [R] [EXTERNAL] Re: function doesn't exists but still runs..... (akshay kulkarni)

2023-01-20 Thread Jorgen Harmse via R-help
Hi Akshay, Lexical scoping and environments are closely tied. (I think Bill even cited the documentation.) I guess it's arcane in the sense that scoping usually does what you expect, but the way that works is related to what we discussed. What led you to discover the issue? Were you debugging

Re: [R] function doesn't exists but still runs..... (akshay kulkarni)

2023-01-20 Thread Jeff Newmiller
This is not a "problem" ... it is a "feature". Packages often use functions from other packages, but that does NOT mean that you as a user can automatically use those functions also. If Package A uses Package B to implement something, but Package B becomes unavailable, the maintainer of

Re: [R] function doesn't exists but still runs..... (akshay kulkarni)

2023-01-20 Thread akshay kulkarni
Dear Jorgen, thanks for the reply.so according to you one can pegion hole the problem as concerning R's lexical scoping rules,am I right? Or some arcane concept regarding environments? THanking you, Yours sincerely, AKSHAY M KULKARNI

Re: [R] function doesn't exists but still runs.....

2023-01-20 Thread akshay kulkarni
Dear Bill, Thanks for your reply...If I run selenium() in debug mode, java_check() should work inside of selenium(), right? Any other points to be considered when running selenium() in debug mode? THanking you, yours sincerely AKSHAY M KULKARNI

Re: [R] function doesn't exists but still runs.....

2023-01-20 Thread akshay kulkarni
Dear Greg, THanks for a very well pointed answer. THanking you, yours sincerely AKSHAY M KULKARNI From: Greg Snow <538...@gmail.com> Sent: Friday, January 20, 2023 10:28 PM To: akshay kulkarni Cc: R help Mailing list Subject: Re: [R]

Re: [R] function doesn't exists but still runs.....

2023-01-20 Thread Greg Snow
A little simpler answer than the others. Look at package Namespaces. When a package is created, the NAMESPACE file defines which functions in the package are exported (i.e. available for you to use), the other functions are "private" to the package meaning that other functions in the package can

[R] Problem to run python code in r markdown

2023-01-20 Thread Kai Yang via R-help
Hi Team,I'm trying to run python in R markdown (flexdashboard). The code is below: try Python= ```{r, include=FALSE, echo=TRUE}library(reticulate)py_install("numpy") use_condaenv("base") ``` ```{python}import numpy as np``` I got error message below: Error in py_call_impl(callable,

Re: [R] function doesn't exists but still runs..... (akshay kulkarni)

2023-01-20 Thread Jorgen Harmse via R-help
It may help to expand a bit on Bill Dunlap's answer. I think that library does something like this: Create a new environment for all the package objects. This environment will not be directly visible from .GlobalEnv, and ancestor environments may not be directly visible either. It may