1. Simple ifelse statement Create the data frame ‘student.df’ with the data provided below: Use a simple ‘ifelse’ statement to add a new column ‘male.teen’ to the data frame. This is a boolean column, indicating T if the observation is a male younger than 20 years. 2. Double for loop Write a double for loop which prints
R Exercises – 61-70 – R String Manipulation | Working with ‘gsub’ and ‘regex’ | Regular Expressions in R
Required packages and datasets 1. ‘College’ dataset – Colleges in Texas a. Get familiar with the ‘college’ dataset and its row names. b. Get a vector with the college names (‘college.names’) which you will need in the further steps of this and the next exercises. c. Get a vector (‘texas.college’) which contains all colleges with ‘Texas’ in its name.
Required packages for the excises 1. ‘College’ dataset – Basic row manipulations a. Transform ‘College’ from ‘ISLR’ to data.table. Make sure to keep the University identifier. We will use this new data.table called ‘dtcollege’ throughout this block of exercises. b. Get familiar with the dataset and its variables. c. Extract rows 40 to 60 as a new data.table (‘mysubset’).
1. Simple time series plot on ‘non-ts’ data a. Get 200 random numbers and call the object ‘mydata’. Let’s set a seed of 14 for reproducibility. b. Get a time series plot without converting to class ‘ts’. c. Add ablines to the chart to indicate the horizontal boundaries of 0 and 1. 2. Working with ‘xts’ a. Get and load
1. Working with the ‘mtcars’ dataset a. Get a histogram of the ‘mpg’ values of ‘mtcars’. Which bin contains the most observations? b. Are there more automatic (0) or manual (1) transmission-type cars in the dataset? Hint: ‘mtcars’ has 32 observations. c. Get a scatter plot of ‘hp’ vs ‘weight’. 2. Working with the ‘iris’ dataset
1. Function ‘apply’ on a simple matrix: a. Get the following matrix of 5 rows and call it ‘mymatrix’ b. Get the mean of each row c. Get the mean of each column d. Sort the columns in ascending order 2. Using ‘lapply’ on a data.frame ‘mtcars’ a. Use three ‘apply’ family functions to get the minimum values
Data Pre-Processing is the very first step in data analytics. You cannot escape it, it is too important. Unfortunately this topic is widely overlooked and information is hard to find. With this course I will change this! Data Pre-Processing as taught in this course has the following steps: 1. Data Import: this might sound trivial
1. a. Write a function “myfun” of x to the power of its index position (x, x^2, x^3, …) b. Test the function with an x of 1:10 c. Enlarge the function “myfun” with a division through the index position (x, x^2 / 2, x^3 /3, …) 2. a. Write a simple moving average
Data.frames (df) are the most common type of data you will find in R. If you import your dataset from Excel you will likely import it as a df. Of course this makes perfect sense because most of the data fits into this object class. Columns for the variables and rows for the observations –
Next to RStudio there is another very helpful R GUI – graphical user interface – called R Commander. In some scenarios, this GUI can really make your job much easier. Installation In order to get it on your machine you would at first install the package Rcmdr. Basically the whole GUI can be had by
Explore the convincing power of Tableau 9! Do you want to create overwhelming plots? Do you want to show your data crystal clear? Do you want your data to be understood by everyone? Do you want a versatile graphics toolbox? Do you want powerful formatting skills? Do you want to add R functionality to Tableau?
Time series analysis and forecasting is one of the key fields in statistical programming. It allows you to see patterns in time series data model this data finally make forecasts based on those models Due to modern technology the amount of available data grows substantially from day to day. Successful companies know that. They also
Practicing is a crucial part of learning a new language. Statistical languages like R are no exception of that rule. Many of my students think the same and would love to see more exercises. Therefore, I decided to write an R exercise sheet for beginners and blog it over here. These R exercises are an
Learn Excel 2016 from scratch or improve your skills and learn new tricks to speed up your work Do you want to make your work with Excel faster, more efficient and fun? Do you want to learn more about hidden tricks that make Excel easier to use? Are you looking for a structured way to
This is a guest post from DataJoy. DataJoy is a zero-installation online R editor ideal for getting started with Data Analysis. Pivot tables are a powerful tool for summarizing long tables of data where the rows share common attributes. For example, if you had a table of student exam scores with name, sex, year group and
Learn how to plan and improve your data science and machine learning based career Are you thinking about working in data science? Do you already work in a data analytics job, but you do not know how to get your career to the next level? Are you interested in getting add-on credentials in data science,
As most of you surely know, R has many exercise datasets already installed. That simply means, as soon as you installed R Base, which includes the library ‘datasets’, you have ample opportunity to explore R with real world data frames. For me as course content creator those datasets help tremendously, because with them I can
In my consulting work, during research or while answering student questions, the topic of machine learning pops up constantly. Unfortunately, there are some misconceptions concerning this topic. In this article I am going to explain what machine learning actually is and how you can benefit from those tools. Machine learning is a collection of modern
See things in your data that no one else can see – and make the right decisions! Due to modern technology and the internet, the amount of available data grows substantially from day to day. Successful companies know that. And they also know that seeing the patterns in the data gives them an edge on
Do you plan on trading biotech stocks? Do you want to learn how to identify promising healthcare stocks? Do you want to professionally read a company pipeline? Do you want to know where to get all the relevant info for biotech/healthcare company evaluation? Do you want to tailor your investment strategy towards a healthcare portfolio?
This video is from our R Basics course. If you want to have a structured video curse (+2hrs) on the basics of R, click here to get it for free without limitations. lifetime access instructor support +20.000 students learning together Also check out this article on datasets.
Do you want to start a career with R? Do you want to benefit from your R studies? I am getting more and more requests on how to utilize your newly acquired R skills on the job market. In this article I will share my thoughts and research on this topic. I have a science
In this video you will learn how to find, install and remove packages in R.
When it comes to analytics software and languages you will sooner or later have to decide which one you will use. There are dozens of tools available, some more in demand than others. As a data scientist you will find R and Python as popular open source statistical packages. On the proprietary side, you will find products like SPSS, Matlab, Stata or SAS. Since it