Question

In: Statistics and Probability

Please provide R-code for the following question: The second argument to `split` can be a list...

Please provide R-code for the following question:

The second argument to `split` can be a list of factors. The result is that all interactions (possible combinations) are used for the groups. In the `ToothGrowth` data set, growth (`len`) is measured for two types of supplements (`supp`) and three doses (`dose`). Split this `len` value into 6 groups.

Solutions

Expert Solution

Gol:

Total 6 combinations

len is split by supp and dose

Rcode:

ToothGrowth
attach(ToothGrowth)

Groups <- split(ToothGrowth$len, list(ToothGrowth$supp,ToothGrowth$dose))
Groups

Output:


Related Solutions

Use R programming to resolve this; can you please provide details on the code? A) Create...
Use R programming to resolve this; can you please provide details on the code? A) Create a dataframe – comparativeGenomeSize with the following vectors: > organism<-c("Human","Mouse","Fruit Fly", "Roundworm","Yeast") > genomeSizeBP<-c(3000000000,3000000000,135600000,97000000,12100000) > estGeneCount<-c(30000,30000,13061,19099,6034) B) Print the organism and estGeneCount for Human and fruitfly.(1) C) Add a column to this data frame calculating base pairs per gene. To do this, write a function “genedensity” that takes as arguments the genomesizeBP and estimatedGeneCount information, and calculates from this the estimated bp per gene....
***This problem must be done using R so please provide the R code used to find...
***This problem must be done using R so please provide the R code used to find the solution. I have provided the data in data-wtLoss.txt below the question. I will also give "thumbs-up for correct R code" Thanks in advance.*** The file “data-wtLoss.txt” contains data on weight loss and self esteem evaluation at three time points over a period of three months for 34 individuals who are randomly selected from a residential area. These individuals are randomly assigned to one...
***This problem must be done using R so please provide the R code used to find...
***This problem must be done using R so please provide the R code used to find the solution. I have provided the data in data-wtLoss.txt below the question. I will also give "thumbs-up for correct R code" Thanks in advance.*** The file “data-wtLoss.txt” contains data on weight loss and self esteem evaluation at three time points over a period of three months for 34 individuals who are randomly selected from a residential area. These individuals are randomly assigned to one...
Please provide R code along with explanations for the following exercise: Mortality rates per 100,000 from...
Please provide R code along with explanations for the following exercise: Mortality rates per 100,000 from male suicides for a number of age groups and a number of countries are given in the data suicides2 (R package “HSAUR2”). Use appropriate graphical methods to comment on what the graphic tells us about the data.
Please do this question in R and show the code too, please. The alternating current (AC)...
Please do this question in R and show the code too, please. The alternating current (AC) breakdown voltage of an insulating liquid indicates its dielectric strength. The article “Testing Practices for the AC Breakdown Voltage Testing of Insulation Liquids” (IEEE Electrical Insulation Magazine, 1995: 21–26) gave the accompanying sample observations on breakdown voltage (kV) of a particular circuit under certain conditions. 62 50 53 57 41 53 55 61 59 64 50 53 64 62 50 68 54 55 57...
The following R code sorts each vector in a list (lst) and stores the new list...
The following R code sorts each vector in a list (lst) and stores the new list in lst1. The code uses a for loop. lst <- list(c1=sample(1:10,10,replace=TRUE),c2=sample(1:20,10,replace=TRUE),c3=sample(1:10,8,replace=TRUE)) lst1 <- list() for(i in 1:length(lst)) { lst1[[i]] <- sort(lst[[i]]) } lst1 Which of the following options does the same thing as the given R code above ? lst <- list(c1=sample(1:10,10,replace=TRUE),c2=sample(1:20,10,replace=TRUE),c3=sample(1:10,8,replace=TRUE)) library(purrr) lst1 <- map(lst,sort) lst1 lst <- list(c1=sample(1:10,10,replace=TRUE),c2=sample(1:20,10,replace=TRUE),c3=sample(1:10,8,replace=TRUE)) library(purrr) lst1 <- map_dbl(lst,sort) lst1 None of the given options lst <- list(c1=sample(1:10,10,replace=TRUE),c2=sample(1:20,10,replace=TRUE),c3=sample(1:10,8,replace=TRUE)) library(purrr)...
*Please provide r studio file/code* Question: Test the equality of means of populations X,Y,Z using ANOVA:...
*Please provide r studio file/code* Question: Test the equality of means of populations X,Y,Z using ANOVA: set.seed(88) dta <- data.frame(v = c(2+2*rnorm(100), 3+3*rnorm(100), 4+4*rnorm(100)), id = rep(c("x","y","z"),c(100,100,100)))
*Please answer the following question using R code* 3. A bank wants to get new customers...
*Please answer the following question using R code* 3. A bank wants to get new customers for their credit card. They try two different approaches in their marketing campaign. The first promises a "cash back" reward, and the second promises low interest rates. A sample of 500 people is mailed the first brochure; of these, 125 get the credit card. A separate sample of 500 people is mailed the second brochure; 150 get the credit card. Are the two campaigns...
Please  provide your summary on Linear Regression preferably with some code sample in R.
Please  provide your summary on Linear Regression preferably with some code sample in R.
The Book of R (Question 20.2) Please answer using R code. Continue using the survey data...
The Book of R (Question 20.2) Please answer using R code. Continue using the survey data frame from the package MASS for the next few exercises. The survey data set has a variable named Exer , a factor with k = 3 levels describing the amount of physical exercise time each student gets: none, some, or frequent. Obtain a count of the number of students in each category and produce side-by-side boxplots of student height split by exercise. Assuming independence...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT