100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
Summary Overview of the practicals of advanced data analysis $7.74   Add to cart

Summary

Summary Overview of the practicals of advanced data analysis

 28 views  0 purchase
  • Course
  • Institution

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

Preview 2 out of 14  pages

  • May 22, 2024
  • 14
  • 2023/2024
  • Summary
avatar-seller
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

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller AVL2. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $7.74. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

57727 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$7.74
  • (0)
  Add to cart