Question
R programing question, message me for data set!! Provide a function, calledstackDataInList. This function only takes one argument,alist, which is a list ofdata.frame. The number
R programing question, message me for data set!!
Provide a function, calledstackDataInList. This function only takes one argument,alist, which is a list ofdata.frame. The number of elements in the list varies. In this function, you will stack the data frames on top of each other and return one single data frame. (Note, an easy solution will be usingdo.callfunction, which was not covered in this semester. Thus, do not use thedo.callfunction for this problem) To test this function, you will use thedatListobject. The result from thestackDataInListshould look like the ones below:
> load("final.RData") > datList [[1]] ID value 1 a 0.9101742 2 b 0.3841854 3 c 1.6821761 [[2]] ID value 1 d -0.6357365 2 e -0.4616447 [[3]] ID value 1 f 1.4322822 2 g -0.6506964 3 h -0.2073807 4 i -0.3928079 [[4]] ID value 1 j -0.3199929 2 k -0.2791133 3 l 0.4941883 > stackDataInList(datList[1]) ID value 1 a 0.9101742 2 b 0.3841854 3 c 1.6821761 > stackDataInList(datList[c(1,3,4)]) ID value 1 a 0.9101742 2 b 0.3841854 3 c 1.6821761
4 f 1.4322822
5 g -0.6506964 6 h -0.2073807 7 i -0.3928079 8 j -0.3199929 9 k -0.2791133 10 l 0.4941883 > stackDataInList(datList) ID value 1 a 0.9101742 2 b 0.3841854 3 c 1.6821761 4 d -0.6357365 5 e -0.4616447
6 f 1.4322822
7 g -0.6506964 8 h -0.2073807 9 i -0.3928079 10 j -0.3199929 11 k -0.2791133 12 l 0.4941883
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started