Changing multiple columns name, pasting at the beginning/end of column name
I have a very easy question but I am a bit struggling with it as I am not good with string manipulation, I have a dataset that looks something like thisdf <- data.frame(id= c(1,1,1,2,2,2,3,3,3),...
View ArticleDivide in multiple columns an extra-long legend, pheatmap
I'm a bit locked with my data because I've got multiple samples and, when I draw a heatmap (with pheatmap package), legend is break because is bigger than screen (or PDF) margin... some like this:I'd...
View ArticleR Rhansontable - Color Specific Cells Conditionally On Other Table
This is my first post on SO, so please bear with me if my post is not fully aligned with the rules. Though I will do my best to give a clear description of my problem, the resources I already checked...
View ArticleFunction imported from dependency not found, requires library(dependency)
I am trying to create an R package that uses functions from another package (gamlss.tr). The function I need from the dependency is gamlss.dist::TF (gamlss.dist is loaded alongside gamlss.tr), but it...
View ArticleMultiple parents. No root in graph. Provide graph with one parentless node:...
I have data like this; two files:Edge_listnode1 node2 x1 x2 x1 x3 x8 x4 x4 x5 x6 x7 vertice_list:node weight x1 100 x2 50 x3 10 x4 20 x5 10 x6 20 x7 60 and I want to circlepack it, so I wrote this R...
View ArticleMethod(s) to speed up st_crop (sf package) on large datasets
I need to extract information across different shapefiles for ~ 4 mio grid-cells of 1 ha. Currently I am using st_crop on each layer in a for-loop over all cells, but this runs forever. I thought to...
View ArticleGather duplicating rows
Newbie again in need for help.I'm stuck with a transpose that is duplicating rows.My data is structured like this:id date client status agent_1 agent_2 agent_3...agent_10 flag_1 Flag_2 Flag_3...
View Articleusing ggplot to add error bars to Barplot
I am drawing a bar plot of means for a diversity index for a study i have done. I have calculated the index for each sample and added it to my table (which i orignally read in). I then calculated the...
View ArticlePull Data for each Dow Jones 30 company with R
I am currently facing a problem regarding the pulling of data in R. With the getSymbols() function I can already obtain data for each Dow Jones company.for example this gives me the data for apple from...
View ArticleR - Unexpected NaN in rcorr results
I'm working with a dataset of survey responses, where I need to derive a pearson correlation between each of the questions and the overall mean of all responses. So the survey responses are in a matrix...
View ArticleHow do I load an rds file into R
I'm very new to using R, so this might hopefully be a very easy question for some of you.I'm trying load a rds file which should contain some data.Professor says to use readRDS(), however R gives this...
View ArticleCount occurences of lists efficiently
I have a list containing a few millions of lists, these sublists have a few distinct possible values, maybe 10 to 100.I want to count the number of occurrences of these values.The code below works but...
View Articlelapply misses a variable name when used with lm and wanting to reduce iteration?
I have used melt to combine all my 32 columns into a single column, their values into a single column, and the independent variable into a single column.I then wanted to use lapply to generate a lm...
View ArticleHow to extract data from an interactive graph
I need to fetch datapoints from the website that provides aggregated polling number. The data was presented in an interactive graph. How should I fetch all the data points (date:number pair)for every...
View ArticleObject '.' not found while piping with dplyr
I am trying to conduct a survival curve using the survival package. The MWE code is as follows:df %>% filter(fac <= "Limit") %>% survfit(Surv(tte, !is.na(event)) ~ fac, data = .) %>%...
View ArticleMake a download button in shiny app that saves a data.frame in an excel file...
I have made an application on R shiny that I share with friends on the same network. I host the application on my remote computer and people connect to it using dedicated ports. I am trying to make a...
View Articleautomate ggplots while using variable labels as title and axis titles
I'm getting a bit mixed up with NSE and a plot function. I'm trying to automate plotting a few plots at once while labeling axis etc. using variable labels (not names). Lets say we have a large dataset...
View Articlecannot allocate vector of size 12.9 Gb - R [duplicate]
This question already has an answer here:R memory management / cannot allocate vector of size n Mb 8 answersHi I face a unique problem in R. Some times back I attempted Prudential Life Insurance Data...
View ArticleCreate new column based on if rows from 2 data frames match
This seems simple enough, but can't figure it out. I'd like to create a new column in df2 (impute_id) that identifies whether or not the value (measurement) was imputed or if it is the raw, observed...
View ArticleUsing fasterize in R to write a raster
I've been using the fasterize package lately to convert sf polygons to rasters:https://cran.rstudio.com/web/packages/fasterize/fasterize.pdfWhen I am dealing with large files, it would be better for me...
View Article