Key Skills for Success

Learn about the course prerequisites and try some exercises to check your abilities.

Natural language processing requires knowledge of a programming language as well as an understanding of NLP concepts.

Before you begin this course, assess your R programming skills. If you can solve these challenges, you’ll have no trouble with the programming in this course. Otherwise, with a bit of extra effort, you’ll be well on your way to mastering it.

Code for the square of x

Defining functions is an essential skill in R programming. Please provide the necessary code to return the square of x.

square <- function(x)

Subset a matrix

R provides several ways to slice data. Are you familiar with them?

  • Your function should accept a matrix named emails_this_week.

  • The first column of emails_this_week contains random integers between one and seven, signifying the days of the week. Sunday is one, Monday is two, Tuesday is three, and so on.

  • The second column of emails_this_week is the number of emails received during that day.

Write a function named myEmails to add the number of emails received on weekdays, which is defined as days with integers equaling two through five.

myEmails <- function(emails_this_week){}

These examples cover commonly used skills in natural language processing. It’s important to know how to create a function and equally important to understand how to subset a matrix. When you’ve passed both exercises, you can be confident that you’re capable of understanding the code required for natural language processing with R.