Aggregate and put in order dataframe
0
0
Entering edit mode
20 months ago
bhbh ▴ 30

Hello to everyone!

Can everyone halps me in R code to aggregate this dataframe abundance based on samples. Then to put in order dataframe based on abundance of "others", so if in the human sample "others" are more then human sample written bacteria, arrange it in the bottom of dataframe. And compute the same for other samples. This is the part of my dataframe:

samples         |   abundance           |     bacteria 

human           |   0.0010928962        |     Lactobacillus

human           |   0.0109282828        |     Bifidobacterium

human           |   0.0001366120        |     others

mice            |   0.0003005464        |     Lactobacillus

mice            |   0.000609838         |     Lactobacillus

mice            |   0.0004918033        |     others

rat             |   0.000309838         |     Bifidobacterium

human           |   0.0861612022        |     Bifidobacterium

rat             |   0.1801775956        |     Bifidobacterium

mice            |   0.1801775956        |     Bifidobacterium

rat             |   0.0011110220        |     Lactobacillus
R • 402 views
ADD COMMENT
1
Entering edit mode

You can for example use aggregate in base R, the data.table package or tidyverse/summarise for that problem.

ADD REPLY

Login before adding your answer.

Traffic: 2133 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6