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 Overview of the practicals of advanced data analysis

Rating
-
Sold
1
Pages
14
Uploaded on
22-05-2024
Written in
2023/2024

Overview of the most important things in the practicals of advanced data analysis including the take home assignment.

Institution
Course

Content preview

Input R-studio
Practicum 1
nrow(myData)
ncol(myData)
dim(myData)

A vector is the elementary structure for data handling in R. It is a set of
simple elements, all being objects of the same class.
1:3
seq(from=1, to=3, by = 1)
c(1,2,3)

A factor is a data structure for categorical variables. The levels of the
factor can be extracted by
Levels(myData$gender)

You can assign more descriptive names to the factor levels in the
following way.
myData$workshop <- factor(myData$workshop, levels = c(1,2,3) , labels
= c("R","SAS","SPSS") )

4 main types (or classes) of variables
- Numeric: integer or floating point
- Character: text string (names)
• (for example: myData$ID <- as.character(myData$ID)
• Make a character vector yourself:
• c(“john”,”paul”,”george”)
• as.character
- Factor:
• Categorical variable with limited number of levels
• Ordered or nat
- Logical: TRUE/FALSE

Exporting a modified table: write.table(myData, file =
"myFirstOutputFile")

Make a matrix: demo.matrix<-matrix(1:12, nrow =3,byrow=T)
Example :
genetics <-matrix(c(230,198,72,249,207,44),nrow=2,byrow=T)
colnames(genetics) <- c("AA","AG","GG")
rownames(genetics) <- c("Case","Control")

to make:
AA AG GG
Case 230 198 72
Control 249 207 44


1

, Sorting data :
 order(myData$exam)
 o <- order(myData$exam)
myData[o,]

Conditional selection: selection related to indexing, but instead of a
row/column number we now put a condition that the row/column elements
need to fulfill to be selected
 myData[myData$workshop == "SPSS" & myData$sex == "female" ,
]
 select <- myData$workshop == "SPSS"
select
myData[select,]
-> the comma means that we are selecting a subset of rows, while all the
columns are included

 The subset function is doing almost the same but observations
with missing values are omitted (weggelaten): subset(myData,
exam>10)

Splitting, stacking and merging files
Stacking: rbind() function
 myData.male <- myData[myData$sex == "male",]
myData.female <- myData[myData$sex == "female" ,]
rbind(myData.male,myData.female)

Split: split()
 split(myData, myData$sex)
 when you don’t only want to see the splitted data, but you also want
your data to be splitted in your library
o myData.split<-split(myData,myData$sex)


Plotting in R
Pch = plotting characters



Lty = line type
(0=blank, 1=solid (default), 2=dashed, 3=dotted, 4=dotdash,
5=longdash, 6=twodash)

When you want to apply a color to the data for example a different color
for different species:
plot(Petal.Length~Sepal.Length,data=irisData,col=irisData$Species)

Tapply function can be used if you want to have a visual representation
of the ‘mean…’
Used in combination with barplot function
2

Written for

Institution
Study
Course

Document information

Uploaded on
May 22, 2024
Number of pages
14
Written in
2023/2024
Type
SUMMARY

Subjects

$9.26
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

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.
AVL2 Universiteit Antwerpen
Follow You need to be logged in order to follow users or courses
Sold
93
Member since
4 year
Number of followers
49
Documents
90
Last sold
2 months ago

4.0

5 reviews

5
2
4
1
3
2
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