Category "r"

What is the difference between paste/paste0 and str_c?

I don't seem to see a difference between paste/paste0 and str_c for combining a single vector into a single string, multiple strings into one string, or multipl

Merge many bib tex files into one

I have multiple single bibtex files which are like this: first file: @article{DBLP:journals/access/AlotaibiAASA20, author = {Bashayer Alotaibi and

pheatmap r- annotation legend not showing all values

when drawing annotation, not all of the clusters are shown (only 4 out of 8). How can I solve it and see all the colors with their names? Thanks! The data is a

makeCluster hangs on Windows - parallel package

I have tried using the parallel package to run a simple parallelization in R on my Windows 10 laptop, but when it gets to the makeCluster function it just hangs

ggplot2 png file without background

Since a few months, ggplot2 started to save png files with a transparent background. The code output in Rstudio and when saved as pdf looks great. It happens ma

Extract a column's name to create a new column name

I have the following simplified dataframe. df <- data.frame("Task1_AI1" = 1:5, "Task1_AI2" = 6:10, "Task2_AI1" = 1:5, "Task2_AI2"= 6:10) df And it looks lik

How to get individual coefficients and residuals in panel data using fixed effects

I have a panel data including income for individuals over years, and I am interested in the income trends of individuals, i.e individual coefficients for income

How can I apply fisher.test in R to a large matrix, and extract p-values to a new matrix?

I have a large matrix (12 rows, 53 columns) with counts of how many times genes in my clusters "A", "B", "C", etc. overlap with clusters created by someone else

How do I get capture.output functionality while capturing ANSI color codes from crayon?

What ways are there to capture output à la capture.output but which will retain the ANSI color encoding which comes out of crayon? > crayon::green("g

Accessing historical weather model data with rNOMADS

I am in interested in accessing historical NOAA model data, and have been using the rNOMADS package in R. Most tutorials on this package focus on current data

How to align the cells of an XLSX file using R's xlsx package?

When creating an XLSX file using R's xlsx package, by default, columns with strings are justified to the left by default, and columns with integers are justifie

How to plot two series in one single plot with different y-axis in plot.xts in R (current version of xts)

I'm trying to recreate this plot that I made with the old (pre 0.10-0) version of xts. Here's some example data: library(xts) # Run using xts_0.9-7 set.seed

Changing a value to N/A

I did a questionnaire research where some of the answers were "I don't know" and "I don't want to answer". Now I need to change those answering options to "N/A"

How can I search for the variation of a word without typing all variations ( in R)?

I need to check whether the variation of a word is in the text? How can I do that without typing everything out? For example, I need to search for the word 'bro

Difference between pull and select in dplyr?

It seems like dplyr::pull() and dplyr::select() do the same thing. Is there a difference besides that dplyr::pull() only selects 1 variable?

R Shiny: Slider anchors overlap at the end

On the UI, there are two sliders where the range of the second slider is dependent on the first slider's input. However, certain values on Slider 1 can lead to

Show a message instead of/within plot while data is loading in R Shiny

Is there a possibility in R Shiny to replace a plot with a "loading" message while additional data is loading? I am using a big dataset in my app and since not

R: Plotly: Treemap: Color only lowest labels

By plotting a treemap, I added a color code (colorway) in order to have all main parents having the same color scheme. I would now recolor only the minor childs

Remove borders in plotly treemap

I'm currently plotting some data using the plotly R library for the plot type treemap. When plotting the data, I get a big top border (and smaller ones on right

LDA Returning numbers instead of words from Term Document Matrix

I am trying to use the LDA function to evaluate a corpus of text in R. However, when I do so, it seems to use the row names of the observations rather than the