New to R. I am trying to create a vector from each row in a dataframe, and name the vector after the position in the dataframe. Sample data:
a <- read.table(text='keyword1 keyword2
1 "hello" "goodbye"
2 "foo" "y"', header=TRUE)
each row should become a character string like:
name1 <- c("hello", "goodbye")
name2 <- c("foo", "y")
I'm thinking something like this, but its not quite there:
for (i in 1:length(a)) {
name <- a[i,1];
names <- c(name, a[i,2]);
Any help would be appreciated!