Skip to main content

Questions tagged [r]

R is a free, open-source programming language & software environment for statistical computing, bioinformatics, visualization & general computing. Please use minimal reproducible examples others can run using copy & paste. Show desired output entirely. Use dput() for data & specify all non-base packages with library(). Don't embed pictures for data or code, use indented code blocks instead. For statistics questions, use https://stats.stackexchange.com.

r
0 votes
0 answers
6 views

How do I correctly specify nesting in the sommer R package?

I accustomed to lme4 where it would be simply: (1|genotype/root_ID) but it's unclear to me looking through the documentation the appropriate way to do this in sommer. mod1 <- mmer(Y ~ 1, ...
bigoof99's user avatar
0 votes
0 answers
14 views

I have set levels in R, how do I take new data and assign it to multiple levels and then create a count for that level?

I am working paleo data in which I have pulled information from the database on a genus level and have found the unique labels of genera within a certain dataset and their respective age ranges. Each ...
Mary Ann Moody's user avatar
0 votes
0 answers
13 views

GMM estimation in R and STATA

I am trying to perform GMM estimation but in R. In my context, I am making several covariance restrictions. To give a simplified example: $Var(y)=a$ and $Cov(y, Ly))=b$. Now the problem is that for ...
Grigory Aleksin's user avatar
2 votes
0 answers
27 views

How to code chi-squared integrand using elementary R functions

I am attempting to write probability density function for 2x2 contingency table with given margins, using chi-squared statistics. I am aware there are easy ways to do this with native R functions, but ...
yuppe's user avatar
  • 43
2 votes
3 answers
22 views

How to access row and column names (year and month) from a (monthly) time series, when rownames and colnames fail?

In monthly time series (frequency = 12), R prints out the years and months automatically, arranging them to look like row names and column names. But they are not accessible through rownames or ...
dolphingang's user avatar
-2 votes
1 answer
35 views

Most efficient way to reproducibly and programmatically change sporadic cell values in a R dataframe? [closed]

I'm a novice R programmer/analyst and analyzing a large dataset of 220 columns by 230 rows. I've found that there are sporadic values that are incorrect in the source dataset that I'd like to change (...
SugarRay's user avatar
2 votes
4 answers
35 views

Convert a dataframe of nearest neighbors to onehot coding

Let's say we took the mtcars data and ran a PCA. Then, we want to know which brands of cars are most similar in PC space, i.e. the nearest neighbors. So someone ran a nearest neighbors analysis, and ...
jnat's user avatar
  • 65
0 votes
0 answers
28 views

How can I use a separate column value to choose how to fill in values using values_fn in pivot_wider? [duplicate]

I have a dataframe descriptions names cutoffs vals 1 a A 90 1 2 a A 91 2 3 a B 90 3 4 a C 90 4 that I ...
mintak's user avatar
  • 1
0 votes
1 answer
30 views

Mean scores for survey responses in gtsummary

I am attempting to produce a table of weighted mean survey scores by categorical variables in gtsummary using the tbl_svysummary function. How do I do this using survey weights, using the ...
N.F.'s user avatar
  • 1
1 vote
2 answers
32 views

parallel/automatic way of unnesting list columns that contains data frames (list columns might be empty)

Please consider the following data frame: df <- structure(list(oID = c(37751L, 30978L, 33498L), peId = c(12L, 13L, 14L), last_Name = c("ABC", &...
deschen's user avatar
  • 10.4k
0 votes
1 answer
25 views

How to stop the run, and throw customized and original error messages using tryCatch in R?

I am trying to use tryCatch funciton to catch errors and stop runs with personalized and original error messages printed. The expression is to evaluate a+"T", which will surely produce an ...
Phoebe's user avatar
  • 93
0 votes
0 answers
29 views

Error in eval(predvars, data, env): object 's_id' not found

I am trying to fit multilevel models using tidymodels. When I fit individual models, I do not have issues but when I combine them in workflow set, I get these errors. I have seen posts with similar ...
John Doe's user avatar
  • 666
0 votes
0 answers
22 views

error while using "compile" model for keras models

I am new in applying the neural network models, I am using linux Ubuntu , and the versions that are installed are: tf_config() TensorFlow v2.16.1 (~/miniconda3/lib/python3.12/site-packages/tensorflow) ...
Violet Ishak's user avatar
0 votes
0 answers
32 views

ggplot2 error: "`unit()`: ! 'x' and 'units' must have length > 0" (::grid package in R)?

I'm trying to create a custom ggplot2 geom called geom_geoheat, but I'm running into an error when converting the geom to a grob. I am using ggprotos of GeomTile and GeomRect (where tile inherits most ...
nostrum's user avatar
-2 votes
0 answers
21 views

Re: R Studio server issues & package installation [closed]

I am unable to download some packages (e.g.: tidyverse & many more packages that are available otherwise on the desktop version in R) in my R studio server account. Is this a common problem faced ...
Nirav's user avatar
  • 1

15 30 50 per page
1
2 3 4 5
33859