Question: nchar() in R ### Question 6 (2 points) Some classification function in R require you to create separate objects for the covariates (independent variables) and



nchar() in R
### Question 6 (2 points) Some classification function in R require you to create separate objects for the covariates (independent variables) and the outcome (dependent variable). We will generate such objects here and separate the original data frame into training and testing data. We will use this random seed to ensure replicability of the results: {r} set.seed(1024) 1 Use the sample function to randomly sample 78% of the rows of gdat2. Inside this line of code, use the function nrow to extract the number of rows of gdat2 in any argument where it is needed. Paste your R code in BOX 1 [Format:244] '{r} 2 Generate a training dataset called traingdat by taking the records in rows index1 in dataframe gdat2 Paste your R code in BOX 2 [Format:a25] '{r} 3 Generate a testing dataset called testgdat by taking the complement records of index1 in dataframe gdat2 Paste your R code in BOX 3 [Format:a25] '{r} 4 Assign the Type column of training records to ytrain. ytrain will be used to store the dependent variable of the training dataset. Paste your R code in BOX 3 [Format:a25] '{r} 5 Assign the Type column of testing records to ytest. ytest will be used to store the dependent variable of the testing dataset. Paste your R code in BOX 2 [Format:a25] '{r}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
