Horizontal Scroll Bar in data frame - Rmarkdown

Hello everyone,

I am currently writing an R Markdown research report with HTML output and I have one question in particular.

My code:

---
title: "Project data HedgeHog"
output:
   html_document :
     df_print: paged 
     toc : true 
     toc_float : true
     toc_depth: 6  
     
---


``{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)

# Load data

dataHedg<-read.csv("C:/Users/thiba/Documents/Herisson test.csv")


``



``{r Packages, message=FALSE, warning=FALSE, include=FALSE, paged.print=FALSE}
library(ggplot2)              # visualisation ggplot
library(mapview)              # donnees cartographiques
library(ggpubr)               # publication de plusieurs plots en un 
library(dplyr)                # 
library(DT)                   # permet d'afficher des tableaux jolis (https://rstudio.github.io/DT/)
library(shiny)                # application interactive shiny
library(shinythemes)          # theme shiny 
library(leaflet)              # package cartographie
library(leaflet.providers)    # couche jolie a appliquer sur une carte leaflet
library(maps)                 # package cartographie 
library(RColorBrewer)         # creation palette de couleurs
library(leaflet.extras)       # leaflet cartographie
library(rworldxtra)           # donnees cartographique mondiale
library(raster)               # transformer matrice en raster
library(sf)                   # op?rations de g?om?trie sph?rique sur des coordonn?es ellipso?dales (long/lat)
library(tidyverse)

library(lorem)
``


## R Markdown

`r lorem::ipsum(paragraphs = 6)`


``{r Tableau Donnee, echo=TRUE, message=FALSE, warning=FALSE, out.width="100%"}

datatable(dataHedg)
``

I am using the DT package to produce a nice data frame of my data to present. However, a problem has arisen, the data frame is obviously too big for the size of the web page and spills over to the right.

Picture of what I have (A) VS what I would like to have (B):

I would like to know how I can limit the display of the table with a horizontal bar that simply allows a slide of the user.

I hope you will be able to help me.

Wish you a great day,

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.