Hi everyone, I am currently working with a very large data set. It is data collected a few times a day, so there are repeated titles in the data set. I want to assign an id number to each different title and enter this information in a directory that I can access whenever I am working with the data. An example of a data I am workin with follows: 1 title A 2 title C 3 title B 1 title A 2 title B 3 title C 1 title D 2 title A 3 title C 1 title B 2 title A 3 title C What I have tried thus far is for loops. r<-matrix(x[,1]) t<-matrix(x[,2]) for(i in 1:length(t)) { for(k in 1:length(r)) { z = matrix(c(i,t)) A = "Article A" for(j in 1:length(z)){ if(B=="Article A") else{enter article in z} } } This is of course giving me a lot of errors. I just have no idea where to go with this. Does anyone have any ideas on where I can go from here to create my directory? I appreciate all your help. Thank you in advance. -- View this message in context: http://www.nabble.com/Creating-a-directory-for-my-data-tp22448335p22448335.html Sent from the R help mailing list archive at Nabble.com.
Hmmm, in fact I do not understand what you are going to do. Can you tell us what the result of your code should look like? Uwe Ligges miya wrote:> Hi everyone, > I am currently working with a very large data set. It is data collected a > few times a day, so there are repeated titles in the data set. I want to > assign an id number to each different title and enter this information in a > directory that I can access whenever I am working with the data. > > An example of a data I am workin with follows: > > 1 title A > 2 title C > 3 title B > 1 title A > 2 title B > 3 title C > 1 title D > 2 title A > 3 title C > 1 title B > 2 title A > 3 title C > > What I have tried thus far is for loops. > > r<-matrix(x[,1]) > t<-matrix(x[,2]) > for(i in 1:length(t)) { > for(k in 1:length(r)) { > z = matrix(c(i,t)) > A = "Article A" > for(j in 1:length(z)){ > if(B=="Article A") > > else{enter article in z} > } > } > > This is of course giving me a lot of errors. I just have no idea where to go > with this. Does anyone have any ideas on where I can go from here to create > my directory? > I appreciate all your help. > Thank you in advance. >
Sorry, I did forget to add what it is I want to get. I wish to get a result like the following: Legend: ID Title 1 Article A 2 Article B 3 Article C 4 Article D ... i Article "N" -- View this message in context: http://www.nabble.com/Creating-a-directory-for-my-data-tp22448335p22455535.html Sent from the R help mailing list archive at Nabble.com.