Hello,
I create a list animalList by using list() function. When displaying the list, there're unequal spaces among items in the list. How can I make them appear the same in size? For example: I have the following script
Thanks,
Hello,
I create a list animalList by using list() function. When displaying the list, there're unequal spaces among items in the list. How can I make them appear the same in size? For example: I have the following script
Thanks,
animalList <- list(c("Chicken","Dog","Cat","Monkey","Pig","Ant"))
animalList
#> [[1]]
#> [1] "Chicken" "Dog" "Cat" "Monkey" "Pig" "Ant"
str(animalList)
#> List of 1
#> $ : chr [1:6] "Chicken" "Dog" "Cat" "Monkey" ...
animalList <- list("Chicken","Dog","Cat","Monkey","Pig","Ant")
str(animalList)
#> List of 6
#> $ : chr "Chicken"
#> $ : chr "Dog"
#> $ : chr "Cat"
#> $ : chr "Monkey"
#> $ : chr "Pig"
#> $ : chr "Ant"
For future questions: See the FAQ: How to do a minimal reproducible example reprex
for beginners
This appears to be just how the list prints in R. It is not intended to be used in a paper or presentation.
dat2 <- tibble(aa = c("Chicken", "Dog", "Cat", "Monkey", "Pig", "Ant"))
dat2
will give you a totally different print-out.
What are you trying to achieve with the list? Typically an R output is formatted in some way for presentation.
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.