Code Monkey home page Code Monkey logo

littleboxes's Introduction

littleboxes

RStudio Addin - creates boxed in titles in an Rscript

Installation

# install.packages("devtools")
devtools::install_github("ThinkR-open/littleboxes")

# If you just want boxes without any tricks using Rstudio outline 
devtools::install_github("ThinkRstat/littleboxes",ref="simpleboxe")

Usage

alt tag

# write a sentence, place your cursor on the line and go to Addins > Little Boxes

# Part One

1+1
plot(iris)

# Part Two
lm(1~1)

will be turned into:

##%######################################################%##
#                                                          #
####                      Part One                      ####
#                                                          #
##%######################################################%##


1+1
plot(iris)

##%######################################################%##
#                                                          #
####                      Part Two                      ####
#                                                          #
##%######################################################%##

lm(1~1)

Alt text

littleboxes's People

Contributors

bisaloo avatar dianebeldame avatar vincentguyader 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

Watchers

 avatar  avatar  avatar  avatar

littleboxes's Issues

Little Boxes not showing up in script

Little boxes has stopped working for me (in both scripts and .Rmd's). After selecting little boxes from the Addins dropdown nothing appears.

I've tried calling functions also:

littleboxes::littleboxes()

littleboxes::toutbeau()
Error in gsub("\n", " ", x) : argument "x" is missing, with no default

littleboxes::dd()
Error in nchar(x) : argument "x" is missing, with no default
sessionInfo()
R version 3.5.3 (2019-03-11)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS/LAPACK: /share/apps/anaconda2/lib/libopenblasp-r0.3.5.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8   
 [6] LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] usethis_1.5.0  devtools_2.0.2

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.1         rstudioapi_0.10    magrittr_1.5       pkgload_1.0.2      R6_2.4.0           rlang_0.3.4        tools_3.5.3        pkgbuild_1.0.3    
 [9] packrat_0.5.0      sessioninfo_1.1.1  cli_1.1.0          withr_2.1.2        remotes_2.0.4      yaml_2.2.0         assertthat_0.2.1   rprojroot_1.3-2   
[17] digest_0.6.18      crayon_1.3.4       processx_3.3.0     callr_3.2.0        littleboxes_0.1.0  fs_1.2.7           ps_1.3.0           testthat_2.1.1    
[25] memoise_1.1.0.9000 glue_1.3.1         compiler_3.5.3     desc_1.2.0         backports_1.1.4    prettyunits_1.0.2 

Section headings/folding

Bonjour! J'aime vraiment ce paquet, mais ça ne va pas bien avec la fonctionnalité de schéma de RStudio.

I notice that the box outlines are identified by RStudio as headings, so I have lots of (Untitled) sections in my outline. This is related to #3 where I note extra ### were added to a line to allow code folding.

The reason for both is that RStudio treats any line ending with 4 or more trailing -, =, or # as a section, see https://support.rstudio.com/hc/en-us/articles/200484568-Code-Folding-and-Sections

Might I suggest the following structure for boxes:

## ######################################################## ##
#                                                            #
####                       boxed heading                  ####
#                                                            #
## ######################################################## ##

for which:

  • the box outline itself is not treated as an untitled section (because it does not end in ####
  • the heading text is treated as an appropriately named section
  • the folding works as expected (folds the section) and leaves the title at the top
  • the styling is nicely symmetric and clean.

These need not be spaces - any character that breaks the rule of 4 will do

##%########################################################%##
#                                                            #
####                       boxed heading                  ####
#                                                            #
##%########################################################%##

Or alternatively, add a secondary short section title in the box

# infinite sum #############################################
#                                                          #
#          calculate an infinite sum of a series           #
#                                                          #
#########################################################%##

which causes the folding to begin with the top line of the box, but the short title remains visible (and is the name of the section). I have used a single % on the bottom of the box to prevent this from becoming a section.

Too many # at the end of my title line

Hi there!

I have a super small issue with the boxes...
From:
image
I obtain:
image
One of my colleague has the same problem with one computer but not the other.
Any ideas to solve it?
=]

dd devrait utiliser l'argument l de toutbeau

Le résultat n'est pas celui attendu quand on fait

cat(littleboxes::toutbeau('test', l = 100))

parce que dd n'utilise pas l'argument l de toutbeau mais utilise toujours 60 caractères.

Erreur quand le texte dépasse 60 caractères sans espaces

Par exemple :

littleboxes::dd('test')
littleboxes::dd('this is an example of a very long sentence with more than 60 characters')
littleboxes::dd('thisisanexampleofanextremelylongwordthatcouldgetwrappedbylittleboxes')

La première et deuxième lignes fonctionnent sans problèmes mais la 3e va causer une erreur.

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.