1. Home
2. Training Library
3. Machine Learning
4. Courses
5. 9. Implicit Control Flow in R

# Interacting with the Clipboard in R

Developed with

## The course is part of this learning path

Fundamentals of R
11
3
1
1
Start course
Overview
Difficulty
Intermediate
Duration
31m
Students
44
Ratings
5/5
Description

### Learning Objectives

The objectives of this module are to provide you with an understanding of:

• How to bring in data from a file in R
• Interacting with the clipboard
• How to connect to files in R
• How to read from a file in R
• How to write to a file in R

### Intended Audience

Aimed at anyone who wishes to learn the R programming language.

### Prerequisites

No prior knowledge of R is assumed. You should already be familiar with basic programming concepts such as variables, scope, and functions. Experience of another scripting language such as Python or Perl would be an advantage. An understanding of mathematical concepts would be beneficial.

### Feedback

Transcript

We can interact with the clipboard in R using two functions. Firstly, the write clipboard, and secondly, the read clipboard. The write clipboard function will allows us to copy to the clipboard. Let us note that the clipboard can only contain character vectors. So, here is a piece of data that I've created, a matrix. If I was to write this out to the clipboard, I would need to use the as character function to convert data into something that is applicable inside the write clipboard. I can paste this using the edit paste command or control V. And it show you that I have created a character vector and store this in the clipboard. I can use the read clipboard function, read, clipboard, function, to paste this data into R. I can store this as clip and I can show you what I have brought in. I've brought in a character vector. In order to return it back to the original data matrix. I would need to then convert this back into the matrix using the matrix constructor. And as you can see on the screen, clip now equals data, even though it left the R studio session into the clipboard and returned back via the read clipboard function.

### Lectures

Kunal Haria
Data Science Trainer
Students
732
Labs
1
Courses
11
Learning Paths
1

Kunal has worked with data for most of his career, ranging from diffusion markov chain processes to migrating reporting platforms.

Kunal has helped clients with early stage engagement and formed multi week training programme curriculum.

Kunal has a passion for statistics and data; he has delivered training relating to Hypothesis Testing, Exploring Data, Machine Learning Algorithms, and the Theory of Visualisation.

Data Scientist at a credit management company; applied statistical analysis to distressed portfolios.

Business Data Analyst at an investment bank; project to overhaul the legacy reporting and analytics platform.

Statistician within the Government Statistical Service; quantitative analysis and publishing statistical findings of emerging levels of council tax data.

Structured Credit Product Control at an investment bank; developing, maintaining, and deploying a PnL platform for the CVA Hedging trading desk.