Calculating confusion matrix for fixed effect logit
I would like to ask how to calculate a confusion matrix for a fixed effect logit model (bife package)With the basic logit model (glm) there is no problem, but with fixed effect logit there is.For some...
View ArticleHow to access and edit Rprofile? [closed]
New to R. How does one access and edit Rprofile?
View Articleusing reactive values within r shiny modules
Hello RShiny community - I am still having a bit of a hard time wrapping my mind around how to pass reactive values between modules. Below, I have three modules along with the top level server and ui...
View ArticleConditionally modify ggplot theme based on presence of facets?
I'm working on a custom ggplot2 theme and was thinking it could be nifty to automatically modify elements of the theme depending on certain characteristics of the the plot object. For instance, is...
View ArticleHow to read csv files from different paths folders, with configuration files...
I have worked in R until now. And I am trying to replicate my work in python. Thus, in R I have been able to read different datasets from different path folders into a list of list. On this list, I...
View ArticleHow to calculate direct and indirect standardized rates by subgroups in R...
I am trying to calculate direct and indirect standardized rates by subgroups such as region and sex using "ageadjust.indirect" and "ageadjust.direct" in R. I appreciate sharing any examples or codes if...
View ArticleR Read (Excel, txt...) rows and columns with conditions
Supose I have this dataframe in a .dta, .txt or excel file:ID fondo 1 colf 2 colf 3 prot 4 colf 5 porv 6 prot 7 porv 8 colf 9 colf 10 colf I would like to read this file just the column 1 (ID) and the...
View Articleregression line on a ggplot is not shown
When I try to use ggplot, the plot just shows data in dots, but there is no line at all in the plot. Also, There is no error in R. Data has two coloumns, namely Month and Rainfall. I made dataset as...
View ArticleR unbalanced data frame data cleaning
My data frame looks like this:c1 c2 c3 c4 T1 NA NA NA NA a NA NA NA NA B NA NA NA NA b T2 NA NA NA NA NA C NA NA NA NA c I want to have it likec1 c2 c3 c4 T1 a B b T2 NA C c I tried with something like...
View ArticleFixed effects with ggeffect() in R
I'm wondering if anyone has any experience using ggeffect() with lots of fixed effects. Although my independent variable is strongly related to my dependent variable, I get these massive confidence...
View ArticleCreate formula inside loop over column names
I would like to loop through columns in a data set and use the name of the column to aggregate the data set. However, I am getting an error when I try to feed through the column name into the aggregate...
View ArticleEnumeration of a variable using R [duplicate]
I want to add a numeric column "ID" each each unique 'cat' value.. In other teams, enumerate "cat" cat val 1 aaa 0.05638315 2 aaa 0.25767250 3 aaa 0.30776611 4 aaa 0.46854928 5 aaa 0.55232243 6 bbb...
View Articler data.table lapply or for loop to create variables or generate columns
I want to create several variables using a formula with R data.table. I have a list of variables, and for each one I want to perform a calculation and create a new variable, pasting the same string...
View ArticleWhat exactly is happening in these models when an intercept is removed from a...
I have the following data:set.seed(3) library(data.table) library(lme4) a <- rep(1:5, times = 20) b <- rep(c(1,1,1,1,1,2,2,2,2,2), times = 50) ppt <- rep(101:110, each = 10) item <-...
View ArticleHow to get the similarity index between 2 tables in R/Python? [closed]
I have 2 tables for scholarship and student details. The columns are the same. How do I get the top 3 students most eligible for a scholarship? The 3rd table is my desired output. Thanks in advance.
View ArticleIs there a way of plotting the facet strip names (switched y) outside the...
I made a facetted plot (using ggplot2::facet_grid) where I switched the y-axis, so the y-strip text is plotted on the left side of the plot and already used theme(strip.placement = "outside") to place...
View Articlest_simplify dTolerence with decimal degree
I'm trying to reduce the size of sf object by applying st_simplify. CRS is 4267 and try to play around with the right level of dTolerance. I understand that the unit of dTolerance has to be that of the...
View ArticleHow do I color ggplot lines and adjust the legend? [duplicate]
I am trying to color my lines in ggplot to be red and blue, but they seem to have reversed colors.ggplot(data.frame(x)) + geom_line(aes(x=x, y=y, color='blue')) + geom_line(aes(x=x, y=y2, color='red'))...
View ArticleHow can I use NSE and filter an expression using ... (ellipsis)?
How can I utilize the magic dots (...) / ellipsis in order to filter based off an arbitrary column?df = tibble::tibble(col1 = c('a', 'b', 'c'), col2 = c(1,3,4)) my_func = function(x, ...){ df %>%...
View ArticleAPI key in HTTP header
I want to get some data from Polish Central Statistical Office using API query. Due to limitation I can't send more than 100 queries per 15 min. However, if I provide specific API key I would be able...
View Article