For example, I have a data.frame with 40 rows and 20 columns and want to create 100 variables assigned to the name of the first row (a string):
row_name_1 <- df[1, ]
Is there a way to write a loop to do this for all 100 rows that would save the trouble of typing 40 lines of code?
I have tried using this code:
Phoneme_Features.list <- setNames(split(Phoneme_Features,
seq(nrow(Phoneme_Features))), rownames(Phoneme_Features))
The specific application for this would be to be able to search another data frame based on the values from the first data frame.
I have 2 data frames: Phoneme_Features and Phonetic_Dictionary (with 130,000 rows). Phoneme features is data frame where each row corresponds to around 20 phonetic features (e.g. F = consonant = 1, vowel = 0, labial = 1, dental = 1, etc). The Phonetic_Dictionary contains 130,000 words with the corresponding phonetic transcription (e.g. phonetics F AH0 N EH1 T IH0 K S) I want to use the new variables to replace the values of another data frame (stored as factors) so that I can search items in the second data frame by the features in the first data frame (Phoneme Features).
I would like to be able to search Phonetic_Dictionary and return every entry in which the first column contains a value of 1 for consonant. In other words, to be able to search the dictionary for all entries with an initial consonant, or final high vowel, or any other feature from the first data frame Phoneme_Features.