Dataframe using R

Asked

Viewed 40 times

-1

I am with multiple files . xls and all have the same layout.

I want to leave them in a single dataframe, for example:

    df1
    nome idade sexo
    Fulano 22 M

    df2
    nome idade sexo
    Fulana 27 F

    dfJuncao
    nome idade sexo
    Fulana 27 F
    Fulano 22 M

2 answers

1

You can use the function rbind.

x <- data.frame("Nome" = "Fulano", "Idade" = 22, "Sexo" = "M")
y <- data.frame("Nome" = "Fulana", "Idade" = 27, "Sexo" = "F")
z <- rbind(x, y)

The exit must be something like:

    Nome Idade Sexo
1 Fulano    22    M
2 Fulana    27    F
  • I had a different return, z [,1] [,2] [,3] [,4] [,5] spreadsheets List,14 List,14 List,14 List,14 List,14

0


juncao <- data.frame(data.table::rbindlist(df1,df2 , fill = TRUE))

Browser other questions tagged

You are not signed in. Login or sign up in order to post.