New to R. I want to run a SVM through several data.frames and automize the process. I got the data.frames in a list, but didn't know how to loop them to get every possible eventuality into my function. In short, i want to get rid of the copy&paste at the end of my code. Furthermore, is there a way to label my plot depending on the ingoing data of myfunction?
df1<-iris
df2<-iris
df2$Petal.Width = df2$Petal.Width+2
df3<-iris
df3$Petal.Width = df3$Petal.Width-2
df4<-iris
df4$Petal.Width = df4$Petal.Width-5
Werte <- list(df1,df2,df3,df4)
new_function <- function(V1, V2){
m2<-data.frame(V1$Petal.Width, V2$Petal.Width)
plot(m2)
}
new_function(V1=Werte[[1]],V2=Werte[[2]])
new_function(V1=Werte[[1]],V2=Werte[[3]])
new_function(V1=Werte[[1]],V2=Werte[[4]])
new_function(V1=Werte[[2]],V2=Werte[[3]])
new_function(V1=Werte[[2]],V2=Werte[[4]])
new_function(V1=Werte[[3]],V2=Werte[[4]])