Skip to content
Advertisement

Tag: r

Python from RMarkdown – Matplotlib problems

I’m trying to use reticulate to run some simple Python code in an RMarkdown document. I’ve found that if Matplotlib is in the conda environment, I get errors when trying to run a python code chunk, but I can run Python from R directly. Here’s a simple example of what I see: My first thought was that reticulate was not

Is there a hypergeometric function in python?

Is there any module/function in python that supply the same functionality as the Hypergeometric Function in R? (dhyper, phyper, qhyper, rhyper)- docs for the function in R Answer Looks like this is implement in scipy. https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.hypergeom.html

Index Pandas Dataframe mixing row number and column name

Coming from R and finding the index rules for pandas dataframes to be not easy to use. I have a dataframe where I want to get the ith row and some columns by their names. I can clearly understand using either iloc or loc as shown below. Conceptually what I want is something like: Meaning the first row with those

Getting word count of doc/docx files in R

I have a stream of doc/docx documents that I need to get the word count of. The procedure so far is to manually open the document and write down the word count offered by MS Word itself, and I am trying to automate it using R. This is what I tried: Unfortunately, wordCount is NOT what MS Word suggests. For

How to import r-packages in Python

I’m a bit troubled with a simple thing. I was trying to install a package called hunspell, but I discovered it is originally an R package. I installed this version: https://anaconda.org/conda-forge/r-hunspell, but I’m not being able to import it. Is this package supposed to work with Python? Should I use rpy2 to import it? First time using cross-platform packages so

R reticulate libstdc++so GLIBCXX_3.4.21 not found issue

I was trying to use pandas from R . I used the reticulate library for the same. The sample code I used is given below library(reticulate) use_condaenv(“my_env_37”,required=T) py_discover_config() py_run_string(“import pandas as pd”) Error Output from py_discover_config() Conda version : 4.6.8 Python Version : 3.6.8 Pandas Version : 0.24.2 OS: RHEL 7.4 R Version : 3.5.1 reticulate Version : 1.9 Is

How to plot (inline) with rpy2 in Jupyter notebook?

I’m learning to use rpy2 in Jupyter notebook. I’m having troubles with the plotting. When I use this example from the rpy2 docs for interactive work: Jupyter opens a new window with the plot. The window “title” reads: R Graphics: Device 2 (ACTIVE) (Not Responding). My Jupyter kernel is active. When I try to close the window with the plot,

Advertisement