Skip to content

R code help to change table format

2 messages · peziza, Rui Barradas

#
I am trying to input an OTU table into EstimateS, however, the format of the
OTU table has to be changed to fit the format EstimateS will accept. In R, I
would like to change the format of the OTU table (from excel).  Here is what
I need to do, take Example 1 and create Example 2.  The problem is that I
have hundreds of OTUs, so I can't do this by hand (and I'd love to have a
code that I could use for different OTU tables). 
Thanks!

Example 1                                             Example 2
Species         Abundance                         Species
1                             3                                           1
2                             2                                           1
3                             2                                           1
4                             2                                           2
5                             4                                           2
                                                                            
3 
                                                                            
3
                                                                            
4
                                                                            
4
                                                                            
5                                                                             
5
                                                                            
5
                                                                            
5
                                                                            
5


--
View this message in context: http://r.789695.n4.nabble.com/R-code-help-to-change-table-format-tp4636022.html
Sent from the R help mailing list archive at Nabble.com.
#
Hello,

You should say what is the package you are using, EstimateS returns 
hundreds of hits. [ package sos, findFn() ].

As for the question, try


sp <- 1:5
ab <- c(3, 2, 2, 2, 4)
rep(sp, ab)


Hope this helps,

Rui Barradas

Em 10-07-2012 18:23, peziza escreveu: