Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Dataframe from vector values

I have vectors such as

porcentages1<-c(19.63081,29.87414,32.12955,18.36550)
porcentages2<-c(19.58452,29.94807,32.19970,18.26772)

Where each index of the vector represents a percentage of an item (for example the first index represents the percentage of dogs and the second the percentage of cats)

I want to create a data frame such as
this one

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Any ideas on how?

>Solution :

One way could be:

library(dplyr)
library(tibble)

as_tibble(rbind(porcentages1, porcentages2)) %>% 
  rename(Dogs = V1, Cats = V2, Sharks = V3, Turtles = V4)
  Dogs  Cats Sharks Turtles
  <dbl> <dbl>  <dbl>   <dbl>
1  19.6  29.9   32.1    18.4
2  19.6  29.9   32.2    18.3
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading