#Loading Libraries
library(tidyr)
#Creating the dataframe
data <- data.frame(grp = c("A", "A", "B", "B"),
sex = c("F", "M", "F", "M"),
meanL = c(0.22, 0.47, 0.33, 0.55),
sdL = c(0.11, 0.33, 0.11, 0.31),
meanR = c(0.34, 0.57, 0.4, 0.65),
sdR = c(0.08, 0.33, 0.07, 0.27))
#Producing the result
new_data <- data %>%
gather("statistics", "value", -c("grp", "sex")) %>%
unite(sex.statistics, c("sex", "statistics"), sep = ".")
%>%
arrange(sex.statistics) %>%
spread(key = "sex.statistics", value = "value")
**If result does not match please comment
Generate the code to convert the following data frame to wide format. grpsexmeanL sdLmeanR SdR 1A...
Using R, generate the code to convert the following data frame to wide format. 1 AF 2 A M 3 BF 4 B M grp Sex neanl sd meanK sdlh 0.34 0.08 0.57 0.33 0.40 0.07 0.65 0.27 0.22 0.11 0.47 0.33 0.33 0.11 0.55 0.31 The result should look like the following display. grp F.meanL F.meanR F.sdL F.sdR M.meanL M.meanR M.sdL M.sdR 0.33 0.27 0.22 0.33 0.34 0.11 0.08 0.400.11 0.07 0.47 0.55 0.57 0.65 0.33 0.31 Hint: use...
Use Table 8.1, a computer, or a calculator to answer the following. Suppose a candidate for public office is favored by only 47% of the voters. If a sample survey randomly selects 2,500 voters, the percentage in the sample who favor the candidate can be thought of as a measurement from a normal curve with a mean of 47% and a standard deviation of 1%. Based on this information, how often (as a %) would such a survey show that...