- Gitbar The Menu Bar Git Repository Notifier 1 1 320
- Gitbar The Menu Bar Git Repository Notifier 1 1 31
Last update: 2020/06/12
Haskell-status-notifier-item: 0.3.0.4-2: 0. A library to allow applications to export a menu into the Unity Menu bar (GTK+ 3 library). Budgie-sntray-git: 0.4. 9) Installing This will show the progress bar indicating the installation progress. 10) Completing the Git setup wizard: Click on finish to exist the setup. How to Create a Local GIT repository on Windows. Click on “Git GUI” from the Windows start menu. This will display the following “GIT Menu”. Click on “Create New Repository.
Disclaimer
The R Tips and Tricks presented here are just what I use, and I don’t guarantee that this is the best way to do it. Moreover, new features are developed every days some stuff presented here might be outdated in the future. If you have any comments or suggestions, feel free to contact me: [email protected] or post an issue on GitHub.
My favourite IDE is R-Studio Desktop. It is free and open-source and provides a lot of powerful features.
This section presents interesting R-Studio settings and my current setup.
To setup R-Studio go to:
Tools -> Global Options.
.Documentation for these settings is available here. It might not be up to date, but most of the settings are presented.
Some useful R-Studio settings are not activated by default, and I think it’s worth taking some time to check these settings.
1.1 Pane layout and appearance
Tools -> Global Options. -> Pane layout
To have more space for the editor, we can move the console on the top right corner and move the “Environment pane” to the bottom right.
Indeed, the panes on the bottom left do not need to be continuously displayed.
As you can see, I prefer dark theme because it’s more pleasant for my eyes. My favourite one is “Idle Fingers”. However, several other themes are available, some a light other are black.
I also use the font “Fira code”, this font provide programming ligatures:
1.2 General settings
It is essential to not restore or save your workspace at startup or end of the R session. By this way, you will always start R-Studio in a fresh and clean environment. Because you have saved your script, you can regenerate the situation by running it. This is much better for the reproducibility of your work.
1.3 Code settings
Tools -> Global Options. -> Code
I present here R-Studio code settings. The highlighted lines are those I find interesting.
1.3.1 Editing
- Insert matching parens/quotes: When typing a paren, quote, or brace automatically insert a matching one and position the cursor between them.
- Auto-indent code after paste: Automatically execute a Reindent on blocks of R code pasted into the editor.
- Vertically align arguments in auto-indent: Preserve the current indentation level for function arguments split across multiple lines.
- Enable code snippets: see the corresponding section.
1.3.2 Display
- Highlight selected word: Add a background highlight effect to all instances of the currently selected word within the document. (Useful to find some variables in the code)
- Show line numbers: Show or hide line numbers within the left margin. (Useful for debugging)
- Show margin: Display a margin guide on the right-hand side of the source editor at the specified column. (The “good practices” require to have line smaller than 80 characters)
- Show whitespace characters: Display glyphs indicating where whitespace characters (tab, newline, etc.) are located in source documents. (Useful to detect “double spaces” and tabulation)
- Highlight R function calls: Highlight R functions. (Better distinction between functions and other R objects)
1.3.3 Saving
- Ensure that source files end with a new line: I It’s a good practice to end the coding files with a new line.
- Strip trailing horizontal whitespaces when saving: Remove whitespaces from blank line:
- Auto-save: New feature of R-Studio 1.3
1.3.4 Completion
Completion help to write functions name and their parameters just by taping the first letters and the
tab
key:1.3.5 Diagnostics
- Show diagnostics for R: Check to display alert messages in the margin of the editor when R code appears incorrect.
1.4 Spellchecking
1.5 Export your configuration
Topaz labs restyle serial key. From R-Studio 1.3, the configuration is saved at
~/.config/rstudio
(at least for Linux users). It is then easy to save and retrieve your configuration. This folder contains:- The R-Studio settings:
rstudio-pref.json
- The snippets
- The personal dictionary
- The personal keyboard shortcuts definitions
The
.Rprofile
file can be used to customize the environment at the startup of R. It should be placed in the HOME directory, or inside a folder of an R-project. (In this case, the one inside the project take precedence over the other).When R starts, it automatically sources the
.Rprofile
file. So it can be used to set up some R options like: options(max.print = 200)
to reduce the number of printed lines or options('scipen' = 999)
to disabled the scientific notation.There are also two particular functions:
.First( )
which will be run at the start of the R session and .Last( )
at the end of the session.You can try to copy these lines in your
.Rprofile
file:You should not modify options that can have an effect on the R behavior ! For example setting
options(stringsAsFactors = TRUE/FALSE)
in your .Rprofile
file is a bad idea. Indeed, your codes might not run well on another computer.3.1 Panes
3.1.1 Environment
- Environment pane presents the variables defined in your environments. By default, it shows the global environment, but you can select others (like those of the loaded packages).
- The button clears the workspace.
- An easy and graphical way to import data of different types (text, excel, SAS …) is to use the button. The corresponding R code will be written in the console, and you can then copy/paste it in your scripts.
- You can visualize the variables defined in your environments by clicking on them. This is a shortcut for a call to the R function
View()
.
Click on your R objects to view them in the main window
3.1.2 File browser
By default, it is open at your current working directory. You can navigate through your file and set up a new working directory with the button .
It’s quite convenient to manage the files directly from R-Studio. If you are working in a project, you can quickly access to your root folder with the button.
3.1.3 Packages
In the package pane, you can install new packages. It’s particularly convenient when you don’t know the exact package name.
With the update button you can also check if some of your packages are not up to date. With the button, you can access the “news file” of these packages to see what is new. (See also section CRANalert for a notifier tool about updated packages).
3.1.4 Jobs
https://betterzip-4-0-2-archiving-tool-windows-10.peatix.com. Click on the button or source a file as a local job to run an R script in a background R session.
By this way, you can continue to work on R-Studio with an available console while a script is running.
Jobs pane with a running job showing some outputs
You can find more information on this R-Studio blog post.
3.1.5 Git
If you work with Git in your R-Project, you can run the main git commands in this pane: Video file converter to mp4 software free download.
Gitbar The Menu Bar Git Repository Notifier 1 1 320
- Stage / commit
- Pull / Push
- View diff and history
- Create / checkout branches
3.1.6 Tutorial
Some R packages provide tutorials thanks to the
learnr
package. You can try them in this pane.Data basics tutorial running in the pane
3.2 Addins
Some R packages include some R-Studio “addins”.
You can launch an addin using the button.
These addins provides new functionality to R studio like: Color picker, create data.frame from clipboard…
Addins can be installed with “Browse RStudio addins”
3.3 R-Project
When you work, I hope you keep all your files associated with a project in one specific directory in your computer. R-Studio provides a built-in support for this via “projects”.
You can find some information about R-Project in this R-Studio support article or at this R for Data Science section.
3.3.1 Advantages
The main advantages to work with R-Projects are:
- When an R-Project is open, the current working directory is automatically set to the project directory. An R-Project can then be shared across multiple users on different computers without thinking about setting the working directory.
- When an R-Project is open, you get back to where you left off: The previously opened files are restored into the editor tabs such as the command history (if it had been saved). Even the files that had never been saved (named
Untitled1
in the editor) are restored. - You can use Git from R-Studio.
Of course, the global environment is not restored if R-Studio is set up correctly, as explained in this section.
3.3.2 Create R-Project
You can create a new R-Project either by clicking on
File -> New Project.
or on the button.You can then choose to create it in an existing directory, or to create a new one. In this case, R-Studio provides different templates: “R package”, “Shiny Web Application”, “Plumber API” … After creation, the directory will already contain some files and folder.
There is no template for data analysis projects, but a simple structure can be:
3.3.3 How it works
R project is a directory containing a
.Rproj
file which can be open by R-Studio. When you open a .Rproj
file, the following happens:- A new R session (process) is started
- The
.Rprofile
file in the project’s main directory (if any) is sourced by R - The
.RData
file in the project’s main directory is loaded (if project options indicate that it should be loaded). - The
.Rhistory
file in the project’s main directory is loaded into the R-Studio history pane (and used for Console Up/Down arrow command history). - The current working directory is set to the project directory.
- Previously edited source documents are restored into editor tabs
- Other R-Studio settings (e.g. active tabs, splitter positions, etc.) are restored to where they were the last time the project was closed.
The
.Rproj
file is a text file (you can try to open it with a text editor) containing the project settings. These settings can be modified in Tools -> Project Options.
. It is essential to know that these settings have priority over the standard R-Studio settings.- If your R project is included in a Google Drive folder, you can encounter some troubles when saving your files.
- Even if the
.Rproj.user
folder is not so big, it can contain a lot of small files. It can then take a long time to be synchronized on clouds services.
3.4 Keyboard shortcuts and useful command
R-Studio provide a lot of handy commands accessible from the menu bar (
File
, Edit
, Code
, Session
… ).These commands are linked to keyboard shortcuts. Even if it is not easy to learn, it will significantly improve your productivity.
The default shortcuts can be modified through:
Tools -> Modify keyboard shortcuts.
The list below is just a non-exhaustive list of my favourite shortcuts / functionality.
- Remember, if you are doing an annoying and repetitive task, there is probably a shortcut for that!
3.4.1 Basic
Some of these shortcuts are similar to those of other software.
Ctrl
+Z
: UndoCtrl
+Shift
+Z
: Redo (this is not the usual convention!)Ctrl
+O
: Open fileCtrl
+A
: Select allCtrl
+S
: Save fileCtrl
+F
: Find in the current fileCtrl
+Shit
+F
: Find in files (to search across multiple files)Ctrl
+w
: Close tabCtrl
+Tab
: Go to next tabCtrl
+Q
: Quit R-StudioTab
: Indent / AutocompletionShift
+Tab
: OutdentCtrl
+Shift
+F10
: Restart R session. You should do it quite often!Ctrl
+Shift
+H
:Choose working directoryNot needed because you are working in an R project. ?
3.4.2 Help
Alt
+Shift
+K
: Show keyboard shortcutsF1
: Show function helpCtrl
+Click
: (on a function) Go to function definition.
3.4.3 Run code
Ctrl
+Enter
: Run selected linesCtrl
+Alt
+B
/E
: Run code from Begining to line or from line to EndCtrl
+Alt
+Shift
+P
: Profile selected lines (see: profiling section)
3.4.4 Editor
Alt
+-
: insert<-
Ctrl
+Shift
+M
: insert a pipe%>%
Ctrl
+Shift
+C
: (un)Comment code
Ctrl
+Shift
+/
: Reflow comment
Ctrl
+ Shift
+ /
Ctrl
+I
: Auto indentationCtrl
+Shift
+A
: Auto reformat code (with format convention)
Ctrl
+P
: Jump to Matching Brace/Paren. Very useful to debug “Brace related errors”
Ctrl
+ P
Ctrl
+Alt
+Up
/Down
: Add cursor above or belowCtrl
+Alt
+Click
: add a new cursor (Useful on Windows when you copy/paste file path and you want to double the/
)
Gitbar The Menu Bar Git Repository Notifier 1 1 31
Ctrl
+Alt
+Shift
+M
: Rename in scope. It is much more intelligent than a simple “find and replace”. On the example below, neither the variablea
outside the function nor the variablealex
is affected.
Ctrl
+ Alt
+ Shift
+ M
3.4.5 R markdown
Ctrl
+Shit
+K
: Knit documentShit
+Tab
: Autocompletion / snippetsCtrl
+Alt
+I
: Insert a new chunkCtrl
+Shift
+Enter
: Run current chunkCtrl
+Alt
+P
: Run all previous chunks
Code snippets are text macros that insert a piece of code.
Some are already installed in R-Studio like:
You can also create your own snippets.
Instead of copy-pasting your work from other projects, it can be interesting to create a snippet. For example, I use some snippet to generate the code of
plotly
interactive graph. You can see below another example of a snippet generating a custom color palette:snippet to generate a color palette
You can find more information in this Rstudio support article
4.1 Create a custom snippet
To create a new snippet, go to:
Tools -> Global Options.
and then Code
and click on the button.You can write your custom snippet in the opened window.
The syntax is quite simple:
https://ameblo.jp/75elesus-saeg/entry-12635524570.html. It starts with
snippet
, followed by its name. The contents of the snippet should be written below with an indentation.Variables of the snippet can be defined using:
${X:varname}
, with X
a number. All variables with the same number X
will be written together when the snippet is used.You can also run R code in your snippet by including it inside:
`r `
. For example, this snippet returns the current date:- The
$
sign is a special character for snippet definition. So to include a dollar sign in a snippet, escape the character with a slash:$
.
5.1 Microbenchmark
The package
microbenchmark
is very useful to compare the time of pieces of code.5.2 Profiling
R-Studio integrate a profiling tool using the
profvis
package. This tool executes a script and displays the time and memory allocation of each line and R functions.It’s convenient to detect the slowest part of your code to improve them in priority.
Using the
Rmarkdown
package is an easy and beautiful way to create R analysis reports, presentation slides, package documentation, and even books and websites.It is based on the markdown syntax which, is easy to read and easy to write:
Blocks of R code (called a chunk) can be introduced using the delimiters
```{r}
and ```
and R-studio can display the outputs directly in the editor:R-Markdown can generate a lot of different formats: HTML, pdf, Word, PowerPoint, markdown…
A complete R-Markdown guide is available here.
6.1 R-Markdwon template
There is a lot of customization options so it can be good to save templates.
The template structure is:
You should name your
.Rmd
file skeleton.Rmd
, and the template.yaml
file contains some information about the template:Once you have the template structure, you should:
- Initialize a new R package:
File -> New project.
and select “R package” - save your template in the package at:
./inst/rmarkdown/templates/templateName
- Install your package:
Ctrl
+Shift
+B
, or click on “Build and restart” in the “Build” pane.
Your template is then accessible at:
File -> New file -> R Markdown.
- It is a good practice to add a chunk with
print(sessionInfo(), locale = FALSE)
at the end of a markdown document. So that the reader can have information about the versions of the packages used to generate the document.
6.2 Publish your R-Markdown
You can display an html document online thanks to GitHub pages.
- First, if you don’t have one, create your GitHub web site. You can follow the steps presented here (It is just a repository named
username.github.io
containing anindex.html
file) - Create a new repository for your document:
myRmdDocument
- Name your
.rmd
fileindex.rmd
and knit your document. - Push the
index.html
to the GitHub repository at the master branch - On your github repository (
myRmdDocument
) go toSettings -> GitHub Pages -> Source -> Master Branch -> Save
- Your document will be available at
https://username.github.io/myRmdDocument
after several minutes.
7.1saveRDS
An R object (for example the result of a long calculation) can be saved using the function
save()
and then load back with the function load()
. The problem with this function is that it saves both the objects and their names in the same file. So we cannot reset the object name.We don’t have this problem with the functions
saveRDS()
and readRDS()
:7.2dput()
This function writes the “source code” of an R object:
7.3browser()
This function interrupts the execution of an expression lunch the “debug mode”.
It can be used to debug code in a “
apply
” function, in a Shiny application, Plumber API …7.4plotly
Crack in finished drywall above door frame. The
plotly
package creates interactive plots:7.5covr
Track test coverage for your R package and view reports locally or (optionally) upload the results to codecov or coveralls.
7.6 Other
usethis
: Automates repetitive tasks that arise during project setup and development, both for R packages and non-package projects.pkgdown
: To build a website for an R package.xaringan
: An R package for creating slideshows withremark.js
through R Markdown.
A cheat-sheet is a one or two pages documentation presenting the main functionality of a tool (Software, R package … ).
There is a lot of cheat-sheet for different R packages. You can access some of them from R-Studio:
Help -> Cheatsheets
and much more are accessible here.For example:
Of course, this is not limited to R, for example, Git cheat sheet from GitHub, LaTeX…
You can find here some interesting resources about R.
- CRANalert Get email alerts when a CRAN package gets updated
- R-Bloggers RSS feed Get “email” for each blogpost posted on R-Bloggers
I have learned a lot about R thanks to the following online resources and some tips presented in this document come from these references.
- Books:
- R packages by Hadley Wickham
- R for Data Science by Garrett Grolemund and Hadley Wickham
- Advanced R by Hadley Wickham
- Efficient R programming by Colin Gillespie and Robin Lovelace
- Data Visualization with R by Rob Kabacoff
- Interactive web-based data visualization with R, plotly, and shiny by Carson Sievert
- Web sites:
- The R Graph Gallery by Yan Holtz
- R Markdown Gallery by R-Studio
- R Markdown tips & tricks by Yan Holtz
- Shiny Gallery by R-Studio
Source code of this document is available on GitHub.
Repository:Japanese XBMC Addons
Notify incoming call to IP phone
Install Guide via Fusion Installer
- Select the Add-ons tab from the vertical menu bar within Kodi.
- Click on the little open box icon at the top left corner of the Add-ons interface.
- Choose the Install from zip file function.
- Select the fusionco server from the listing.
- Open the kodi-repos folder.
- Select the english folder, or international for foreign language addons.
- Select the addon developer's repository: repository.japanese-1.0.0.zip
- Wait a second for the repository to download.
- Select the Install from repository function at this point.
- Choose the repository you just installed: Japanese XBMC Addons
- Select the program add-ons category.
- Select the addon you wish to install: Incoming Call Notifier
- Click on the Install button at the lower right corner of the screen.
- If prompted, select the latest version from the listing.
- If prompted, press the OK button to accept necessary dependencies.
- Wait a few seconds for the addon and its dependencies to download.
Install Guide via Git Browser
- Click on the Add-ons tab from the vertical menu bar within Kodi.
- Select the Program add-ons category.
- Launch the Git Browser tool from the right side of the screen.
- Select the Search by GitHub Username option.
- Click on the *** New Search *** function.
- Using the on-screen keyboard, enter the addon developer's GitHub username: kodiful
- Press the OK button on the right side of the keyboard.
- Click on the corresponding repository ZIP file at the top of the listing, in order to facilitate automated addon updates in the future: repository.japanese-1.0.0.zip
- Press the Install button when prompted.
- Wait a few seconds for the process to complete.
- Press the Continue button when prompted to proceed.
- Click on the addon ZIP file you wish to install: script.incoming.call.notifier-1.0.2.zip
- Press the Install button to proceed.
- Wait a few seconds for the addon and dependencies to install.
- When prompted, press the Restart button to finalize installation.