Hi,

I want to split a dataframe based on a grouping variable (in one column). The resulting new
dataframes should be stored in a new variable. I tried to split the dataframe using split() and
to store it using a FOR loop, but thats not working so far:

df <- data.frame(A=c("A1","A1","A2","A2"),B=seq(1:4))

Fsplit <- function(x,y){
	ls <- split(x,f=x$y)
	for (i in names(ls)){
		i <- ls$i
	}
}

Fsplit(df,A) #1st argument is dataframe to split, 2nd argument grouping variable
 

Any suggestions how to get that done?

Best regards
Johannes
	[[alternative HTML version deleted]]

