Basics Flashcards

1
Q

Open swirl package

A

library(“swirl”)

swirl()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

get current working directory

A

getwd()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

List all objects (i.e. variables) in your local workspace

A

ls()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

List all the files in your working directory

A

list.files()
or
dir()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Determine the arguments that a function can take

A

args(function)

e.g args(list.files)

Note that it’s not args(list.files())

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Create a new directory in the current working directory

A

dir.create(“newdir”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Set working directory to “testdir”

A

setwd(“testdir”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Create a file in current working directory

A

file.create(“newfile.R”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Check is file exists in current working directory

A

file.exists(“file.R”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Access information about the file “mytest.R”

A

file.info(“mytest.R”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Rename “mytest.R” as “mytest2.R”

A

file.rename(“mytest.R”, “mytest2.R”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Make a copy of “mytest2.R” called “mytest3.R”

A

file.copy(“mytest2.R”, “mytest3.R”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Construct the path to a file from components in a platform-independent way

A

file. path()

e. g. file.path(“testdir2”, “testdir3”) creates testdir2/testdir3

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Remove all variables from workspace

A

rm(list=ls())

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

see dataset dimensions

A

dim(dataset)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

see head of dataset

A

head(dataset)

17
Q

check the data type

A

class()