I heve got a list: lista=list() a=c(2,4,5,5,6) b=c(3,5,4,2) c=c(1,1,1,8) lista[[1]]=a lista[[2]]=b lista[[3]]=c
> lista [[1]] [1] 2 4 5 5 6 [[2]] [1] 3 5 4 2 [[3]] [1] 1 1 1 8 I would like to know where is number 5 (which line)? For example I have got a loop: k= vector(mode = "integer", length = 3) for(i in 1:3) { for (j in 1:length(lista[[i]])){ if ((lista[[i]][j])==5 k[i]= [i]) } } This loop is wrong but I would like to get in my vector k sth like this: k = lista[[1]][1], lista[[2]][1] ...or sth similar -- View this message in context: http://old.nabble.com/where-is-a-value-in-my-list-tp26359843p26359843.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.