课程: R for Data Science: Lunch Break Lessons

免费学习该课程!

今天就开通帐号,24,100 门业界名师课程任您挑!

list2df()

list2df()

- Lists NR can be tricky to deal with, in particular, getting the information out of the list in a predictable way. As of R 4.0.3, there is a new command called list2DF, which will convert a list to a data frame. Let's take a look at how to use that. In the example files, I've created actually three lists. In line three, I create a.list, and we can see that a.list is actually a collection of numbers, 3, 6, 9, 15, and 24. In line four, I create another list. And that is a list of logical values; true, false, true. Notice that another list is only three elements long, whereas a.list is five elements long. And I'll mention why this is important in just a moment. In line five, I'm going to create, I.am.a.list, and in to it, I'm going to put a list that combines a.list and another list. So, let's go ahead and run that. And let's take a look at I.am.a.list. And you can see that in the upper left hand window, we have a first…

内容