Problem the proportion of the students of that university

Problem 1


We Will Write a Custom Essay Specifically
For You For Only $13.90/page!

order now



By R: > mean(dataset$money)




=    200+200+100+125+80+50+0+95+100+20+150+140+80+50+35+0+0+110+125+150+160


=    93.810



> summary (dataset)


 year       money            shopping

 F: 10  Min.   :  0.00      NO      : 9 

 S: 11  1st Qu.: 50.00      SOMEWHAT: 3 

           Median : 100.00     YES     : 9 

        Mean   : 93.81              

        3rd Qu.: 140.00              

        Max.   : 200.00

















a)      The command should be: table(dataset$shopping)

This is because shopping is not a quantitative variable and it is impossible to calculate the mean of a categorical variable.

b)      The command should be: summary(dataset)

This is because R is case sensitive so DATASET is different from dataset.

c)      The command should be: barplot(table(dataset$shopping),

                                                      main=”Responses to the question, Do you like to shop?”,

                                                      xlab=”shopping preference”, ylab=”Number of students”)

This is because the variable is categorical, we can only tally it up, hence we are using the table function. Other than that, (dataset$shopping) must be written exactly like that because we already put the variable in data table to make our task easier.





Problem 2


To get the random numbers by R Studio, we can use the sample function. In this situation, the council president wants 30 randomly chosen signatures to determine the proportion of the students of that university that signed the petition. By using the dollar sign ($) method, we will type the data set we want to use along with the name of the variable. Save the data that contain the 500 signatures with their names (one of the variables) as ‘SIGNATURE’ in .cvs file. Next, type in the sample function in R Studio:

sample(SIGNATURE$name, 30)

Run the function and we can name the result. For example: