We may earn an affiliate commission when you visit our partners.
Take this course
Geoffrey Hubona, Ph.D.

Extra Fundamentals of R is an extension of the Udemy course Essential Fundamentals of R. Extra Fundamentals of R introduces additional topics of interest and relevance utilizing many specific R-scripted examples. These broad topics include:

(1) Details on using Base, GGPlot and Lattice graphics;

(2) An introduction to programming and simulation in R; and

(3) Character and string processing in R.

Read more

Extra Fundamentals of R is an extension of the Udemy course Essential Fundamentals of R. Extra Fundamentals of R introduces additional topics of interest and relevance utilizing many specific R-scripted examples. These broad topics include:

(1) Details on using Base, GGPlot and Lattice graphics;

(2) An introduction to programming and simulation in R; and

(3) Character and string processing in R.

All materials, scripts, slides, documentation and anything used or viewed in any one of the video lessons is provided with the course. The course is useful for both R-novices, as well as to intermediate R users. Rather than focus on specific and narrow R-supported skill sets, the course paints a broad canvas illustrating many specific examples in three domains that any R user would find useful. The course is a natural extension of the more basic Udemy course, Essential Fundamentals of R and is highly recommended for those students, as well as for other new students (and for practicing professionals) interested in the three domains enumerated above.

Base, GGplot and Lattice (or "trellis) graphics are the three principal graphics systems in R. They each operate under different "rules" and each present useful and often brilliant graphics displays. However, each of these three graphics systems are generally designed and used for different domains or applications.

There are many different programming and simulation scenarios that can be modeled with R. This course provides a good sense for some of the potential simulation applications through the presentation of 'down-to-earth,' practical domains or tasks that are supported. The examples are based on common and interesting 'real-world' tasks: (1) simulating a game of coin-tossing; (2) returning Top-Hats checked into a restaurant to their rightful owners; (3) collecting baseball cards and state quarters for profit: (4) validating whether so-called "streaky" behavior, such as have a string of good-hitting behavior in consecutive baseball games, is really unusual from a statistical point of view; (4) estimating the number of taxicabs in a newly-visited city; and (5) estimating arrival times for Sam and Annie at the Empire State Building ("Sleepless in Seattle").

R is likely best known for the ability to process numerical data, but R also has quite extensive capabilities to process non-quantitative text (or character) and string variables. R also has very good facilities for implementing powerful "regular expression" natural-language functions. An R user is bested served with an understanding of how these text (or character) and string processing capabilities "work."

Most sessions present "hands-on" material that make use of many extended examples of R functions, applications, and packages for a variety of common purposes. RStudio, a popular, open source Integrated Development Environment (IDE) for developing and using R applications, is utilized in the program, supplemented with R-based direct scripts (e.g. 'command-line prompts') when necessary.

Enroll now

What's inside

Learning objectives

  • Understand and use the base, lattice and ggplot graphics systems in r.
  • Be able to simulate many 'real-world' and practical "what-if" scenarios to determine likely outcomes.
  • Have a though understanding of, and ability to effectively use, the text and string variable processing capabilities in r.
  • Know how to use and implement r's text-based "regular expression" features and functions.

Syllabus

Students learn how to create the Base Graphics and they are contrasted with the GGPlot2 Graphics for the same images.
Introduction

One of the greatest strengths of the R language is surely the base graphics capabilities. Grid graphics, lattice, ggplot2, and the many R packages that interface with javascript D3graphics have added astounding capabilities, well beyond what can be achieved with base graphics alone. Nevertheless, the quick, one line, base graphics plots ( like plot() ) are a tremendous aid to data exploration, and are responsible for a good bit of the "flow" of an R session.

Read more

ggplot2 is a plotting system for R, based on the grammar of graphics, which tries to take the good parts of base and lattice graphics and none of the bad parts. It takes care of many of the fiddly details that make plotting a hassle (like drawing legends) as well as providing a powerful model of graphics that makes it easy to produce complex multi-layered graphics.

Graphical Parameters

You can customize many features of your graphs (fonts, colors, axes, titles) through graphic options.

One way is to specify these options in through the par( ) function. If you set parameter values here, the changes will be in effect for the rest of the session or until you change them again. The format ispar(optionname=value, optionname=value, ...)

# Set a graphical parameter using par()<br> <br> par() # view current settings<br> opar <- par() # make a copy of current settings<br> par(col.lab="red") # red x and y labels <br> hist(mtcars$mpg) # create a plot with these new settings <br> par(opar) # restore original settings

A second way to specify graphical parameters is by providing the optionname=value pairs directly to a high level plotting function. In this case, the options are only in effect for that specific graph.

# Set a graphical parameter within the plotting function <br> hist(mtcars$mpg, col.lab="red")

See the help for a specific high level plotting function (e.g. plot, hist, boxplot) to determine which graphical parameters can be set this way.

Boxplots

Boxplots can be created for individual variables or for variables by group. The format is boxplot(x, data=), where x is a formula and data= denotes the data frame providing the data. An example of aformula is y~group where a separate boxplot for numeric variable y is generated for each value of group. Add varwidth=TRUE to make boxplot widths proportional to the square root of the samples sizes. Addhorizontal=TRUE to reverse the axis orientation.

# Boxplot of MPG by Car Cylinders

boxplot(mpg~cyl,data=mtcars, main="Car Milage Data", xlab="Number of Cylinders", ylab="Miles Per Gallon")

Lattice Graphs

The lattice package, written by Deepayan Sarkar, attempts to improve on base R graphics by providing better defaults and the ability to easily display multivariate relationships. In particular, the package supports the creation of trellis graphs - graphs that display a variable or the relationship between variables, conditioned on one or more other variables.

The typical format is

<em>graph_type</em>(<em>formula</em>, data=)

where graph_type is selected from the listed below. formula specifies the variable(s) to display and any conditioning variables . For example ~x|A means display numeric variable x for each level of factor A.y~x | A*B means display the relationship between numeric variables y and x separately for every combination of factor A and B levels. ~x means display numeric variable x alone.

Simulation uses methods based on random numbers to simulate a process of interest on the computer. The goal is to learn important statistical and/or practical information about the process. In statistics, simulations can be used to create simulated data sets in order to study the accuracy of mathematical approximations and the effect of assumptions being violated. We will study properties of some quantities that can be calculated from a set of data which are a random draw from a population. Random numbers form a basic tool for any simulation study. Simulations require the ability to generate random numbers. On a computer, it is only possible to generate 'pseudo-random' numbers which for practical purposes behave as if they were drawn randomly.

Handling and processing text strings in R? Wait a second . . . you exclaim, R is not a scripting language like Perl, Python, or Ruby. Why would you want to use R for handling and processing text? Well, because sooner or later (I would say sooner than later) you will have to deal with some kind of string manipulation for your data analysis. So it's better to be prepared for such tasks and know how to perform them inside the R environment.

Another very useful function is cat() which allows us to concatenate objects and print them either on screen or to a file. Its usage has the following structure:

cat(..., file = "", sep = " ", fill = FALSE, labels = NULL, append = FALSE)

A regular expression (a.k.a. regex) is a special text string for describing a certain amount of text. This “certain amount of text” receives the formal name of pattern. Hence we say that a regular expression is a pattern that describes a set of strings.

There are two main aspects that we need to consider about regular expressions in R. One has to do with the functions designed for regex pattern matching. The other aspect has to do with the way regex patterns are expressed in R. In this section we are going to talk about the latter issue: the way R works with regular expressions. Some find more convenient to first cover the specificities of R around regex operations, before discussing the functions and how to interact with regex patterns.

To find exactly where the pattern is found in a given string, we can use the regexpr() function. This function returns more detailed information than grep() providing us: a) which elements of the text vector actually contain the regex pattern, and b) identifies the position of the substring that is matched by the regular expression pattern.

# some text

text = c("one word", "a sentence", "you and me", "three two one")

# default usage

regexpr("one", text)

The function gregexpr() does practically the same thing as regexpr(): identify where a pattern is within a string vector, by searching each element separately. The only difference is that gregexpr() has an output in the form of a list. In other words, gregexpr() returns a list of the same length as text, each element of which is of the same form as the return value for regexpr(), except that the starting positions of every (disjoint) match are given.

# some text

text = c("one word", "a sentence", "you and me", "three two one")

# pattern

pat = "one"

# default usage

gregexpr(pat, text)

grep() is perhaps the most basic functions that allows us to match a pattern in a string vector. The first argument in grep() is a regular expression that specifies the pattern to match. The second argument is a character vector with the text strings on which to search. The output is the indices of the elements of the text vector for which there is a match. If no matches are found, the output is an empty integer vector.

# some text

text = c("one word", "a sentence", "you and me", "three two one")

# pattern

pat = "one"

# default usage

grep(pat, text)

Traffic lights

Read about what's good
what should give you pause
and possible dealbreakers
Provides hands-on experience with R functions, applications, and packages, which reinforces learning and skill development for practical use cases
Extends the 'Essential Fundamentals of R' course, which allows learners to build upon their existing knowledge and skills in a structured manner
Covers base, ggplot2, and lattice graphics, which are essential for creating effective visualizations in various domains and applications
Explores programming and simulation in R with real-world examples, which helps learners apply their knowledge to practical problem-solving scenarios
Explores text and string processing capabilities in R, including regular expressions, which are valuable for data manipulation and analysis
Utilizes RStudio, a popular IDE, alongside R scripts, which prepares learners for professional R development workflows and environments

Save this course

Create your own learning path. Save this course to your list so you can find it easily later.
Save

Reviews summary

Extra r fundamentals: graphics, simulation, text

According to learners, this course is a largely positive extension of fundamental R concepts, diving into three key domains: Graphics (Base, Lattice, GGPlot), Simulation, and Character/String Processing with Regular Expressions. Students particularly appreciate the hands-on approach with many practical R-scripted examples and real-world scenarios, which they find highly beneficial for solidifying understanding. The graphics sections are often highlighted as clear and well-explained, though some find the distinction between different systems initially challenging. The simulation examples are frequently praised for being engaging and illustrating complex ideas effectively. While the course builds upon a prerequisite, many learners feel it stands well on its own, offering valuable skills for both novices and intermediate R users looking to expand their toolkit beyond the basics.
Suitable for stated novice/intermediate level.
"The course pace felt appropriate for someone with basic R knowledge looking to go a bit deeper."
"It covered complex topics but broke them down effectively, making it suitable for intermediate learners."
"As a novice, I found some parts challenging but manageable thanks to the clear explanations and examples."
All necessary files provided.
"Having all scripts, slides, and documentation readily available was a significant plus."
"The provided R-scripted examples made it easy to follow along and practice the code."
"Appreciated that everything used in the videos was included as supplementary material."
Valuable even without the prerequisite.
"Although an extension, I took this course without the first one and still found it incredibly valuable and understandable."
"I didn't take 'Essential Fundamentals' first, but I could follow along and gained a lot from this course."
"While it helps to have some R background, the material here is presented clearly enough to work as a standalone."
"Found this course useful even with prior R experience, didn't feel strictly necessary to have taken the first part."
Insights into character and string handling.
"The section on character and string processing, including regular expressions, was very useful for data cleaning tasks."
"Learned practical techniques for manipulating text data in R that I hadn't known before."
"Understanding regex in R from this course expanded my data analysis capabilities."
"The text processing examples were directly applicable to common data wrangling challenges."
Real-world simulations make concepts engaging.
"The simulation examples, especially the baseball and taxi problems, were creative and made probability accessible."
"Enjoyed the unique scenarios used for simulation; they kept me engaged and showed R's versatility."
"Using simulation for practical 'what-if' questions was a highlight and very applicable."
"The section on simulation helped me understand how to model real problems in R."
Detailed explanation of graphics systems.
"The instructor did a great job explaining the differences and uses of Base, Lattice, and GGPlot graphics."
"I appreciated the detailed coverage of the three major graphics systems in R."
"The graphics modules provided a solid foundation for creating various plots."
"Comparing Base and GGPlot side-by-side was a helpful way to learn their nuances."
Practical code examples enhance learning.
"Loved the hands-on coding and projects; they are the strongest part of the course for me."
"The number of practical examples throughout the course helps solidify my understanding of the concepts."
"Learning by doing with the provided scripts made complex topics much more manageable."
"The step-by-step coding demos were incredibly helpful in seeing R applied."

Activities

Be better prepared before your course. Deepen your understanding during and after it. Supplement your coursework and achieve mastery of the topics covered in Extra Fundamentals of R with these activities:
Review Basic R Syntax
Reinforce your understanding of fundamental R syntax, data structures, and control flow before diving into more advanced topics.
Browse courses on R Programming
Show steps
  • Review data types and operators in R.
  • Practice writing simple R scripts.
  • Complete online R tutorials.
Review 'R Graphics Cookbook'
Enhance your understanding of R graphics by exploring the 'R Graphics Cookbook' for practical examples and solutions.
View R Graphics Cookbook on Amazon
Show steps
  • Browse the table of contents to identify relevant chapters.
  • Work through examples related to base, ggplot2, and lattice graphics.
  • Adapt the examples to your own datasets.
Simulate Real-World Scenarios
Solidify your simulation skills by creating R scripts to model various real-world scenarios, such as queuing systems or financial markets.
Show steps
  • Choose a real-world scenario to simulate.
  • Develop an R script to model the scenario.
  • Run the simulation and analyze the results.
  • Refine the model based on the analysis.
Four other activities
Expand to see all activities and additional details
Show all seven activities
Create a Data Visualization Portfolio
Showcase your R graphics skills by creating a portfolio of data visualizations using base, ggplot2, and lattice.
Show steps
  • Select datasets to visualize.
  • Create visualizations using base, ggplot2, and lattice.
  • Write descriptions for each visualization.
  • Compile the visualizations into a portfolio.
Review 'Text Mining with R'
Deepen your understanding of text processing in R by exploring 'Text Mining with R' for advanced techniques and applications.
Show steps
  • Read chapters related to regular expressions and string manipulation.
  • Work through examples of text mining tasks.
  • Apply the techniques to your own text datasets.
Develop a Simulation Application
Apply your simulation knowledge by developing a complete R application that simulates a complex system and provides insights.
Show steps
  • Define the scope and objectives of the simulation application.
  • Design the architecture and user interface of the application.
  • Implement the simulation logic in R.
  • Test and debug the application thoroughly.
  • Document the application and its usage.
Contribute to an R Package
Enhance your R skills by contributing to an open-source R package related to graphics, simulation, or text processing.
Show steps
  • Identify an R package on GitHub that interests you.
  • Review the package's documentation and code.
  • Find an issue to address or a feature to add.
  • Submit a pull request with your changes.

Career center

Learners who complete Extra Fundamentals of R will develop knowledge and skills that may be useful to these careers:
Data Scientist
A data scientist analyzes complex data sets to extract meaningful insights and develop data-driven solutions. Extra Fundamentals of R is useful for a data scientist because it delves into the practical applications of R, a key tool in the field. The course enhances the ability to create insightful visualizations using Base, GGPlot, and Lattice graphics, aids in simulating real-world scenarios, and sharpens skills in processing text data using regular expressions. A prospective data scientist should take this course to build a foundation in using R for complex data analysis and visualization, going beyond the basics to explore simulations and text processing.
Statistical Programmer
A statistical programmer develops and maintains software for statistical analysis, often working with statisticians and researchers. Extra Fundamentals of R is useful for statistical programmers because it provides a deeper understanding of R's capabilities, particularly in graphics, simulation, and string processing. Knowing how to create detailed graphics with Base, GGPlot, and Lattice is a plus, and you can model various simulations, and manipulate text data effectively. A statistical programmer should take this course to broaden their expertise in R for statistical analysis and modeling.
Research Scientist
A research scientist designs and conducts experiments, analyzes data, and publishes findings in a specific field of study, often requiring advanced statistical skills. Extra Fundamentals of R is useful for research scientists because it delves into complex R topics like graphics, simulation, and string processing. With simulation skills you can model experiments, and also create visualizations using Base, GGPlot, and Lattice graphics. A research scientist should take this course to build proficiency in R for data analysis, modeling, and visualization, especially for those working with complex datasets and simulations.
Bioinformatician
A bioinformatician analyzes biological data using computational tools, often involving statistical analysis and data visualization. Extra Fundamentals of R helps bioinformaticians because it provides a deeper understanding of R's graphics and simulation capabilities. The course enhances the ability to create visualizations using Base, GGPlot, and Lattice graphics, and sharpens skills in processing and analyzing biological sequence data using R's string processing functions. A bioinformatician should take this course to enhance your proficiency in R for biological data analysis, especially with its focus on practical applications and real-world tasks relevant to bioinformatics.
Econometrician
An econometrician uses statistical methods to analyze economic data and test economic theories. Extra Fundamentals of R is useful because it provides a deeper understanding of R's capabilities in graphics, simulation, and string processing. The course deepens the ability to create detailed graphics with Base, GGPlot, and Lattice, model various economic simulations, and manipulate text data effectively. An econometrician should take this course to broaden your expertise in R for econometric analysis and modeling, especially with the course's focus on practical examples and real-world applications.
Statistician
A statistician collects, analyzes, and interprets numerical data to identify trends and relationships, often using statistical modeling. Extra Fundamentals of R may be useful because it provides a deeper understanding of R's capabilities, particularly in graphics, simulation, and string processing. You can learn to create detailed graphics with Base, GGPlot, and Lattice, model various simulations, and manipulate text data effectively. A statistician should consider this course to broaden their expertise in R for statistical analysis and modeling, especially with the course's focus on practical examples and real-world applications.
Research Associate
A research associate assists in conducting research, analyzing data, and preparing reports, often requiring proficiency in statistical software. Extra Fundamentals of R helps research associates because it delves into complex R topics that are useful for data analysis. You will enhance the ability to create data visualizations using Base, GGPlot, and Lattice graphics, and learn to effectively simulate real-world scenarios. A research associate should take this course to build proficiency in R for data analysis, modeling, and reporting.
Quantitative Analyst
A quantitative analyst, often working in the finance industry, develops and implements models to assess risk, price securities, and identify trading opportunities. Extra Fundamentals of R helps quantitative analysts because it expands your R skills in areas directly applicable to quantitative modeling and simulation. The course's focus on simulation aligns with the need to model financial scenarios, and the coverage of Base, GGPlot, and Lattice graphics enhances your ability to present findings visually. A quantitative analyst should consider this course to enhance your R proficiency, especially for simulations and data visualization, which are crucial in quantitative finance.
Data Journalist
A data journalist gathers, analyzes, and presents data-driven stories, often using data visualization techniques to communicate findings. Extra Fundamentals of R helps data journalists because it enhances the ability to use R for data analysis and visualization. The course expands skills in creating visualizations using Base, GGPlot, and Lattice graphics, which are essential for presenting data stories effectively. A data journalist should take this course to improve your ability to analyze and present complex data through compelling visualizations.
Actuary
An actuary assesses and manages financial risks, often for insurance companies, using statistical models and forecasting techniques. Extra Fundamentals of R may be useful because it builds on R's capabilities in simulation and data analysis. By learning about simulations in the course, you can model potential risks, and the coverage of Base, GGPlot, and Lattice graphics may enhance the ability to communicate findings. An actuary may consider this course to refine R skills for risk modeling and data visualization, particularly with its focus on practical examples and real-world applications.
Financial Analyst
A financial analyst provides guidance to businesses and individuals making investment decisions. Extra Fundamentals of R may be useful because it could improve financial modeling and data presentation skills. Learning about creating graphics with Base, GGPlot, and Lattice may allow one to communicate financial data effectively. A financial analyst may consider this course to improve R skills for financial analysis and visualization, particularly with the course's practical examples and real-world scenarios.
Market Research Analyst
A market research analyst studies market conditions to examine potential sales of a product or service. Extra Fundamentals of R may be useful for a market research analyst because it helps hone skills to use R for data analysis and visualization. The course introduces key skills such as creating visualizations using Base, GGPlot, and Lattice graphics. The course's focus on practical examples and real-world tasks may be pertinent to market research scenarios. Market research analysts may consider this course to improve their ability to analyze and present market data effectively using R.
Business Analyst
A business analyst identifies business needs and recommends solutions, often involving data analysis and process improvement. Extra Fundamentals of R may be useful for a business analyst because it expands your ability to use R for data analysis. The course's focus on visualization using Base, GGPlot, and Lattice graphics may help you present data insights. A business analyst can consider this course to broaden R skills for analyzing business data and presenting findings, especially with the course's hands-on approach.
Data Engineer
A data engineer designs, builds, and maintains data pipelines and infrastructure for data storage and analysis. Extra Fundamentals of R may be useful for a data engineer, especially if they need to perform data transformations or create data visualizations. The character and string processing in R may be useful. This course will also help if a data engineer needs to support data scientists who use R, and can help broaden their knowledge of the R ecosystem. Base, GGplot and Lattice graphics are also a plus.
Machine Learning Engineer
A machine learning engineer develops and implements machine learning algorithms and systems. Extra Fundamentals of R may not be directly used to build complex machine learning models, but it can be useful for data preprocessing, exploration, and visualization. The course may improve your ability to create visualizations using Base, GGPlot, and Lattice graphics. A machine learning engineer may find this course helpful to broaden R skills for data handling and visualization.

Reading list

We've selected two books that we think will supplement your learning. Use these to develop background knowledge, enrich your coursework, and gain a deeper understanding of the topics covered in Extra Fundamentals of R.
Provides a practical guide to creating various types of graphs using R. It covers base graphics, ggplot2, and lattice, aligning perfectly with the course's focus on these systems. It serves as a valuable reference for students looking to implement specific visualizations. The cookbook format allows for quick access to solutions for common graphing challenges.
Provides a comprehensive guide to text mining using R. It covers various techniques for processing and analyzing text data, including regular expressions. It is particularly useful for students looking to expand their knowledge of text and string manipulation in R. The book offers practical examples and code snippets that can be easily adapted to real-world projects.

Share

Help others find this course page by sharing it with your friends and followers:

Similar courses

Similar courses are unavailable at this time. Please try again later.
Our mission

OpenCourser helps millions of learners each year. People visit us to learn workspace skills, ace their exams, and nurture their curiosity.

Our extensive catalog contains over 50,000 courses and twice as many books. Browse by search, by topic, or even by career interests. We'll match you to the right resources quickly.

Find this site helpful? Tell a friend about us.

Affiliate disclosure

We're supported by our community of learners. When you purchase or subscribe to courses and programs or purchase books, we may earn a commission from our partners.

Your purchases help us maintain our catalog and keep our servers humming without ads.

Thank you for supporting OpenCourser.

© 2016 - 2025 OpenCourser