GithubHelp home page GithubHelp logo

mwip / beautifyr Goto Github PK

View Code? Open in Web Editor NEW
112.0 112.0 6.0 438 KB

RStudio addin for formatting Rmarkdown tables

License: GNU General Public License v3.0

R 100.00%
alignment comments markdown markdown-table r rmarkdown rstudio-addin

beautifyr's People

Contributors

mwip avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

beautifyr's Issues

Beautify comment: Lists

I am not sure whether it is worthwhile for you to make this work, but for completeness, I should create this issue:

When Compiling Reports in R, you can basically make use of all Markdown features when writing text after #'. One of the more common ones that may also need to be beautified is lists:

Here is the example:

#' Unordered List:
#' 
#' * Item 1
#' * Item 2
#'    + Item 2a
#'    + Item 2b
#'
#' Ordered List:
#' 
#' 1. Item 1
#' 2. Item 2
#' 3. Item 3
#'    + Item 3a
#'    + Item 3b
#' 
#' An example that actually needs line breaks:
#' 
#' 1. Super Mario is a 2D- and 3D-platform game series created by `Nintendo` based on and starring the fictional plumber Mario. 
#' 2. Alternatively called the `Super Mario Bros.` series or simply the Mario series, it is the central series of the greater Mario franchise. 
#' 3. At least one Super Mario game has been released for every major Nintendo video game console. There are over twenty games in the series.
#'    + Super Mario World was released for the Super Nintendo Entertainment System and consists of nine worlds displayed via a world map.
#'    + It is a direct successor to the Super Mario Bros. games, bearing the subtitle Super Mario Bros. 4 in Japan.

image

and this is what beautifyR currently does:

#' Unordered List: * Item 1 * Item 2 + Item 2a + Item 2b Ordered List: 1. Item
#' 1 2. Item 2 3. Item 3 + Item 3a + Item 3b An example that actually needs
#' line breaks: 1. Super Mario is a 2D- and 3D-platform game series created by
#' `Nintendo` based on and starring the fictional plumber Mario. 2.
#' Alternatively called the `Super Mario Bros.` series or simply the Mario
#' series, it is the central series of the greater Mario franchise. 3. At
#' least one Super Mario game has been released for every major Nintendo video
#' game console. There are over twenty games in the series. + Super Mario
#' World was released for the Super Nintendo Entertainment System and consists
#' of nine worlds displayed via a world map. + It is a direct successor to the
#' Super Mario Bros. games, bearing the subtitle Super Mario Bros. 4 in Japan.

image

while this is what it should do:

#' Unordered List:
#' 
#' * Item 1
#' * Item 2
#'    + Item 2a
#'    + Item 2b
#'
#' Ordered List:
#' 
#' 1. Item 1
#' 2. Item 2
#' 3. Item 3
#'    + Item 3a
#'    + Item 3b
#' 
#' An example that actually needs line breaks:
#' 
#' 1. Super Mario is a 2D- and 3D-platform game series created 
#'    by `Nintendo` based on and starring the fictional plumber 
#'    Mario. 
#' 2. Alternatively called the `Super Mario Bros.` series or simply 
#'    the Mario series, it is the central series of the greater 
#'    Mario franchise. 
#' 3. At least one Super Mario game has been released for every 
#'    major Nintendo video game console. There are over twenty 
#'    games in the series.
#'    + Super Mario World was released for the Super Nintendo 
#'      Entertainment System and consists of nine worlds displayed 
#'      via a world map.
#'    + It is a direct successor to the Super Mario Bros. games, 
#'      bearing the subtitle Super Mario Bros. 4 in Japan.

But again - feel free to close this issue if this goes beyond what you have in mind for what {beautifyR} is supposed to do.

beautify_table not working

After installing the package, it is not working for me, i.e. I get an "R code execution error"

beautify_table

The error message in the console:

Error in if (!after) c(values, x) else if (after >= lengx) c(x, values) else c(x[1L:after],  : 
  missing value where TRUE/FALSE needed

This is on RStudio Desktop 1.2.1059. Session Info:

sessioninfo::session_info("beautifyR")
#> - Session info ----------------------------------------------------------
#>  setting  value                       
#>  version  R version 3.5.1 (2018-07-02)
#>  os       Windows 10 x64              
#>  system   x86_64, mingw32             
#>  ui       RTerm                       
#>  language en                          
#>  collate  German_Germany.1252         
#>  ctype    German_Germany.1252         
#>  tz       Europe/Berlin               
#>  date     2018-11-09                  
#> 
#> - Packages --------------------------------------------------------------
#>  package    * version date       lib source                         
#>  beautifyR    0.2.0   2018-11-09 [1] Github (mwip/beautifyR@f90a04b)
#>  glue         1.3.0   2018-07-17 [1] CRAN (R 3.5.1)                 
#>  magrittr     1.5     2014-11-22 [1] CRAN (R 3.5.1)                 
#>  rstudioapi   0.8     2018-10-02 [1] CRAN (R 3.5.1)                 
#>  stringi      1.2.4   2018-07-20 [1] CRAN (R 3.5.1)                 
#>  stringr      1.3.1   2018-05-10 [1] CRAN (R 3.5.1)                 
#> 
#> [1] C:/Users/daniel/Documents/.R/win-library
#> [2] C:/Program Files/R/R-3.5.1/library

Beautify table ignores indented comments

Indented comments such as

for (i in 1:42) {
  # Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. 
  sqrt(i)
}

are currently ignored.

`node stack overflow` error when emojis present in the table

Hi, thanks for the amazing addin!

While trying to beautify tables with emojis, e.g., one like the following-

Analysis | Hypothesis testing | Estimation
------------------ | ---------- | ---------
t-test | ✅ | ✅
one-way ANOVA | ✅ |✅
correlation | ✅ | ✅

I always get the following error:

Screenshot 2022-10-17 at 16 14 08

I am assuming that the emojis are creating problems for the addin?

Beautify Comment: Keep `-` and don't break inline code

Hi, thanks for the great addin - I am using Beautify Comment on a regular basis.
However, I find myself manually

  1. re-inserting - hyphens/dashes, because they are always removed
  2. removing linebreaks to make inline code r mean(c(1,2)) appear on a single line

Do you think there is a better way to handle these?

error message after trying to use beautifyR add-in

After installing RStudio and then the package in my new laptop when I try to use the add-in two types of error message appear in the console. By the way, I have installed a weird RStudio version: RStudio v1.2.830-1 Preview (I wanted to use one of the new features).

The first error message is the following:

Error in cells[[2]] : subscript out of bounds
In addition: Warning message:
In .Primitive("max")() : no non-missing arguments to max; returning -Inf

On my second attempt to use the add-in I get this error:

Warning in beautifyR(con_text) :
  Fomatting indicator row 2 (e.g. :----) contains invalid values or is not available
  left alignment assumed for all columns
Error in if (!after) c(values, x) else if (after >= lengx) c(x, values) else c(x[1L:after],  : 
  missing value where TRUE/FALSE needed

Do you think the issue is the RStudio version?

UPDATE: I've just tried using the RStudio Version 1.1.456 and I keep getting the same error messages...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.