I have data frame like below
Col1 Col2
White Orange
White Blue
Red White
On executing the below code,the items from both columns adds together. Please explain how the function works and how does the function know it should add row vice data instead of column.
paste_fun <- function(i){
(paste(as.character(i),collapse=" "))
}
and below code adds a new column to the data frame.My question is here 1 is entered which is row how is it considers it as a new column.
phone_data["new_col"] <- apply(phone_data(as.character[i]),1,paste_fun)