Skip to content
Back to formatted view

Raw Message

Message-ID: <745EC74504A3844EB2FB5F73DFAC3D3652DC9861@exmb02.iva.local>
Date: 2011-10-19T09:00:53Z
From: Jonas Fransson
Subject: listing all occurrences in a vector

Dear all,

I have a dataframe with two columns, where NUMBER is the number of occurrences of DEPTH: 

  DEPTH NUMBER
1     2      1
2     3      2
3     2      3
4     5      1

> a<-data.frame(c(2,3,2,5),c(1,2,3,1))
> colnames(a)=c("DEPTH","NUMBER")

I want a column or a vector where all the DEPTHs are listed: 2, 3, 3, 2, 2, 2, 5 (NUMBER=1 in all cases). 

Is there any simple solution to the problem?

Thanks,
Jonas


Jonas Fransson
Ph.D.stud.
?
IVA /?Det Informationsvidenskabelige Akademi
Royal School of Library and Information Science
Birketinget 6 
DK-2300 Copenhagen S
T +45 32 58 60 66
D +45 32 34 15 10
www.iva.dk/jf?