Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Summary

Summary practical Data-mining: Rsudio commands

Rating
-
Sold
3
Pages
7
Uploaded on
12-05-2025
Written in
2024/2025

This is a summary of the commands used in the practical lessons of the course Data-mining. The commands are retrieved from the instruction documents that were given on blackboard. I made an overview of each practical (1-5 and the take-home assignment) in table format. This gives an overview of the used commands with their explanation.

Show more Read less
Institution
Course

Content preview

Rstudio Commands
General
Command Meaning
Setwd(“C:/wherever your files are”) Change working directory
- Can be done like this:
o ‘session’ -> ‘set working directory’ ->
‘choose directory’
- Can also be done like this:
("C:/temp/whereverYourFilesAre")
Getwd() Get the current working directory

List.files() You get an overview of the files that are in your working
directory
Read.table() Read in a table
- File = “name” - Header: every column needs to have a header 
- Header = T or F manually fixed = TRUE
- Stringsasfactors = T or F - Stringsasfactor: columns with strings are read in as
- Dec = “,” or “.” factors = TRUE
- Na.string = “NA” or “?” - Dec: R needs to recognize it as a character and not
- Sep = “\t” as a calculation factor
- Na.string: missing value
- Sep: to tell R that only tabs (and not white space)
should be used to seperate columns
myData<-read.table() Assign table to an R-object
Write.table() Exporting an object to a pdf file
- X = name of data frame -
- File = “name”
- Quote = T or F
- Na = “NA” or “?”
- Dec = “,” or “.”
- Row.names = T or F
- Sep = “\t”
As.numeric() Convert data type
As.character()
As.factor ()
As.logical()
Summary() Summary of the dataset




1

, Practical 1
COMMAND MEANING
Class(myData) What kind of data structure
Str(myData) A more comprehensive overview of data
structure
Names(myData) Gives the headers
Dim(myData) Dimensions of a table
Nrow(myData) Number of rows and columns
Ncol(myData)
Length(myData$exam) Points of exam that are represented in a vector
 gives length of the vector
1:3 Vector of the numbers one to three
seq(from=1, to=3, by = 1)
c(1,2,3)
Levels(myData$gender) Levels of the factor
- Factor is a data structure for categorical
variables
myData$workshop <- Assign more descriptive names tot he factor
factor(myData$workshop, levels
levels = c(1,2,3) , labels =
c("R","SAS","SPSS") )
c(“John”,”Paul”,”George”, To make a character vector yourself
”Ringo”)
Ifelse() Make a new binary variable
- F.e. if a person passed the exam
[…] To select a part of a data structure
- [ ,j] - Columns
- [i, ] - Rows
Names()[3]<-“sex” Change the variable names
- [3]: row name you want to change
- <-“sex”: change to sex
Demo.matrix<- Construct a matrix
matrix(1:12,nrow=3,byrow - This is a 2 dimensional table
=T) - 1:12: because 12 observations
- Nrow:
- Byrow: added since by default, a matrix
is filled up by columns
Demo.matrix[3,1] If you want element on 3th row and 1st column
[,1:2] No index for the rows, which meas all rows are
selected  only a selection in the columns
Order() Order dataset according to …
O<-order(myData$exam) Sort entire data frame according to exam
+myData[o,] results  ASCENDING
O<-order(-myData$exam) Sort entire data frame according to exam
+myData[o,] results  DESCENDING
== Condition that the row/column need to fulfill in
order tob e selected
myX or myY Vecotr with X- or Y-values
Plot() Generate a plot
- Pch - Pch: argument to change a plot
- Itl character
- Col - Itl: argument to change the type of line
- Col: argument to change the colors
2

Written for

Institution
Study
Course

Document information

Uploaded on
May 12, 2025
Number of pages
7
Written in
2024/2025
Type
SUMMARY

Subjects

$4.22
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF


Also available in package deal

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
WillemsenAmber Universiteit Antwerpen
Follow You need to be logged in order to follow users or courses
Sold
19
Member since
2 year
Number of followers
0
Documents
47
Last sold
1 month ago

4.0

1 reviews

5
0
4
1
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions