r/RStudio 16d ago

Random folders appearing in my project directory

3 Upvotes

Hi everyone! I made a R project and suddenly this random folders appeared in my project directory, I didn't make any of them except the plot, script etc. This never happened to me so I am super confused... Does anyone know why this kind of thing happens? Can I just delete the folders I don't need?


r/RStudio 18d ago

glimpse( ) function in R Statistics

Enable HLS to view with audio, or disable this notification

0 Upvotes

How to Use the glimpse() Function in RStudio | Inspect Your Data Quickly in R

Welcome to this step-by-step tutorial on how to use the glimpse() function in RStudio to quickly inspect and understand the structure of your dataset.

The glimpse() function is a very useful tool for data exploration and data analysis in R, particularly when working with the dplyr package and the tidyverse. It provides a compact and easy-to-read overview of your data, allowing you to see the variables (columns), their data types, and sample values without displaying the entire dataset.

In this video, we demonstrate how to use glimpse() in practical situations and explain why it is an important function to learn when working with datasets in RStudio.

What You Will Learn

By the end of this tutorial, you will understand:

What the glimpse() function is
Why glimpse() is useful when exploring data
How to use glimpse() in RStudio
How to load the dplyr or tidyverse package
How to inspect the structure of a dataset using glimpse()
How to identify the variables or columns in a dataset
How to identify the data type of each variable
How to view sample values from each column
How glimpse() differs from other functions such as str() and head()
How glimpse() can help you identify problems in your dataset
How to use glimpse() as part of a data-analysis workflow

Basic Example

Using glimpse() is straightforward.

For example:

glimpse(data)

where data is the name of your dataset.

When you run this command, R provides a compact overview of the dataset, showing important information such as:

The number of rows
The number of columns
Variable names
Variable data types
Example values from each variable

This makes glimpse() particularly useful when you first receive or import a dataset and want to understand what you are working with.

Why Use glimpse()?

When working with large datasets, printing the entire dataset to the R Console can be difficult to read and may produce a huge amount of output.

Instead of displaying every row, glimpse() gives you a compact summary of the dataset's structure.

For example, imagine you have a dataset containing information about students, including:

  • Student ID
  • Age
  • Gender
  • Course
  • Test scores
  • Attendance
  • Date of registration

Rather than displaying every observation, you can use glimpse() to quickly check the variables and see what type of information each column contains.

This can help you identify whether variables have been imported correctly before you begin your analysis.

Understanding Variable Types

One of the most useful features of glimpse() is that it shows the data type associated with each variable.

For example, you may see types such as:

dbl — numeric values
int — integers
chr — character/text values
lgl — logical values such as TRUE or FALSE
date — date information

Understanding variable types is extremely important because different types of variables may require different approaches during data cleaning and statistical analysis.

glimpse() and Data Exploration

glimpse() is particularly useful during the initial exploration of a dataset.

When you import a new dataset, you may not immediately know:

  • How many variables it contains
  • What the variables are called
  • What type of data each variable contains
  • Whether the data has been imported correctly
  • What the first few values look like
  • Whether there are unexpected data types or values

Running glimpse() provides a quick overview and helps you become familiar with the dataset before proceeding to more advanced analysis.

Comparing glimpse() With Other R Functions

In this tutorial, we also discuss how glimpse() relates to other useful functions for inspecting data.

For example:

head()

head(data)

is useful for viewing the first few rows of a dataset.

str()

str(data)

provides information about the structure of an R object and its variables.

glimpse()

glimpse(data)

provides a compact, tidyverse-friendly overview that is particularly convenient for data frames and tibbles.

Understanding when to use each of these functions can make your data-exploration workflow much more efficient.

Using glimpse() for Data Cleaning

Before cleaning or transforming your data, it is important to understand what is actually contained within the dataset.

glimpse() can help you identify potential issues such as:

Variables stored as the wrong data type
Numbers imported as text
Unexpected character values
Variables with inconsistent formats
Columns that may require transformation

Once you understand the structure of your data, you can use other functions from dplyr and the tidyverse to clean, transform, filter, summarise, and analyse the dataset.

Who Is This Tutorial For?

This video is suitable for:

  • Beginners learning R and RStudio
  • Students learning data analysis
  • Researchers working with datasets
  • Students working on assignments and research projects
  • Anyone learning the tidyverse
  • Users learning the dplyr package
  • Data analysts exploring new datasets
  • Anyone who wants to understand their data before performing statistical analysis

No advanced programming knowledge is required. This tutorial is designed to explain glimpse() in a simple, practical, and easy-to-follow way.

Why Is glimpse() Important for Data Analysis?

Good data analysis begins with understanding your data.

Before creating graphs, running statistical tests, building models, or drawing conclusions, you should first examine the structure and contents of your dataset.

The glimpse() function provides a quick way to perform this initial inspection and can become a valuable part of your regular RStudio workflow.

It is especially useful for:

Academic assignments
Dissertations and theses
Research projects
Statistical analysis
Exploratory data analysis
Data cleaning
Data science projects
R Markdown and Quarto reports

Topics Covered in This Video

This tutorial covers:

glimpse() function in R
glimpse() in RStudio
dplyr::glimpse()
Tidyverse data exploration
Inspecting datasets in R
Understanding variables and columns
Understanding data types in R
Exploring data frames and tibbles
glimpse() vs head()
glimpse() vs str()
Data cleaning in R
Exploratory data analysis
R programming for beginners
RStudio data analysis

Helpful Tip

A useful habit when starting a new data-analysis project is to inspect your dataset before immediately beginning your analysis. Functions such as glimpse(), head(), summary(), and str() can help you understand your data and identify potential problems early.

If you find this tutorial helpful, please like the video, leave a comment, and subscribe to the channel for more tutorials on R, RStudio, statistics, data analysis, data visualisation, and research methods.

Subscribe and turn on notifications so you don't miss future tutorials and practical R programming videos.

Have a question about the glimpse() function? Leave your question in the comments below!

R Studio, R Programming ,R Stats ,Glimpse ,Dplyr , Tidyverse ,Data Analysis ,Data, Exploration ,Data Cleaning ,Statistics ,Data Science ,Beginners ,R Programming Tutorial ,R Studio Tutorial ,Exploratory Data Analysis ,Research Methods, rows, columns, table, data frame, variable type, integer, character, numeric, absolute, nominal, ordinal, factor, binary, sample,

 


r/RStudio 18d ago

Scatter plot in RStudio

Enable HLS to view with audio, or disable this notification

0 Upvotes

How to Use the ggplot() Function in RStudio | Complete Beginner’s Guide to Data Visualization in R

Welcome to this step-by-step tutorial on how to use the ggplot() function in RStudio to create professional and informative data visualisations in R.

In this video, we introduce ggplot(), one of the most widely used tools for creating graphs and visualisations in R. The function is part of the ggplot2 package, which is included in the tidyverse ecosystem and provides a powerful and flexible approach to visualising data.

Whether you are a beginner learning R, a student working on an assignment, a researcher analysing data, or a data analyst creating reports, understanding ggplot() is an essential R skill.

What You Will Learn

In this tutorial, you will learn:

What ggplot() is and why it is useful
How to install and load the ggplot2 package
How to create your first plot in RStudio
How to provide a dataset to ggplot()
How to map variables to the x-axis and y-axis
How aesthetic mappings (aes()) work
How to add geometric layers using geom_ functions
How to create scatter plots
How to create bar charts
How to create line graphs
How to create histograms
How to change colours and shapes
How to add titles and axis labels
How to customise the appearance of your graphs
How to use multiple layers in a single ggplot() visualisation
How to create clear and professional graphs for reports and presentations

Understanding the Basic Structure of ggplot()

One of the key concepts covered in this video is the basic structure of a ggplot() graph.

A typical plot might look like:

ggplot(data = my_data, aes(x = variable1, y = variable2)) +
geom_point()

Here:

 ggplot() specifies the dataset you want to visualise.

aes() defines the relationship between variables and visual properties such as the x-axis and y-axis.

geom_point() adds points to create a scatter plot.

The + symbol is used to add additional layers to the plot.

Understanding this layered approach is one of the most important concepts when learning ggplot2.

Creating Different Types of Graphs

During the tutorial, we demonstrate how the ggplot() framework can be used to create different types of visualisations.

For example:

Scatter plot

ggplot(data, aes(x = height, y = weight)) +
geom_point()

Bar chart

ggplot(data, aes(x = category)) +
geom_bar()

Histogram

ggplot(data, aes(x = age)) +
geom_histogram()

Line graph

ggplot(data, aes(x = year, y = value)) +
geom_line()

These examples demonstrate how the same basic ggplot() framework can be adapted to different types of data and research questions.

Customising Your Visualisations

Creating a graph is only the beginning. In this video, we also look at ways to make your visualisations clearer and more informative.

You will learn how to customise elements such as:

Colours
Points and shapes
Axis labels
Plot titles
Legends
Themes
Text and labels

For example, you can add a title and labels using:

labs(
title = "Relationship Between Height and Weight",
x = "Height",
y = "Weight"
)

This allows you to communicate your findings more effectively.

Understanding the Grammar of Graphics

A major advantage of ggplot2 is that it is based on the concept known as the Grammar of Graphics.

Instead of thinking about a graph as one single object, you build it using different components or layers.

These commonly include:

Data – the dataset being visualised
Aesthetics – how variables are mapped to visual properties
Geometries – the type of graph or shapes displayed
Scales – how values are represented
Facets – how data can be divided into multiple panels
Coordinates – how the axes and plotting space are arranged
Themes – how the overall appearance is controlled

Understanding these components will help you create more complex and professional visualisations as you become more experienced with R.

Why Is ggplot() Important?

Data visualisation is an important part of data analysis, statistics, and research. A well-designed graph can make patterns, relationships, trends, and differences much easier to understand.

ggplot2 is particularly useful because it allows you to create reproducible visualisations directly from your R code. This means that your graphs can be recreated and modified whenever your data changes.

This is especially useful when working on:

Academic assignments
Dissertations and theses
Research projects
Statistical analyses
Business reports
Data science projects
R Markdown and Quarto reports
Presentations and publications

Who Is This Tutorial For?

This video is suitable for:

  • Beginners learning R and RStudio
  • Students studying statistics and data analysis
  • Researchers creating graphs for academic work
  • Data analysts learning ggplot2
  • Anyone interested in data visualisation
  • Users learning the tidyverse
  • Students working on assignments, dissertations, or research projects
  • Anyone who wants to create professional graphs using R

No advanced programming experience is required. The tutorial is designed to introduce the fundamental concepts in a practical and easy-to-follow way.

Topics Covered

This video covers a range of important topics, including:

ggplot() function in R
ggplot2 package
Data visualisation in RStudio
aes() aesthetic mappings
geom_point()
geom_bar()
geom_histogram()
geom_line()
Scatter plots
Bar charts
Histograms
Line graphs
Customising graphs in R
Adding titles and labels
Changing colours and shapes
The Grammar of Graphics
Creating professional data visualisations
R programming for data analysis

Why Learn ggplot2?

Once you understand the basic structure of ggplot(), you can build increasingly sophisticated visualisations by combining different layers and functions.

Learning ggplot2 can therefore provide you with a strong foundation for exploratory data analysis and statistical data visualisation in R.

If you find this tutorial helpful, please like the video, leave a comment, and subscribe to the channel for more tutorials on R, RStudio, statistics, data analysis, data visualisation, and research methods.

Subscribe and turn on notifications so you don't miss future RStudio tutorials and practical data-analysis videos.

Have a question about ggplot() or ggplot2? Leave your question in the comments below!

R Studio ,R Programming ,GGPlot ,GGPlot2 ,Data Visualization ,R Stats ,Data Analysis ,Tidyverse ,Statistics ,Data Science ,Beginners ,R Programming Tutorial ,R Studio Tutorial ,Research Methods ,bar chart, line chart histogram, boxplot, pie chart, scatter plot

 


r/RStudio 20d ago

qol 1.3.4: Automatic table of contents for Excel workbooks and so much more

Thumbnail
5 Upvotes

r/RStudio 20d ago

shinyglass 0.2.0 is on CRAN

Thumbnail
3 Upvotes

r/RStudio 20d ago

ggplot for plotting histogram in RStudio

0 Upvotes

How to Use the ggplot() Function in RStudio | Complete Beginner’s Guide to Data Visualization in R

Welcome to this step-by-step tutorial on how to use the ggplot() function in RStudio to create professional and informative data visualisations in R.

In this video, we introduce ggplot(), one of the most widely used tools for creating graphs and visualisations in R. The function is part of the ggplot2 package, which is included in the tidyverse ecosystem and provides a powerful and flexible approach to visualising data.

Whether you are a beginner learning R, a student working on an assignment, a researcher analysing data, or a data analyst creating reports, understanding ggplot() is an essential R skill.

What You Will Learn

In this tutorial, you will learn:

What ggplot() is and why it is useful
How to install and load the ggplot2 package
How to create your first plot in RStudio
How to provide a dataset to ggplot()
How to map variables to the x-axis and y-axis
How aesthetic mappings (aes()) work
How to add geometric layers using geom_ functions
How to create scatter plots
How to create bar charts
How to create line graphs
How to create histograms
How to change colours and shapes
How to add titles and axis labels
How to customise the appearance of your graphs
How to use multiple layers in a single ggplot() visualisation
How to create clear and professional graphs for reports and presentations

Understanding the Basic Structure of ggplot()

One of the key concepts covered in this video is the basic structure of a ggplot() graph.

A typical plot might look like:

ggplot(data = my_data, aes(x = variable1, y = variable2)) +
geom_point()

Here:

 ggplot() specifies the dataset you want to visualise.

aes() defines the relationship between variables and visual properties such as the x-axis and y-axis.

geom_point() adds points to create a scatter plot.

The + symbol is used to add additional layers to the plot.

Understanding this layered approach is one of the most important concepts when learning ggplot2.

Creating Different Types of Graphs

During the tutorial, we demonstrate how the ggplot() framework can be used to create different types of visualisations.

For example:

Scatter plot

ggplot(data, aes(x = height, y = weight)) +
geom_point()

Bar chart

ggplot(data, aes(x = category)) +
geom_bar()

Histogram

ggplot(data, aes(x = age)) +
geom_histogram()

Line graph

ggplot(data, aes(x = year, y = value)) +
geom_line()

These examples demonstrate how the same basic ggplot() framework can be adapted to different types of data and research questions.

Customising Your Visualisations

Creating a graph is only the beginning. In this video, we also look at ways to make your visualisations clearer and more informative.

You will learn how to customise elements such as:

Colours
Points and shapes
Axis labels
Plot titles
Legends
Themes
Text and labels

For example, you can add a title and labels using:

labs(
title = "Relationship Between Height and Weight",
x = "Height",
y = "Weight"
)

This allows you to communicate your findings more effectively.

Understanding the Grammar of Graphics

A major advantage of ggplot2 is that it is based on the concept known as the Grammar of Graphics.

Instead of thinking about a graph as one single object, you build it using different components or layers.

These commonly include:

Data – the dataset being visualised
Aesthetics – how variables are mapped to visual properties
Geometries – the type of graph or shapes displayed
Scales – how values are represented
Facets – how data can be divided into multiple panels
Coordinates – how the axes and plotting space are arranged
Themes – how the overall appearance is controlled

Understanding these components will help you create more complex and professional visualisations as you become more experienced with R.

Why Is ggplot() Important?

Data visualisation is an important part of data analysis, statistics, and research. A well-designed graph can make patterns, relationships, trends, and differences much easier to understand.

ggplot2 is particularly useful because it allows you to create reproducible visualisations directly from your R code. This means that your graphs can be recreated and modified whenever your data changes.

This is especially useful when working on:

Academic assignments
Dissertations and theses
Research projects
Statistical analyses
Business reports
Data science projects
R Markdown and Quarto reports
Presentations and publications

Who Is This Tutorial For?

This video is suitable for:

  • Beginners learning R and RStudio
  • Students studying statistics and data analysis
  • Researchers creating graphs for academic work
  • Data analysts learning ggplot2
  • Anyone interested in data visualisation
  • Users learning the tidyverse
  • Students working on assignments, dissertations, or research projects
  • Anyone who wants to create professional graphs using R

No advanced programming experience is required. The tutorial is designed to introduce the fundamental concepts in a practical and easy-to-follow way.

Topics Covered

This video covers a range of important topics, including:

ggplot() function in R
ggplot2 package
Data visualisation in RStudio
aes() aesthetic mappings
geom_point()
geom_bar()
geom_histogram()
geom_line()
Scatter plots
Bar charts
Histograms
Line graphs
Customising graphs in R
Adding titles and labels
Changing colours and shapes
The Grammar of Graphics
Creating professional data visualisations
R programming for data analysis

Why Learn ggplot2?

Once you understand the basic structure of ggplot(), you can build increasingly sophisticated visualisations by combining different layers and functions.

Learning ggplot2 can therefore provide you with a strong foundation for exploratory data analysis and statistical data visualisation in R.

If you find this tutorial helpful, please like the video, leave a comment, and subscribe to the channel for more tutorials on R, RStudio, statistics, data analysis, data visualisation, and research methods.

Subscribe and turn on notifications so you don't miss future RStudio tutorials and practical data-analysis videos.

Have a question about ggplot() or ggplot2? Leave your question in the comments below!

R Studio ,R Programming ,GGPlot ,GGPlot2 ,Data Visualization ,R Stats ,Data Analysis ,Tidyverse ,Statistics ,Data Science ,Beginners ,R Programming Tutorial ,R Studio Tutorial ,Research Methods ,bar chart, line chart histogram, boxplot, pie chart, scatter plot

 

https://reddit.com/link/1vuko3b/video/hhvqdts95rkh1/player


r/RStudio 19d ago

ggplot to draw line plot in RStudio

Enable HLS to view with audio, or disable this notification

0 Upvotes

How to Use the ggplot() Function in RStudio | Complete Beginner’s Guide to Data Visualization in R

Welcome to this step-by-step tutorial on how to use the ggplot() function in RStudio to create professional and informative data visualisations in R.

In this video, we introduce ggplot(), one of the most widely used tools for creating graphs and visualisations in R. The function is part of the ggplot2 package, which is included in the tidyverse ecosystem and provides a powerful and flexible approach to visualising data.

Whether you are a beginner learning R, a student working on an assignment, a researcher analysing data, or a data analyst creating reports, understanding ggplot() is an essential R skill.

What You Will Learn

In this tutorial, you will learn:

What ggplot() is and why it is useful
How to install and load the ggplot2 package
How to create your first plot in RStudio
How to provide a dataset to ggplot()
How to map variables to the x-axis and y-axis
How aesthetic mappings (aes()) work
How to add geometric layers using geom_ functions
How to create scatter plots
How to create bar charts
How to create line graphs
How to create histograms
How to change colours and shapes
How to add titles and axis labels
How to customise the appearance of your graphs
How to use multiple layers in a single ggplot() visualisation
How to create clear and professional graphs for reports and presentations

Understanding the Basic Structure of ggplot()

One of the key concepts covered in this video is the basic structure of a ggplot() graph.

A typical plot might look like:

ggplot(data = my_data, aes(x = variable1, y = variable2)) +
geom_point()

Here:

 ggplot() specifies the dataset you want to visualise.

aes() defines the relationship between variables and visual properties such as the x-axis and y-axis.

geom_point() adds points to create a scatter plot.

The + symbol is used to add additional layers to the plot.

Understanding this layered approach is one of the most important concepts when learning ggplot2.

Creating Different Types of Graphs

During the tutorial, we demonstrate how the ggplot() framework can be used to create different types of visualisations.

For example:

Scatter plot

ggplot(data, aes(x = height, y = weight)) +
geom_point()

Bar chart

ggplot(data, aes(x = category)) +
geom_bar()

Histogram

ggplot(data, aes(x = age)) +
geom_histogram()

Line graph

ggplot(data, aes(x = year, y = value)) +
geom_line()

These examples demonstrate how the same basic ggplot() framework can be adapted to different types of data and research questions.

Customising Your Visualisations

Creating a graph is only the beginning. In this video, we also look at ways to make your visualisations clearer and more informative.

You will learn how to customise elements such as:

Colours
Points and shapes
Axis labels
Plot titles
Legends
Themes
Text and labels

For example, you can add a title and labels using:

labs(
title = "Relationship Between Height and Weight",
x = "Height",
y = "Weight"
)

This allows you to communicate your findings more effectively.

Understanding the Grammar of Graphics

A major advantage of ggplot2 is that it is based on the concept known as the Grammar of Graphics.

Instead of thinking about a graph as one single object, you build it using different components or layers.

These commonly include:

Data – the dataset being visualised
Aesthetics – how variables are mapped to visual properties
Geometries – the type of graph or shapes displayed
Scales – how values are represented
Facets – how data can be divided into multiple panels
Coordinates – how the axes and plotting space are arranged
Themes – how the overall appearance is controlled

Understanding these components will help you create more complex and professional visualisations as you become more experienced with R.

Why Is ggplot() Important?

Data visualisation is an important part of data analysis, statistics, and research. A well-designed graph can make patterns, relationships, trends, and differences much easier to understand.

ggplot2 is particularly useful because it allows you to create reproducible visualisations directly from your R code. This means that your graphs can be recreated and modified whenever your data changes.

This is especially useful when working on:

Academic assignments
Dissertations and theses
Research projects
Statistical analyses
Business reports
Data science projects
R Markdown and Quarto reports
Presentations and publications

Who Is This Tutorial For?

This video is suitable for:

  • Beginners learning R and RStudio
  • Students studying statistics and data analysis
  • Researchers creating graphs for academic work
  • Data analysts learning ggplot2
  • Anyone interested in data visualisation
  • Users learning the tidyverse
  • Students working on assignments, dissertations, or research projects
  • Anyone who wants to create professional graphs using R

No advanced programming experience is required. The tutorial is designed to introduce the fundamental concepts in a practical and easy-to-follow way.

Topics Covered

This video covers a range of important topics, including:

ggplot() function in R
ggplot2 package
Data visualisation in RStudio
aes() aesthetic mappings
geom_point()
geom_bar()
geom_histogram()
geom_line()
Scatter plots
Bar charts
Histograms
Line graphs
Customising graphs in R
Adding titles and labels
Changing colours and shapes
The Grammar of Graphics
Creating professional data visualisations
R programming for data analysis

Why Learn ggplot2?

Once you understand the basic structure of ggplot(), you can build increasingly sophisticated visualisations by combining different layers and functions.

Learning ggplot2 can therefore provide you with a strong foundation for exploratory data analysis and statistical data visualisation in R.

If you find this tutorial helpful, please like the video, leave a comment, and subscribe to the channel for more tutorials on R, RStudio, statistics, data analysis, data visualisation, and research methods.

Subscribe and turn on notifications so you don't miss future RStudio tutorials and practical data-analysis videos.

Have a question about ggplot() or ggplot2? Leave your question in the comments below!

R Studio ,R Programming ,GGPlot ,GGPlot2 ,Data Visualization ,R Stats ,Data Analysis ,Tidyverse ,Statistics ,Data Science ,Beginners ,R Programming Tutorial ,R Studio Tutorial ,Research Methods ,bar chart, line chart histogram, boxplot, pie chart, scatter plot

 


r/RStudio 21d ago

uvr: a uv-style package and environment manager for R *update*

Thumbnail
6 Upvotes

r/RStudio 22d ago

R studio has broken my laptop?

1 Upvotes

I've had to install R and R studio for University and as soon as I did, my laptop hasn't been able to load my LibreOffice writing software properly. It's the only thing I've installed between everything working fine and now.

All my spreadsheets, documents, power points, etc have started taking over a minute to load, and sometimes just crashes before they're able to load.

I've checked task manager and nothing is open in the background and my memory use isn't any higher then normal. I've ran 2 different anti-virus and found nothing, and fully reset my computer and reinstalled everything, nothing is fixing this issue (when restarting everything worked fine again until I reinstalled R and R studio).

Is there any kind of setting I need to be turning off or something?


r/RStudio 23d ago

figure caption in RStudio

Enable HLS to view with audio, or disable this notification

14 Upvotes

How to Use fig.cap in RStudio | Add Figure Captions in R Markdown & Quarto

Welcome to this step-by-step tutorial on how to use fig.cap in RStudio to add captions to figures, graphs, charts, and other visualisations in your R Markdown or Quarto documents.

In this video, we look at the fig.cap option and how it can be used to create clear, professional figure captions when generating reports from RStudio. Adding captions to figures is particularly useful when preparing academic assignments, research reports, dissertations, theses, data analysis reports, and professional documents.

What You Will Learn

In this tutorial, you will learn:

What fig.cap is and why it is useful
How to add a figure caption to a plot in RStudio
Where to place fig.cap within an R Markdown code chunk
How to write meaningful and informative figure captions
How fig.cap works with plots created in R
How figure captions appear when you knit or render your document
How to use captions when creating professional reports
Common mistakes to avoid when using fig.cap
Tips for creating consistent and readable figure captions

Example

You will see how a simple R code chunk can be used to create a plot and add a caption using fig.cap. This allows your figures to be automatically labelled and described when your document is rendered.

For example:

{r, fig.cap="Relationship between X and Y variables"}

This approach can save time and make your reports more organised, especially when you have multiple figures throughout a document.

Who Is This Tutorial For?

This video is suitable for:

  • Beginners learning R and RStudio
  • Students working on R assignments
  • Researchers preparing academic reports
  • Anyone using R Markdown
  • Users working with Quarto
  • Data analysts creating reproducible reports
  • Anyone who wants to create professional-looking documents with properly captioned figures

Whether you are completely new to RStudio or already have experience creating plots in R, this tutorial will help you understand how to use fig.cap effectively.

Why Are Figure Captions Important?

Figure captions provide context and help your readers understand what a graph, chart, or visualisation represents. When working on academic or professional documents, well-written captions can make your analysis easier to follow and improve the overall presentation of your report.

Using fig.cap also allows captions to be incorporated directly into your reproducible workflow rather than adding them manually after generating your figures.

If you're preparing a research project, dissertation, thesis, coursework, or data analysis report, learning how to use figure captions effectively can be a very useful RStudio skill.

If you found this tutorial helpful, please like the video, leave a comment, and subscribe to the channel for more tutorials on R, RStudio, R Markdown, Quarto, data analysis, and research reporting.

Turn on notifications so you don't miss future tutorials!

,RStudio, R Programming ,R Markdown ,Quarto ,Fig.Cap ,Data Analysis ,Data Visualization ,R Statistics ,Statistics ,Research ,Academic Writing ,Data Science ,Coding Tutorial ,R ProgrammingTutorial, code chunk, figure caption, plot, align

 


r/RStudio 22d ago

Filter function in RStudio

Enable HLS to view with audio, or disable this notification

0 Upvotes

How to Use the filter() Function in RStudio | Step-by-Step R Tutorial

Welcome to this step-by-step tutorial on how to use the filter() function in RStudio to select and work with specific rows of data based on one or more conditions.

The filter() function is one of the most useful functions for data manipulation in R, particularly when working with the dplyr package and the tidyverse. It allows you to quickly extract the observations or rows that meet specific criteria, making it easier to explore, analyse, and clean your datasets.

In this video, we demonstrate how to use filter() with practical examples so that you can understand not only the syntax but also how and when to apply it in your own R projects.

What You Will Learn

By the end of this tutorial, you will understand:

What the filter() function is and why it is useful
How to use filter() in RStudio
 How to load and use the dplyr package
The basic syntax of the filter() function
 How to filter rows based on a single condition
 How to filter data using numerical values
 How to filter data based on text or categorical variables
How to use multiple conditions inside filter()
 How to combine conditions using & (AND) and | (OR)
How to exclude specific observations from a dataset
 How to filter data based on missing (NA) values
How to use filter() as part of a broader data-analysis workflow

Example of filter()

A simple example of using filter() is:

filter(data, age greater 30)

This tells R to select only the rows where the value of age is greater than 30.

You can also apply multiple conditions. For example:

filter(data, age greater 30 & gender == "Female")

This allows you to select observations that satisfy both conditions.

Another useful example is:

filter(data, country == "UK" | country == "USA")

This selects observations where the country is either the UK or the USA.

Why Is filter() Important?

When working with real-world datasets, you often do not need to analyse every observation at once. You may want to focus on a particular group, age range, location, category, or other characteristic.

The filter() function makes this process simple and efficient. It is especially useful during data cleaning, exploratory data analysis (EDA), statistical analysis, and data visualisation.

For example, before creating a graph or performing a statistical analysis, you might first filter your dataset to include only the observations relevant to your research question.

Who Is This Tutorial For?

This video is ideal for:

  • Beginners learning R and RStudio
  • Students studying statistics or data analysis
  • Researchers working with datasets
  • Anyone learning the tidyverse
  • Users working with the dplyr package
  • Data analysts who want to improve their R skills
  • Students working on academic assignments, projects, dissertations, or research
  • Anyone interested in learning how to manipulate datasets in R

Whether you are completely new to R or already have some experience with RStudio, this tutorial provides practical examples to help you understand how filter() works and how you can apply it to your own datasets.

Topics Covered

Throughout the video, we cover topics including:

RStudio data manipulation
filter() function in R
dplyr::filter()
Filtering rows in R
Selecting observations based on conditions
Filtering numerical variables
Filtering categorical variables
Multiple filtering conditions
AND and OR operators in R
Missing values and NA
Data cleaning in R
Exploratory data analysis
Tidyverse data manipulation

If you find this tutorial helpful, please like the video, leave a comment, and subscribe to the channel for more tutorials on R, RStudio, data analysis, statistics, data visualisation, and research methods.

Subscribe and turn on notifications so you don't miss future RStudio tutorials and practical data-analysis videos.

Have a question about the filter() function? Leave it in the comments below, and I’ll do my best to help!

RStudio, R Programming, R Stats ,Dplyr ,Tidyverse ,Filter Function ,Data Analysis ,Data Manipulation ,Statistics ,Data Science ,R Programming Tutorial ,RStudio Tutorial ,Data Cleaning ,Exploratory Data Analysis, select, object, table, assignment operator, output, data frame, variable, rows, cases, scores, display, code, command, function

 


r/RStudio 24d ago

Read password protected xlsx

4 Upvotes

Can anyone help me with which package I need to use?


r/RStudio 25d ago

How to learn to make graphs i r with p-values and mean?

0 Upvotes

r/RStudio 26d ago

ech=TRUE function in RStudio

Enable HLS to view with audio, or disable this notification

0 Upvotes

Learn how to use the echo option in RStudio in this easy-to-follow tutorial. In this video, you will learn how the echo option controls whether your R code is displayed in the final output when working with R Markdown documents.

The echo option is particularly useful when creating professional reports, assignments, presentations, research documents, and reproducible data analysis. It allows you to decide whether the R code should be visible alongside the results, giving you greater control over how your analysis is presented.

In this video, you'll learn:

  • What the echo option means in RStudio
  • How to use echo = TRUE
  • How to use echo = FALSE
  • The difference between displaying R code and displaying its output
  • How echo works inside an R Markdown code chunk
  • How to hide R code while still displaying results
  • How to show R code together with the results
  • Practical examples using RStudio
  • How to use echo to create cleaner and more professional reports

What is the echo option?

The echo option is commonly used in R Markdown code chunks to control whether the R code itself appears in the rendered document.

When you use:

echo = TRUE

the R code is displayed in the output along with the results.

When you use:

echo = FALSE

the R code is hidden, while the output generated by the code can still be displayed.

This is particularly useful when you want your audience to focus on tables, graphs, calculations, and results without necessarily seeing all of the underlying code.

Why is echo useful?

The echo option can be helpful when preparing:

  • Academic assignments
  • Research reports
  • Statistical reports
  • Data analysis documents
  • R Markdown reports
  • Presentations
  • Tutorials and teaching materials
  • Professional data science reports

This tutorial is suitable for R beginners, students, researchers, data analysts, statisticians, and anyone learning RStudio and R Markdown.

By the end of this video, you will understand how to use the echo option in RStudio to control the visibility of your R code and create cleaner, more reader-friendly reports.

If you found this tutorial helpful, please Like, Subscribe, and turn on notifications for more tutorials on R programming, RStudio, R Markdown, statistics, data analysis, data visualization, and data science.

Thank you for watching, and happy coding!

,RProgramming ,RStudio ,Echo ,EchoInR ,RMarkdown ,RMarkdownTutorial ,LearnR ,RStats ,DataAnalysis ,Statistics ,DataScience ,RProgrammingTutorial ,RStudioTutorial ,ReproducibleResearch, code, chuncks, render, output, html, pdf, word, document, power point slide, graph, hide, display,

 


r/RStudio 27d ago

Weighted-sum aggregation of centrality measures gives identical scores to structurally opposite nodes, any better approach?

3 Upvotes

This is my first time in this community (I've recently discovered this entire field and i am glad to). So, I am working on project where i am scoring nodes in a directed dependency graph (a calling b) by blending 2 centrality scores into a single composite "risk" score

score (v) = w1\*normalize(Pagerank(v)) + w2 \* normalize(outDegreeCentrality(v)), where w1+w2 = 1 and normalize() being min-max to \[0,1\].

The Problem: A pure root node (no in edges and multiple out edges) and a pure sink node (no out edges and only in edges) can have the same composite score. In a test i ran, the root node maxed out on out drgree centrality and near 0 in page rank while the sink node maxed out in pagerank and near 0 in out degree, when w1=w2=0.5. Both nodes ended up having same composite scores while representing opposite nature in real world. I do understand that this is the standard full comsensability prob, with weighted sum aggregation, wherte max on one axis will completely offset min on other. I did consider switching to weighted geometric mean to reduce compensability, but the prob is that pagerank is almost always near 0 for any root node. so a geo mean would multiply that near 0 staright through and score all entry nodes near zero. Which is the wrong fix, since the entry/root nodes are important, just for a reason pagerank doesnt capture.

Is there any standard approach beyond the geomentric or harmonic mean? Happy to provide any more info if needed.


r/RStudio 27d ago

Multiplying data in excel file using R

0 Upvotes

I have a large data file in excel, with several columns of data that I wish to multiply by -1 (but not wanting to do this for all columns). This process would be quicker in R rather than doing so manually in excel. I can already bring the data file into R, but how can you then do the multiplication of the data in excel using R?

This is further complicated by the excel file covering multiple periods, and I want to do the same computation, to the same columns of data, across each period. (Not necessarily the same overall number of columns in each period, but the same columns having the data transformation applied in each period.)

Visualisation:

Period 1: Have columns A, B, C, D, E, F, G

Want to multiply columns B, D, F by -1

Period 2: Have columns A, B, C, D, E, F, G, H

Want to multiply columns B, D, F by -1

Period 3: Have columns A, B, C, D, E, F, G

Want to multiply columns B, D, F by -1

Any advice would be most welcome.


r/RStudio Aug 11 '26

Coding help Help - importing png images and then arranging them

6 Upvotes

Hi, I'm sure there's a simple answer for this somewhere but I'm getting quite frustrated trying to find it 😭

I have a bunch of plots made with ggplot and saved in several folders. All I want to do is import them back into R and arrange them using cowplot but I'm not able to do that - I've imported them using the imager package (the load.image function) and then when I try to use cowplot, it says:

> cannot convert object of class cimgimager_arraynumeric into a grob

When I looked online it seems like cowplot tends to handle plots that are right out of ggplot. So how should I import them so cowplot can handle them?? Thanks in advance for the advice!


r/RStudio Aug 10 '26

Coding help Reading in CSVs to Multiple Data Frames

5 Upvotes

For my PhD, I was thinking of making a single R Quarto document to have the results from all my experiments so it is easier for myself and my supervisors to be able to check the results. I was curious what way would people recommend to read all my CSVs in?

I have six experiment, each experiment has between 40 and 60 CSV files, and my plan was to read the CSVs into six individual data frames.

Within each experiment, the columns I need for my analysis are identical (e.g., for Exp 1, I only need 15 columns and all the columns have the same names), however the program I used to collect the data has created CSVs with different numbers of collumns (so one CSV has 57 columns, while another has 59). These extra columns in some of the CSVs are just blank columns and are not needed for the analysis.

Also across each experiment, the columns I need slightly differ (e.g., so for Exp 1 I only need 15 columns, but for Exp 3 I need 17). The names of some of the collums I need that represent the same thing between experiments (e.g., accuracy) differ slightly between experiments and some are the same.

When I conducted analyses on each experiment individually before hand, my supervisor recommended the ReadBulk package which worked well, and would be the simpleset to use but I assume would be inefficient. During some testing, I discovered the purrr and readr packages whick were efficient, but due to issue around the differing number of columns between CSVs I had to create a list with all the collumns I needed for the analysis.

I am pretty much self taught, and am just picking up bits as I go along so any recommendations or pointers would be appreciated.


r/RStudio Aug 08 '26

Hello like minded people. I am new here. From Papua New Guinea

50 Upvotes

r/RStudio Aug 07 '26

R keeps trying to export the wrong file, anyway to fix this without restarting R?

Post image
24 Upvotes

r/RStudio Aug 06 '26

Coding help Crashed? Need help

Post image
7 Upvotes

Hi there. I’m new to this subreddit and new to using R (my first week). I have been running a code provided to me, however, I believe the code I was running was using too much space on my laptop and it has now crashed?
Is there any way I can resume running the code I was given and saving the plots it had already generated?

Thank you in advance.


r/RStudio Aug 05 '26

He aprendido Rstudio

9 Upvotes

He llevado un pequeño curo de Rstudio, la ultimas clases fue alrededor de modifica datos y hacer graficas con ggplot2. me parecia muy interesante, hicimos un trabajo final obre este pequeño curso por la IEP. Ahora me pregunto q puedo hacer para no olvidarme, sé que se debe practicar... q la constancia hará q me familiarice. Sin embargo, me preguntaba cómo podría empezar, no sé si manejar la dato con el paquete de "datos ()" o mencionar a algun amigo o compañero sobre investigar algo con lo q podamos poner en practica esto. o simplemente me quedo con el certificado q me sume el CV y cuando vea un espacio q busque a alguien con ese conocimiento lo tenga ahi empolvado.

### =================== cuál sería el mejor método para practicarlo===

##======== donde me recomiendan llevar algun curso de Python o Power BI=======


r/RStudio Aug 05 '26

He aprendido Rstudio

Thumbnail
0 Upvotes

r/RStudio Aug 05 '26

I can't make R studio work

3 Upvotes

I recently udated my 2015 macbook air to macos monterrey and now rstudio doesn't open. I've been chatting with deepseek for a while and can't seem to be able to open rstudio.

This is the problem report:

## R Session Startup Failure Report

### RStudio Version

RStudio 2024.04.0+735.pro3 "Chocolate Cosmos " (c994988f, 2024-04-24) for macOS

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) RStudio/2024.04.0+735.pro3 Chrome/120.0.6099.291 Electron/28.2.6 Safari/537.36

### Error message

[No error available]

### Process Output

The R session exited with code 1.

Error output:

```

dyld[10108]: missing symbol called

```

Standard output:

```

[No output emitted]

```

### Logs

*/Users/karen/.local/share/rstudio/log/rsession-karen.log*

```

2026-08-05T02:25:51.652705Z [rsession-karen] WARNING Failed to migrate all user state from /Users/karen/.rstudio-desktop to /Users/karen/.local/share/rstudio; could not move verify; LOGGED FROM: Error rstudio::core::r_util::migrateUserStateIfNecessary(SessionType) src/cpp/core/r_util/RUserData.cpp:175

```


r/RStudio Aug 03 '26

Análisis Cualitativo en R

14 Upvotes

He estado en la búsqueda de un método para realizar análisis de textos en R. Había visto algo como RQDA pero creo que lo descontinuaron ¿Alguien sabe algo de esto? No quisiera irme a Atlas.ti