Quantcast
Channel: Active questions tagged r - Stack Overflow
Browsing all 208162 articles
Browse latest View live

Is there a way to write text with emoji to Excel or Google Sheets?

Is there a way to write text with emoji to Excel or Google Sheets? I have a dataframe like this, and I've tried write.csv() with the fileEncoding parameter set, but no luck.df <- data.frame(number =...

View Article


create a matrix of lists in r

I have a table with 1 column as a factor with 5 levels. I am extracting the unique factors set into a new data table TNAME and then want to put TNAME into a list and add a reference value 1-5 so...

View Article


Image may be NSFW.
Clik here to view.

ggplot geom_contour as background colour

I am trying to plot the following data using ggplotThe data I have looks like:# A tibble: 200 x 4 svm randomForest Petal.Length Sepal.Width <fct> <fct> <dbl> <dbl> 1 0 0 3 2 2 0...

View Article

How to convert incorrectly-written dates (e.g. "1990-4-31") from 'character'...

I have a large data of scraped reports. Date information is in the text of the reports, and I have converted them to a character vector of the following format: date_vec <- c("2001-4-31",...

View Article

List Issue in Neural Net Test

install.packages("neuralnet") install.packages("dplyr") require(neuralnet) NBA_Data <- read.csv("C:\\Users\\Andrew\\Downloads\\NBA_Test.csv",TRUE) df <- data.frame(NBA_Data) training <-...

View Article


Merge data.tables while keeping original order in R

I would like to merge two data tables while keeping the original order of the data tables. I would also like to have a final column to say whether the two ids match each other. All of this while...

View Article

Image may be NSFW.
Clik here to view.

Multipanel plots with spanning figure legend in R with ggtext and gridtext in R

I am close to achieving this multipanel plot with a spanning textgrob figure legend below. But I continue to get an unexpected amount of space between the figures and the figure legend. Attempt in the...

View Article

How to highlight a line connecting a group in ggplot R?

I'm very new to R and I'm looking to highlight certain groups in my plot using gghighlight. For example, I want to highlight in red only groups 16 and 32 while leaving the rest of the lines in gray. My...

View Article


Data frame calculated column not calculating correctly

deltas = 10^c(-1:-12) df = data.frame(deltas) df <- mutate(df, Num_H11 = -( Gamma_log_like(optout_gamma$par - c(df$deltas, 0), X) - 2 * Gamma_log_like(optout_gamma$par, X) +...

View Article


How to add code folding to output chunks in rmarkdown html documents

I really appreciate the "code_folding" feature in RMarkdown. However, what I really need is to have the code show all the time and toggle the display on the output.--- title: "test file" author:...

View Article

Is there an easier way to write a function like this to calculate the...

While writing a little function to calculate the 99% confidence interval of some sample, I get a different answer than the R t.test formula. Here's my function:confinterval <- function(x,alpha){...

View Article

Image may be NSFW.
Clik here to view.

Highcharts X axis not showing properly

I want to show the distribution of windturbine's events using Highcharts.My X-axis won't display its values entirely well. I found that when I have only one event defined for one year, it mucks up the...

View Article

Image may be NSFW.
Clik here to view.

Finding increases from 'baseline' in the graph, not sure how to do

I want to write an algorithm that spits out the points highlighted by arrows. I've tried using a second derivative but it returns a similar plot to the one above and not sure how to use it. Example...

View Article


R: Shiny.OnInputChange live click

Say I have an object in the browser DOM with class=“row” and id=“row22”.I want to use Shiny.onInputChange() to detect a click on that object and send the id to a Shiny input$ variable. I’ve worn out...

View Article

Filtering Table in R [duplicate]

I want to filter my table like thatinput table:x1 x2 x3 A B x A B y A B z C D u C D v output table:x1 x2 x3 A B x,y,z C D u,v

View Article


X11 error message unter shiny server but normal user works

I'm getting an error when I run my shiny app. It says Warning in pngfun(filename = filename, width = width, height = height, res = res, : unable to open connection to X11 display '' Warning: Error in...

View Article

create a string from first 2 elements in dataframe and add to new column in R

I think this is fairly simple, say I have a data frame> vadata va1 va2 1 a c 2 b d I want to create a new column va3 = "a-c" and "b-d" for all rows in vadata and append to vadata?vadata is of type...

View Article


Why am I getting the wrong output although the code is correct?

I'm scraping this website and sure that the code is correct for getting titles. But the output is not what I want.library(rvest) url <-...

View Article

How can I plotly a ggplot treemap?

I am looking to get this gradient colors on the map: ramp <- colorRamp(c("royalblue4", "white")) ramp.list <- rgb( ramp(seq(0, 1, length = 15)), max = 255) But also, and more important, I am...

View Article

Image may be NSFW.
Clik here to view.

How to switch right-hand strip to left side in facet_grid

I have the following code:library(tidyverse) p <- ggplot(mpg, aes(displ, cty)) + geom_point() p + facet_grid(drv ~ .) Which produces this plot:As describe above how can I switch right-hand strip to...

View Article
Browsing all 208162 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>