I would like to better visualize a set of data I created in R using the barplot() function. However, I am unsure how to go about this procedure based on 2 columns in a data frame.
name of my data frame: myData
Below is the contents of my data frame:
States Churn
1 AK 3
2 AL 8
3 AR 11
4 AZ 4
5 CA 9
6 CO 9
7 CT 12
8 DC 5
9 DE 9
10 FL 8
11 GA 8
12 HI 3
13 IA 3
14 ID 9
15 IL 5
16 IN 9
17 KS 13
18 KY 8
19 LA 4
20 MA 11
21 MD 17
22 ME 13
23 MI 16
24 MN 15
25 MO 7
26 MS 14
27 MT 14
28 NC 11
29 ND 6
30 NE 5
31 NH 9
32 NJ 18
33 NM 6
34 NV 14
35 NY 15
36 OH 10
37 OK 9
38 OR 11
39 PA 8
40 RI 6
41 SC 14
42 SD 8
43 TN 5
44 TX 18
45 UT 10
46 VA 5
47 VT 8
48 WA 14
49 WI 7
50 WV 10
51 WY 9
Basically, I would like to create a barplot showing the value of 3 for AK, 8 for AL, 11 for AR,and so on.
I tried:
barplot(myData)
but I get the error message Error in barplot.default(myData) : 'height' must be a vector or a matrix