I am trying to capture the first string from a list using an explicit loop, as shown in the following code:
for (loop.temp in (1:nrow(temp)))
{temp[loop.temp,"drug_name_mod"] <- unlist(strsplit(temp[loop.temp,"drug_name"]," "))[1]
print(paste(loop.temp,nrow(temp),sep="/"))
flush.console()
}
But I think it is not very efficient, anyway of improving it? Thanks!