0

I am trying to create a data frame and have created list first before transferring into data frame. I did not use vector as I have the impression that I need to list out the individual levels stored in a variable? Using Titanic data. This is the scripts that I used. The result show 6 rows of data when i run head(df2)? I manage to view full data set when I run head(m2). Which part of the scripts that I need to change?

enter image description here

m2 <- list(Name = lum$Name,Age = lum$Age,Sex = lum$Sex )

head(m2)

df2 <- data.frame(m2$Name,m2$Age,m2$Sex,stringsAsFactors = FALSE)

head(df2)

Thank you very much!

Sotos
  • 51,121
  • 6
  • 32
  • 66
user149635
  • 65
  • 2
  • 12

1 Answers1

2

Showing only 6 rows is the standard behavior of head().

If you want to see a specific number of rows, you can pass a number as a parameter head(df, 15), for example.

If you want to see the full dataset in your console, use print(df).

Best,

Colin

Colin FAY
  • 4,849
  • 1
  • 12
  • 29