Indent Multiple Lines of Code in RStudio (Example)

 

This article shows how to indent code in RStudio in R programming.

The article contains one example for the indentation of several lines of code in RStudio. More precisely, the content of the article looks as follows:

If you want to know more about these contents, keep reading…

 

Example: How to Indent Multiple Lines of Code

This example demonstrates how to indent multiple lines of an R syntax in RStudio.

First, let’s create some R code:

x1 <- 5                     # Some code
x2 <- 10:5
data <- matrix(1:9, ncol = 3)

If we now want to indent these lines of code, we can highlight those lines and hit the tab button on the keyboard:

 

R code

 

After pressing the tab key on the keyboard, your code will move to the right:

  x1 <- 5                     # Some code
  x2 <- 10:5
  data <- matrix(1:9, ncol = 3)

 

Video, Further Resources & Summary

In case you need more explanations on the topics of this article, you might have a look at the following video on my YouTube channel. In the video, I’m showing the contents of this article.

 

The YouTube video will be added soon.

 

Additionally, you may want to have a look at the other tutorials which I have published on www.statisticsglobe.com. You can find some related articles that are related to the indentation of several lines of code in RStudio here:

 

In this tutorial you have learned how to indent multiple lines of code in RStudio in R. If you have additional questions, kindly let me know in the comments. Besides that, please subscribe to my email newsletter in order to get updates on the newest tutorials.

 

Subscribe to the Statistics Globe Newsletter

Get regular updates on the latest tutorials, offers & news at Statistics Globe.
I hate spam & you may opt out anytime: Privacy Policy.


Leave a Reply

Your email address will not be published.

Fill out this field
Fill out this field
Please enter a valid email address.

Menu
Top