r

Subsetting netcdf files with multiple variables by time range

Subsetting netcdf files with multiple variables by time range Question: I have hundreds of netcdf files, each with 18 variables. The data in each file dates from 1850 to 2100 and roughly 20GB each. CDO and NCO could not read the data due to the rotation because the extent (-1.40625, 358.5938, 89.25846, 89.25846) is unusual …

Total answers: 1

Creating circular boxplot for circadian data

Creating circular boxplot for circadian data Question: I am trying to find an R code to make a plot that looks like this (below). I know this figure was created in python because I emailed the person who created this code but after 2 months of back and forth with him promising to get me …

Total answers: 1

Create an R or Python function to generate sets based on the value of C

Create an R or Python function to generate sets based on the value of C Question: I need help creating an R or Python function that generates sets based on the value of C. Here’s an example to illustrate what I’m looking for: For C = 2, I have 2^2 sets, including the sets: Cl_atypique, …

Total answers: 3

Remove palindromic rows based on two columns

Remove palindromic rows based on two columns Question: I have the following data frame: Data_Frame <- data.frame ( A = c("a", "c", "b", "e", "g", "d", "f", "h"), B = c("b", "d", "a", "f", "h", "c", "e", "g"), value = c("0.3", "0.2", "0.1", "0.1", "0.5", "0.7", "0.8", "0.1") effect = c("123", "345", "123", "444", "123", …

Total answers: 1

pyreadr not working (how to import RData file to python)

pyreadr not working (how to import RData file to python) Question: I always get an empty dictionary when I import any RData file into Python using pyreadr. Here is my Python code: import pyreadr result = pyreadr.read_r(‘data.RData’) print(result.keys()) which returns odict_keys([]) I have pyreadr installed and am running Python version 3.7.11 on Mac. In the …

Total answers: 2

How can I code Vuong's statistical test in Python?

How can I code Vuong's statistical test in Python? Question: I need to implement Vuong’s test for non-nested models. Specifically, I have logistic-regression models that I would like to compare. I have found implementations in R and STATA online, but unfortunately I work in Python and am not familiar with those frameworks/languages. Also unfortunate is …

Total answers: 1

Forming a symmetric matrix counting instances of being in same cluster

Forming a symmetric matrix counting instances of being in same cluster Question: I have a database that comprises cities divided into clusters for each year. In other words, I applied a community detection algorithm for different databases containing cities in different years base on modularity. The final database (a mock example) looks like this: v1 …

Total answers: 2

Compute share of resources used by node i w.r.t. neighbors on a large network

Compute share of resources used by node i w.r.t. neighbors on a large network Question: Purpose The main purpose is to be able to compute the share of resources used by node i in relation to its neighbors: r_i / sum_j^i{r_j} where r_i are node i resources and sum_j^i{r_j} is the sum of i’s neighbors’ …

Total answers: 1