Converting a linear model analysis into a data visualization
I am not a coder, per se, but I am working on a project for my university. I have created a code that looks at 7 different types of academic involvement and analyzes how each category impacts a...
View ArticleHow to filter my data.table by condition and by group?
ProblemI work on a data.table where each row is a medical observation. The problem is there are some errors in my data, and I need to correct them before pursuit my analysis. For example, a male...
View Articleconfirmation on how to interpret MCMCglmm summary output
i want to know if post.mean is similar with estimate result that we see in glm model or different? thus pMCMC can be consider as p-value? i have not found people really explain on summary analysis...
View Articlesidebar-mini is overlayed by navbarPage in R shiny
I'm trying to add a navbarPage and use a slidebar-mini class, however when the sidebar is minimized the menu item text are under navbarpage items, which is not correct. any idea how one can bring the...
View Articleggplot: Force geom_line through origin (0,0)
I have several plots, for which I create linear geom_line models, however, I wish to force the geom_line through (0,0) and I can't seem to figure out how to do it.Im using ggplot on a dataframe, and...
View ArticleFinding the number that is reapeated consecutively the most in a vector
I have the following vector:essaie <- "23690,55050,127789,64253,130127,63093,63093,63093,108374,63093,63093" essaie_z <- c(as.numeric(unlist(strsplit(essaie, ",")))) I want to know which number...
View ArticleHow to convert a string in a function into an object?
I would like to convert a string that I pass in a function into an object (or column name).I know that this works:df <- data.frame(A = 1:10, B = 11:20) test.function <- function(x) { z <-...
View ArticleGet index of data.table column that matches a value
DT = data.table( id = 1:5, a = c(0,1,0,2,5), b = c(1,0,2,4,4), c = c(1,2,0,0,5)) # id a b c # 1: 1 0 1 1 # 2: 2 1 0 2 # 3: 3 0 2 0 # 4: 4 2 4 0 # 5: 5 5 4 5 I want to identify the first column from the...
View ArticleHow to read and rbind all .xlsx files in a folder efficiently using read_excel
I am new to R and need to create one dataframe from 80 .xlsx files that all share the same columns and are all in the same folder. I want to bind all these files efficiently in a manner that would work...
View ArticleExtract title from multiple lines
I have multiple files each one has a different title, I want to extract the title name from each file. Here is an example of one file [1] "<START""ID=\"CMP-001\"""NO=\"1\">" [4]...
View ArticleAdding a new column in R data frame based on time intervals. Day/Night
I want to add a new column to my dataframe based on a time interval. For the time 10:00 - 15:00 I want to add "day" in the new column, for 22:00-03:00 I want to add "night". Additionally I want to...
View Articleis there any code to find maximum independent values from random values in R
I am trying to generate maximum independent values from a vector of random numbers. I made a vector of random values by using 'sample' command.Which code can I use to generate x maximum independent...
View ArticleWhy is R returning an error that my variable must be an integer if the...
I am attempting to run a multi-level regression and poststratification in R, and I keep getting an error that my dependent variable "must be integer values of 0 / 1 or logical". I ran the...
View Articleremove "^" from a string in R
I have to remove all "^" from a string. I tried: gsub("^", "","p^qs") or str_remove(work,"p^qs"). However, it doesn't work. R seem not to "see" the ^ sign. Can you help me?
View ArticleHow do I calculate the annual mean of ~40 sites
I have a data frame with daily data from 40 sites and I need to calculate the annual mean of each siteDate Site1 Site2 Site3 Site4 Until site 40 01/01/2006 30 45 45 67 02/01/2006 40 89 89 56 03/01/2006...
View ArticleHow to replace pattern in string with current row number
I am trying to replace all instances of "." in a data frame with current row number. I am new to R so help and a bit of an explanation would be appreciated I tried this: nodots <-...
View Articlecan I change the forest plot generated by the dmetar package for a subgroup...
I have used the function subgroup.analysis.mixed.effects(x = meta1, subgroups = salt1$sample.type) from the dmetar package [][1]to do a subgroup analysis but the forest plot is practically unreadable...
View Articledrake: how to send arguments to target with combine?
Consider the following MWE. How do I get the m1 and m2 integers instead of expressions to be exposed to the func() arguments, instead of "object '1' not found"?func <- function(x, m1, m2) {...
View ArticleCombinations of variables that produce the smallest quantities in an R function
I'm interested in finding out which combination of variables (bingefollowupsreportage) in my model below produce smallest I2 statistic in rank order (smallest to largest). The I2 from each model is...
View ArticleRenaming table's column name with Greek letters in kable
I am creating presentation using R Markdown with PDF (Beamer) as output. I am using library kableExtra for some formatting. The following code gives me the expected resultlibrary(knitr) #...
View Article