R computing mean, median, variance from file with frequency distribution
问题 I am very new to R tool and my questions might be a little too obvious. I have a file that has the following data: Score Frequency 100 10 200 30 300 40 How do I read this file and compute the mean, median, variance and standard deviation? If this above table was just raw scores without any frequency information, then I can do this: x <- scan(file="scores.txt", what = integer()) median(x) and so on, but I am not able to understand how to do these computations when given a frequency table. 回答1: