Skip to content

Instantly share code, notes, and snippets.

View davidgohel's full-sized avatar
🦒
busy

David Gohel davidgohel

🦒
busy
View GitHub Profile
# install.packages("flextable")
library(ggplot2)
library(flextable)
library(officer)
library(patchwork)
library(magrittr)
stopifnot(packageVersion("flextable") <= numeric_version("0.8") )
@davidgohel
davidgohel / gist:eaebc7d00f63166976fd2b29f8cb0abf
Created September 9, 2022 12:13
demo of the new grid graphic output of flextable
#remotes::install_github("davidgohel/officer")
#remotes::install_github("davidgohel/flextable")
library(ggplot2)
library(flextable)
library(patchwork)
library(tidyverse)
main <- ggplot(data = diamonds, aes(x= price, y = x, color = color)) +
geom_point() +
theme_minimal()
@davidgohel
davidgohel / bench.R
Last active January 31, 2019 11:47
bench pour compter le nombre de NA en lignes
library(purrr)
library(charlatan)
library(microbenchmark)
create_fake_data <- function(n){
data <- ch_generate('job', 'color_name', 'phone_number', n = n)
data$color_name[sample.int(nrow(data), n/10 )] <- NA_character_
data$x <- rnorm(n)

Keybase proof

I hereby claim:

  • I am davidgohel on github.
  • I am davidgohel (https://keybase.io/davidgohel) on keybase.
  • I have a public key ASAmdgDIl3yKhvBHX5VqEMaAZq21ZT6E_qS1IsF_wimZcAo

To claim this, I am signing this object:

library(officer)
doc <- read_docx()
print(doc, target = "test.docx")
library(ReporteRs)
test <-
structure(list(Grade1 = c(20, 30, 20, 10),
Grade2 = c(10, 5, 10, 20),
Grade3 = c(5, 2, 4, 5),
Grade4 = c(0, 0, 3, 0),
Grade5 = c(0, 0, 0, 1)),
.Names = c("1","20","300","4000","50000"),
row.names = c("A","B","C","D"),
library(ReporteRs)
require( ggplot2 )
myplot <- qplot(Sepal.Length, Petal.Length,
data = iris, color = Species,
size = Petal.Width, alpha = I(0.7) )
xx <- pptx()
xx <- addSlide(xx, "Title and Content")
# get slide dimensions
slide_dims <- dim(xx)$slide.dim
library(ggiraph)
library(maps)
shinyServer(function(input, output, session) {
selected_car <- reactive({
if( is.null(input$plot_selected)){
character(0)
} else input$plot_selected
library(boot)
library(dplyr)
library(magrittr)
library(purrr)
library(ReporteRs)
# get some data -----
data(melanoma)
melanoma$Status = c( 'Melanoma', 'Alive' , 'Non-melanoma' )[melanoma$status]