Finding Mean and Std Dev -Export data from excel to R

May I know, how to find mean and standard deviations by year and region, for the table of DealSatis, as below:

Excel data as below:

I tried using the R code but could not find mean and standard deviation.

# tried to read only scale and count column but could not write
Ssurvey <- read_excel("Q3.xlsx", range ="DealSatis!L4:M9")  # i am looking for better way to read this table range

#as in excel: I find mean using this formula : (Scale*Count)/Count

#In finding mean in R, I could not find 

total_NA_2010 <- (DSsurvey$Scale*DSsurvey$Count/DSsurvey$Count)
Warning messages:
1: Unknown or uninitialised column: 'Scale'. 
2: Unknown or uninitialised column: 'Count'. 
3: Unknown or uninitialised column: 'Count'. 
> mean(DSsurvey$Scale)
[1] NA
Warning messages:
1: Unknown or uninitialised column: 'Scale'. 
2: In mean.default(DSsurvey$Scale) :
  argument is not numeric or logical: returning NA
#I got error in finding standard deviation too 
Error in SD(DSsurvey$Scale:DSsurvey$Count, na.ram = TRUE) : 
  could not find function "SD

It looks like you have a typo here. I think you mean to create the data frame as DSsurvey, since that's what you reference below.

Also, the functions for standard deviation is sd (lowercase), not SD :wink: