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

Adding expressions to ggplot axis tick marks

I would like to add something like 10^ to each tick mark label on my X and/or Y axis tick labels. I know this can be done in facet_grid by using a labeller like label_bquote but I am curious if there...

View Article


Attempting to diff two times results in "NAs introduced by coercion" error

I'd appreciate any help, as I'm not getting the diff time I need. Instead I get this error:In eval_tidy(xs[[i]], unique_output) : NAs introduced by coercionHere's my code:db <- dados%>%...

View Article


r calculate means of numeric variable for predetermined time step [closed]

I have a data set of observations that have taken place at specific date/time point; these are usually about a minute apart but can be more or less. And there are some extended periods for missing...

View Article

Image may be NSFW.
Clik here to view.

Do not want legend labels in alphabetical order (GGPLOT2)

I have looked at many answers on here and cannot solve my issue-so thought I'd ask here. I think I need to call in the factor? I can't get that to work. I'm importing my data from an excel csv file.I...

View Article

Error: graphical parameter "type" is obsolete. when adding abline

Here's an example:data = rnorm(100) plot(data) abline(h = 0,type = "1", lty = 3) then an error occurs:Warning message: In int_abline(a = a, b = b, h = h, v = v, untf = untf, ...) : graphical parameter...

View Article


3D Plots with Rendered Images in R [closed]

I am trying to find a way to make 3 dimensional plot in R that has the ability to render a local image on the face a plane. I have tried to do this in plotly, plot3D, and rgl with no success. I have...

View Article

Rayrender only renders black image

No matter which code I use from the documentation of the rayrender package, it only renders a black image?!?Example:library(rayrender) #Generate the ground and add some objects scene =...

View Article

Filtering in dplyr based on two non-numeric values

I am filtering a dataset and this chunk works fine: dwell <- rail %>% filter_(Measure == "Average Terminal Dwell Time (Excluding Cars on Run Through Trains) (Hours)", Variable == "System") %>%...

View Article


Data organization precipitation

I have a precipitation database, where it is structured as follows.Season; YEAR; MONTH; DAY 01; DAY 02; DAY 03 ..... DAY 31 data hereAt first I wanted to calculate the accumulated in each month (I did...

View Article


R - Merging csv files recursively for large datasets while appending file...

I'm working with relatively large data sets, that until now have been process-able through my code. Once I read in all of my files, I gather them from wide to long, and then merge two tables and create...

View Article

In R, how can I randomly choose two out three names 500 times, with balanced...

I know I can use complete_ra from the randomizr package to randomly and equally allocate to one of three "arms" (in this case "arms" are just names of people)library(randomizr) set.seed(100) names...

View Article

Why is the computation is faster with a loop?

Update:As pointed out by @Dave2e, moving the start_time statement (in code 2) out of the for loop will make the running time comparable to code 1. Namely:start_time <- Sys.time() for (j in 1:1) { n...

View Article

R data.table : creating a count table of values in multiple columns by using .N

Here is my test DT;a<-data.table(cluster=sample(LETTERS[1:3], size = 10, replace = T), a=sample(x=1:2, size=10, replace = T), b=sample(x=1:2, size=10, replace = T), c=sample(x=1:2, size=10, replace...

View Article


Neyman power of the test in R, problem with function

I would like to write function in R for power of the test. neyman <- function(n,k){ for (a in 1:10^4){ x = runif(n,0,1) b=() b[a] <- neyman.unif.test(x, nrepl=10000, k)$statistic} sum(b >...

View Article

How to Convert a geo raster brick to a tibble for ggplot and gganimate?

I have a raster brick derived from geo-tiffs that has 11 layers. Each raster has ~3,000,000 rows. When I convert the raster to a tibble for use with ggplot and gganimate tibble all the tibblevalues are...

View Article


Solve for x in a large equation in R (many instances of a single unknown term...

I am trying to solve for X in an R script given an extremely long equation and many instances of X (15 instances to be exact)The equation I have is built like the following:This is the equation I am...

View Article

How to add mean (or median) line to geom_bar?

I need to add mean or median to a bar plot, don't know why it doesn't work: data_GP %>% group_by(Customer, Year, Customer_category) %>% dplyr::summarise(GP_value = mean(GP), REV_value =...

View Article


Simplify a list to a data frame & create new columns from numeric vectors in...

I have a fairly simple list:ls <- list(560L, 4163L, 3761L, 287:290, 4467L, 3564L, 200:202) where each row corresponds to a row in a data frame:df <- enframe(c("tom", "dick", "harry", "sally",...

View Article

R Plotly density plot argument 'x' must be numeric

I am fairly new to R so excuse my baby steps in plotly. I am trying to compute density curves for total time spent# Compute density curves d.Bardoc <- AeDec %>% filter(Bardoc == 1) %>%...

View Article

Image may be NSFW.
Clik here to view.

How could you show the same vector by different columns using DT::datatable?...

Using this coding: fruits <- c("Pineapple","Strawberry","Melon","Banana","Passion...

View Article
Browsing all 206180 articles
Browse latest View live


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