Functions and Loops in R (Example on evaluation of

Functions and Loops in R (Example on evaluation of
1 / 1
Functions and Loops in R (Example on evaluation of - slide 1 of 14 Functions and Loops in R (Example on evaluation of - slide 2 of 14 Functions and Loops in R (Example on evaluation of - slide 3 of 14 Functions and Loops in R (Example on evaluation of - slide 4 of 14 Functions and Loops in R (Example on evaluation of - slide 5 of 14 Functions and Loops in R (Example on evaluation of - slide 6 of 14 Functions and Loops in R (Example on evaluation of - slide 7 of 14 Functions and Loops in R (Example on evaluation of - slide 8 of 14 Functions and Loops in R (Example on evaluation of - slide 9 of 14 Functions and Loops in R (Example on evaluation of - slide 10 of 14 Functions and Loops in R (Example on evaluation of - slide 11 of 14 Functions and Loops in R (Example on evaluation of - slide 12 of 14 Functions and Loops in R (Example on evaluation of - slide 13 of 14 Functions and Loops in R (Example on evaluation of - slide 14 of 14
Functions and Loops in R (Example on evaluation of clusters) Arko Barman COSC 6335 Data Mining University of Houston Commonly used loop structures in R - for while apply repeat Other important keywords break next (similar to continue in

Related Topics

Download this presentation From Below

"Functions and Loops in R (Example on evaluation of" is the property of its rightful owner. Permission is granted to download and print the materials on this website for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.

Presentation Transcript

01
Functions and Loops in R (Example on evaluation of clusters) Arko Barman
COSC 6335 Data Mining
University of Houston<br>
02
Commonly used loop structures in R -
for
while
apply
repeat

Other important keywords –
break
next (similar to continue in C/C++)
stop Loops<br>
03
Syntax:
for(variable in sequence) {     statements }

Example 1:
mydf <- iris
myve <- NULL # Creates empty storage container
for(i in seq(along=mydf[,1])) {
myve <- c(myve, mean(as.numeric(mydf[i, 1:3])))
}
myve for loop<br>