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.
294
questions
0
votes
0
answers
3
views
PRROC package - foreground background data - R
I'm currently trying to draw ROC and precision-recall curves for my model and struggling a bit to understand how to use my data for the PRROC package of R.
I have a data frame containing different ...
0
votes
0
answers
5
views
mlr3: Extracting non-zero coefficient in lrn("surv.penalized")
I'm doing an ML study. I've used surv.penalized for lasso Penalized Cox Regression Learner, and get the non-zero coefficients. And it seems to work i.e. I do get some non-zero coefficients and the ...
0
votes
0
answers
6
views
What is the difference between calling summary() and train_summary() on a nestcv.train object in the nestedcv package in R?
I am running a series of elastic net models with nested cross validation on my training data, using the nestedcv package in R. I am trying to extract performance metrics to compare models with ...
0
votes
0
answers
16
views
R, summarize dataframe based on certain columns and put 1 column values into list [duplicate]
I have a large dataframe and I need to summarize based on 3 columns (source, source_detail, information) and values in column year will be put into list, like in Table 2.
My first code is
data %>% ...
0
votes
0
answers
17
views
Extracting matched data using overlap weights
I have generated overlap weights on R using weightit package, I generally fo regression using weights directly.
But I want to extract the matched data according to overlap weights for demographic ...
0
votes
0
answers
15
views
clmm function gives me an error "Error in x$code == 0L || action == "silent" : Error 'length = 2' in coercion to 'logical(1)'"
The following commands regarding the two types of models are executed in R
model_4_clmm <- clmm(v27_3 ~ SEX_2 + AGE + PARTLIV_2 + EDULEVEL_2 + WORK_2 + ISCO08_2 + PARTY_LR_2 + v4_3 + gdp_per_capita....
1
vote
1
answer
24
views
How to read CSV file with all variables in character using `vroom`?
How to read 'myfile.csv' with all variables in character using vroom ?
library(vroom)
'Below code can't work
input_file_2<- vroom('myfile.csv',colClasses = 'character')
1
vote
0
answers
23
views
Convert ordinal word string to ordinal number string? [duplicate]
Suppose I have a vector containing ordinal number words as strings in R:
ordinal_words<-c("FIRST COMPANY", "BAKERY FIFTH AVENUE", "WEST FORTIETH WAY")
I would like ...
0
votes
0
answers
35
views
How do I order a barchart, but not by ascending or descending order? [duplicate]
I am making a bar chart breaking down time spent at each activity level(high, medium, low, and total active times) for individuals recorded to be in different fitness levels. here is the code I am ...
0
votes
1
answer
17
views
NA values when using avg_predictions() from marginaleffects with a flexsurv model
I'm unsure why I do not get standard errors or confidence intervals when I fit parametric survival models and compute the predicted mean survival times using the avg_predictions(). I tried using ...
0
votes
0
answers
22
views
Embedding a GGPlotly into Gatsby page
THE INTRO: I am trying to embed ggplotly graphs into a Gatsby webpage I am learning to create. After arguing back and forth with ChatGPT for a couple hours, I'm seeking out your knowledge.
Here is at ...
0
votes
0
answers
17
views
How do I make sure my huxtable list maintains formatting when writing to docx in R/Quarto?
I am using huxtable in Quarto in R for a pretty complicated table, and I need to make sure I have running headers when I knit to word. The headers will have their own formatting that needs to be ...
0
votes
3
answers
63
views
Add values across dataframe columns
I have a dataframe where missingness in indicated by "Z" (there may also be some "z" and NA entries present in the data), and values are entered as characters ("0", "...
1
vote
1
answer
44
views
Confused about lists in R?
I come from a Python background but have to learn R for a job, and I am confused about lists.
I understand named lists can be (roughly) equivalent to Python dictionaries, and I can look up elements ...
0
votes
0
answers
9
views
structure of multinomial model in mgcv
I am trying to model the proportions of a variable with four categories through time and at four different sites. Most sites have all four categories of the variable, but some sites only have three ...