Coarsened Exact Matching with MatchIt returns error
When I try to implement Coarsened Exact Matching with the MatchIt package I get the following error: Error in `[[<-.data.frame`(`*tmp*`, gn[g], value = integer(0)) : replacement has 0 rows, data has...
View ArticleHow can I view Python objects created in a RMardown session in RStudio...
I have created a RMarkdown document with some objects in a Python code chunk. I'd like to be able to see these objects in the Environment window list in RStudio like the objects created in a R code...
View ArticleCombining ggmap with ggplot to create animation in r
I have some multi-line string data originally in shapefile that I have converted to a data.frame and shown below (data).I am trying to animate the lines over a static satellite map. I can separately...
View Articlein R how to count the number of times a value appears and meet multiple criteria
example:Colour vehicle city type red car London Petrol blue truck Paris Diesel red car NewYork Electric green van Barcelona Petrol black motorbike LosAngeles Petrol i.e. How to count number of times...
View ArticleCalculate elapsed time using datatime data in R
I'm working on a clinical dataset in which samples were taken from subjects after taking a dose of a medication. The datetime column for samples and doses were provided in the following format directly...
View ArticleERROR: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found on Centos...
I have a VM running with Centos Linux 7.7.1908. Now I ant to install devtools in R with:> install.packages("devtools") However, I get the following error: /lib64/libstdc++.so.6: version...
View ArticleExpanding date range to have row per instance, taking dose frequency into...
Hi I have a dataset that I need the dates to be expanded to have a row per date entry. The problem is more complex due to the schedule variable. There are 19 scheduling options (see attached image)....
View ArticleHow to implement recursive least squares in R?
I try to implement a RLS of x on y and here is my formula. unfortunately it does not work. X and Y are both time series.## input for recursive algorithm int <- rep(1, length(unempl.1)) x <-...
View ArticleHow to remove duplicate values from different rows per unique identifier?
I'm just starting to use R. I have a dataset with in the first column unique identifiers (1958 patients) and in columns 2-35 0's en 1's. For example:Patient A: 0 1 0 1 1 1 1 1 1 0 0 0 0 0 1 1 1 1 1 1 1...
View ArticleCalculating distance between coordinates in different dataframes
Suppose I have the following two dataframesdfA <- data.frame(x = rpois(10,2), y = rpois(10,2), z = rpois(10,2), q = rpois(10,2), t = rpois(10,2)) dfB <- data.frame(x = rpois(10,2), y =...
View ArticleGenerating summary table at bottom of dataframe
Please Help!!I have the following dataframe (named Final_APOL1). I need to generate a summary table like the second dataframe shown. Once generated is it possible to save this as a separate output csv...
View ArticleError in `$
I still haven't seen a concrete reason/answer to this question and my dilemma is slightly different. So I am trying to scrape data from a website using a function which row binds it to data already...
View ArticlePass named parameters to function that calls function that is not mutate
I am trying to do something very similar to here.Essentially, I need to pass a named list to a function, and give that named list to another function as its parameters. If we follow that link, they are...
View ArticleCumulatively Count Gaps in Sequential Numbers Results in Different Answers...
I asked a question a few days ago which you guys helped me solve and I am forever grateful! However, a new issue has presented itself and I am in need of your help once again!Here's a link to the...
View ArticleHow to use ggplot2 aes_string() with cut() in a for loop?
I'm trying to loop over some continuous variables to create ggplots. This works fine with aes_string, but I've now tried 1000s of variations to include cut in the call to generate bins of the variable....
View ArticleJoin of 2 dataframes [duplicate]
I have 2 dataframes and I want to join by name, but names are not written exactly the same:Df1: ID Name Age 1 Jose 13 2 M. Jose 12 3 Laura 8 4 Karol P 32 Df2: Name Surname José Hall María José Perez...
View ArticleBoxplot for 50 States over time
I have data on marriage rates for the 50 states over time. I am trying to make individual box plots for each state that would essentially summarize the data from 1990-2017, and have them all shown...
View ArticleConfirmative Factor Analysis in R
I am trying to follow instructions for a Confirmative Factor Analysis in R based on the pdf linked below.I got stuck at this line "cfa1.fit <- sem(cfa1.model, AD.R, AD.nobs)" (page 8) what is this...
View ArticleHow to get min and max value of each year row with colnames?
I'm struggling with making transparent summary of minimum and maximum prices in a given year. Here is my data frame:My vision was to make df with years (2006-2019), region where price was highest in...
View ArticleR remove two sides of border from strip.background function
I have the following data:structure(list(Biological.Group = structure(1:15, .Label = c("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O"), class = "factor"),...
View Article