removing the central white circle?

I have a circular plot and I would like to find a way to remove the little white circle in the middle. Here is my code: ggplot(d5)+geom_tile(aes(x=x, y=y, fill=CNP))+ scale_y_continuous(expand=c(0,0),breaks=NULL,limits=c(0,3.6))+ scale_fill_...
more »

2017-06-16 17:06 (2) Answers

Is the regex \\L supported in R 3.5.0?

I am experiencing difficulty with the perl expression \\L\\1 in very particular circumstances on R-dev (2017-06-06 and 2017-06-16 r72796 builds): bib <- readLines("
more »

2017-06-16 16:06 (1) Answers

julia: outer product function

In R, the function outer structurally allows you to take the outer product of two vectors x and y while providing a number of options for the actual function applied to each combination. For example outer(x,y,'-') creates an "outer product" matrix of...
more »

2017-06-16 16:06 (1) Answers

replace sequence of identical values of length>2

I have a sensor that measures a variable and when there is no connection it returns always the last value seen instead of NA. So in my vector I would like to replace these identical values by an imptuted value (for example with na.approx). set.seed(...
more »

2017-06-15 20:06 (2) Answers

Create documentation for an R project

I would like to create documentation for my R code. The code is a part of an R project but not of a package. Is there a way I can display documentation for code not in a package using the built-in help viewer without creating a full package? ...
more »

2017-06-15 14:06 (1) Answers

Nested rolling sum in vector

I am struggling to produce an efficient code to compute the vector result r result from an input vector v using this function. r(i) = \sum_{j=i}^{i-N} [o(i)-o(j)] * exp(o(i)-o(j)) where i loops (from N to M) over the vector v. Size of v is M&...
more »

2017-06-15 14:06 (2) Answers

assign to$age)

I am looking at the code from here which has this at the beginning: ## generate data for medical example clinical.trial <- data.frame(patient = 1:100, age = rnorm(100, mean = 60, sd = 6), treatment = gl(2, 50, ...
more »

2017-06-14 14:06 (2) Answers

random sampling of columns based on column group

I have a simple problem which can be solved in a dirty way, but I'm looking for a clean way using data.table I have the following data.table with n columns belonging to m unequal groups. Here is an example of my data.table: dframe <-
more »

2017-06-14 13:06 (2) Answers

Vectorize loop with repeating indices

I have a vector of indices that contains repeating values: IN <- c(1, 1, 2, 2, 3, 4, 5) I would like to uses these indices to subtract two vectors: ST <- c(0, 0, 0, 0, 0, 0, 0) SB <- c(1, 1, 1, 1, 1, 1, 1) However, I would like t...
more »

2017-06-13 23:06 (2) Answers

Use lubridate to edit year within dplyr chain

I have a date frame similar to the following toy data: df <- structure(list(year = c(2014, 2014, 2014, 2014, 2014, 2015, 2015, 2015, 2015, 2015, 2016, 2016, 2016, 2016, 2016), date = structure(c(16229, 16236, 16243, 16250, 16257, 16600,...
more »

2017-06-13 21:06 (2) Answers

Combine integers into factor

I am unsuccesfully trying to combine six integers into a single factor variable with 6 values. So far this is the closest I've come: dt$o_typer <- factor(rep(NA, length(dt$opkvalificering)), levels = c("Sidemandsoplæring","Mento...
more »

2017-06-13 16:06 (0) Answers

Creating monthly data and expanding data

I have a data frame and I want to create an unbalanced panel based on the following dataset. profile<- c('lehman', 'john','oliver','stephen','picasso') start_date<- c(2008-01-01, 2008-02-02,2008-04-02,2008-09-02,2009-02-02) end_date <...
more »

2017-06-13 15:06 (4) Answers

R: count 15 minutes interval in time

I would like to count the amount of sessions started at each 15 minutes intervals for businessdays within a large dataset. My data looks like: df <- Start_datetime End_datetime Duration Volume 2016-04-01 06:20:55 2016-04-01 1...
more »

2017-06-13 12:06 (2) Answers

Group By Non-Missing Values Dplyr

I have a large dataframe (≈ 2M observations) that have many duplicates. I am going to delete those duplicates, but I need to keep the non-duplicate values as conditioned on another value that is not missing (NA). It can be any value imaginable, as ...
more »

2017-06-12 21:06 (1) Answers

Stored procedure parameters to R

I am trying to run a simple R sum in R-Services using the parameters handed to a stored procedure but I do not know how to do it, nor find a good example. This is what I have so far: IF OBJECT_ID ( 'TEST', 'P' ) IS NOT NULL DROP PROCEDURE TES...
more »

2017-06-12 17:06 (2) Answers

data.table mapping based on another data.table

I have two data(.xlsx), DT1 and DT2. I want to create a new column newcol in DT1 based on original column in DT1, mapping with columns in DT2. I know this is ambiguous so I explain more here: First, here is my two data. DT1 code type AH1 ...
more »

2017-06-12 05:06 (2) Answers