我目前正在尝试为我的RShiny应用程序创建一个盒子图。我有一些来自.csv的电影。这些电影有各种类型,我想在每个类型的箱形图中显示它们,但我似乎无法让它工作。
Name Rating Year Genre
1 The Shawshank Redemption 9.3 (1994) crime
2 The Godfather 9.2 (1972) crime
3 The Dark Knight 9.0 (2008) crime
4 The Godfather: Part II 9.0 (1974) crime
5 Pulp Fiction 8.9 (1994) crime
6 12 Angry Men 8.9 (1957) crime
7 Goodfellas 8.7 (1990) crime
8 Cidade de Deus 8.7 (2002) crime
9 Drishyam 8.7 (2015) crime
10 The Silence of the Lambs 8.6 (1991) crime
11 Se7en 8.6 (1995) crime
12 The Usual Suspects 8.6 (1995) crime
13 L<U+00E9>on 8.6 (1994) crime
14 American History X 8.6 (1998) crime
15 Eskiya 8.6 (1996) crime
16 Vishwaroopam 8.6 (2013) crime
17 The Departed 8.5 (2006) crime
18 The Green Mile 8.5 (1999) crime
19 A Wednesday 8.5 (2008) crime
20 Hera Pheri 8.5 (2000) crime
21 Reservoir Dogs 8.4 (1992) crime
22 Once Upon a Time in America 8.4 (1984) crime
23 North by Northwest 8.4 (1959) crime
24 M 8.4 (1931) crime
25 Double Indemnity 8.4 (1944) crime
26 Witness for the Prosecution 8.4 (1957) crime
27 Scarface 8.3 (1983) crime
28 Snatch 8.3 (2000) crime
29 A Clockwork Orange 8.3 (1971) crime
30 Taxi Driver 8.3 (1976) crime
31 L.A. Confidential 8.3 (1997) crime
32 To Kill a Mockingbird 8.3 (1962) crime
33 The Sting 8.3 (1973) crime
34 Rash<U+00F4>mon 8.3 (1950) crime
35 Gangs of Wasseypur 8.3 (2012) crime
36 Haider 8.3 (2014) crime
37 The Wolf of Wall Street 8.2 (2013) crime
38 The Big Lebowski 8.2 (1998) crime
39 Heat 8.2 (1995) crime
40 Lock, Stock and Two Smoking Barrels 8.2 (1998) crime
41 Casino 8.2 (1995) crime
42 On the Waterfront 8.2 (1954) crime
43 Dial M for Murder 8.2 (1954) crime
44 Kind Hearts and Coronets 8.1 (1949) crime
45 Zootropolis 8.1 (2016) crime
46 Gone Girl 8.1 (2014) crime
47 Spotlight 8.1 (I) (2015) crime
48 No Country for Old Men 8.1 (2007) crime
49 Prisoners 8.1 (2013) crime
50 The Grand Budapest Hotel 8.1 (2014) crime
51 Hababam Sinifi 9.5 (1975) drama
52 The Shawshank Redemption 9.3 (1994) drama
53 The Godfather 9.2 (1972) drama
54 The Dark Knight 9.0 (2008) drama
55 The Godfather: Part II 9.0 (1974) drama
56 Pulp Fiction 8.9 (1994) drama
57 Schindler's List 8.9 (1993) drama
58 The Lord of the Rings: The Return of the King 8.9 (2003) drama
59 12 Angry Men 8.9 (1957) drama
60 Forrest Gump 8.8 (1994) drama
61 Fight Club 8.8 (1999) drama
62 The Lord of the Rings: The Fellowship of the Ring 8.8 (2001) drama
63 Goodfellas 8.7 (1990) drama
64 One Flew Over the Cuckoo's Nest 8.7 (1975) drama
65 Cidade de Deus 8.7 (2002) drama
66 Shichinin no samurai 8.7 (1954) drama
67 The Lord of the Rings: The Two Towers 8.7 (2002) drama
68 Drishyam 8.7 (2015) drama
69 Babam ve Oglum 8.7 (2005) drama
70 Interstellar 8.6 (2014) drama
71 The Silence of the Lambs 8.6 (1991) drama
72 Saving Private Ryan 8.6 (1998) drama
73 Se7en 8.6 (1995) drama
74 The Usual Suspects 8.6 (1995) drama
75 L<U+00E9>on 8.6 (1994) drama
76 American History X 8.6 (1998) drama
77 The Intouchables 8.6 (2011) drama
78 La vita <U+00E8> bella 8.6 (1997) drama
79 Casablanca 8.6 (1942) drama
80 It's a Wonderful Life 8.6 (1946) drama
81 Modern Times 8.6 (1936) drama
82 City Lights 8.6 (1931) drama
83 Eskiya 8.6 (1996) drama
84 The Departed 8.5 (2006) drama
85 The Prestige 8.5 (2006) drama
86 Whiplash 8.5 (2014) drama
87 Django Unchained 8.5 (2012) drama
88 De leeuwekoning 8.5 (1994) drama
89 Gladiator 8.5 (2000) drama
90 The Green Mile 8.5 (1999) drama
91 Apocalypse Now 8.5 (1979) drama
92 Das Leben der Anderen 8.5 (2006) drama
93 The Pianist 8.5 (2002) drama
94 Hotaru no haka 8.5 (1988) drama
95 Nuovo Cinema Paradiso 8.5 (1988) drama
96 Sunset Blvd. 8.5 (1950) drama
97 De dictator 8.5 (1940) drama
98 Paths of Glory 8.5 (1957) drama
99 Sholay 8.5 (1975) drama
100 A Wednesday 8.5 (2008) drama
101 De reis van Chihiro 8.6 (2001) animation
102 De leeuwekoning 8.5 (1994) animation
103 Hotaru no haka 8.5 (1988) animation
104 Mononoke-hime 8.4 (1997) animation
105 WALL<U+00B7>E 8.4 (2008) animation
106 Inside Out 8.3 (I) (2015) animation
107 Toy Story 8.3 (1995) animation
108 Up 8.3 (2009) animation
109 Toy Story 3 8.3 (2010) animation
110 Finding Nemo 8.2 (2003) animation
111 Hoe tem je een draak 8.2 (2010) animation
112 Hauru no ugoku shiro 8.2 (2004) animation
113 Tonari no Totoro 8.2 (1988) animation
114 Song of the Sea 8.2 (2014) animation
115 Mary and Max 8.2 (2009) animation
116 Zootropolis 8.1 (2016) animation
117 Monsters, Inc. 8.1 (2001) animation
118 Akira 8.1 (1988) animation
119 Kaze no tani no Naushika 8.1 (1984) animation
120 Tenk<U+00FB> no shiro Rapyuta 8.1 (1986) animation
121 The Nightmare Before Christmas 8.0 (1993) animation
122 Belle en het Beest 8.0 (1991) animation
123 The Incredibles 8.0 (2004) animation
124 Ratatouille 8.0 (2007) animation
125 Aladdin 8.0 (1992) animation
126 K<U+00F4>kaku Kid<U+00F4>tai 8.0 (1995) animation
127 The Iron Giant 8.0 (1999) animation
128 Pink Floyd: The Wall 8.0 (1982) animation
129 Persepolis 8.0 (2007) animation
130 Mimi wo sumaseba 8.0 (1995) animation
131 Hoe Tem Je Een Draak 2 7.9 (2014) animation
132 Big Hero 6 7.9 (2014) animation
133 Shrek 7.9 (2001) animation
134 Toy Story 2 7.9 (1999) animation
135 Kiki's vliegende koeriersdienst 7.9 (1989) animation
136 Pafekuto buru 7.9 (1997) animation
137 Toki o kakeru sh<U+00F4>jo 7.9 (2006) animation
138 Batman: Mask of the Phantasm 7.9 (1993) animation
139 J<U+00FB>b<U+00EA> ninp<U+00FB>ch<U+00F4> 7.9 (1993) animation
140 Cowboy Bebop: Tengoku no tobira 7.9 (2001) animation
141 The Lego Movie 7.8 (2014) animation
142 Rapunzel 7.8 (2010) animation
143 The Little Prince 7.8 (I) (2015) animation
144 Wreck-It Ralph 7.8 (2012) animation
145 Fantastic Mr. Fox 7.8 (2009) animation
146 Kaze tachinu 7.8 (2013) animation
147 South Park: Bigger, Longer & Uncut 7.8 (1999) animation
148 Waking Life 7.8 (2001) animation
149 By<U+00F4>soku 5 senchim<U+00EA>toru 7.8 (2007) animation
150 Fantasia 7.8 (1940) animation
151 The Dark Knight 9.0 (2008) action
152 The Lord of the Rings: The Return of the King 8.9 (2003) action
153 Inception 8.8 (2010) action
154 The Lord of the Rings: The Fellowship of the Ring 8.8 (2001) action
155 Star Wars: Episode V - The Empire Strikes Back 8.8 (1980) action
156 Star Wars: Episode IV - A New Hope 8.7 (1977) action
157 The Matrix 8.7 (1999) action
158 Shichinin no samurai 8.7 (1954) action
159 The Lord of the Rings: The Two Towers 8.7 (2002) action
160 Saving Private Ryan 8.6 (1998) action
161 Vishwaroopam 8.6 (2013) action
162 The Dark Knight Rises 8.5 (2012) action
163 Gladiator 8.5 (2000) action
164 Indiana Jones and the Raiders of the Lost Ark 8.5 (1981) action
165 Terminator 2: Judgment Day 8.5 (1991) action
166 Sholay 8.5 (1975) action
167 1 - Nenokkadine 8.5 (2014) action
168 Aliens 8.4 (1986) action
169 Star Wars: Episode VI - Return of the Jedi 8.4 (1983) action
170 North by Northwest 8.4 (1959) action
171 Airlift 8.4 (2016) action
172 Baahubali: The Beginning 8.4 (2015) action
173 Waar 8.4 (2013) action
174 Batman Begins 8.3 (2005) action
175 Indiana Jones and the Last Crusade 8.3 (1989) action
176 Ran 8.3 (1985) action
177 Y<U+00F4>jinb<U+00F4> 8.3 (1961) action
178 Gangs of Wasseypur 8.3 (2012) action
179 Bhaag Milkha Bhaag 8.3 (2013) action
180 Haider 8.3 (2014) action
181 Star Wars: Episode VII - The Force Awakens 8.2 (2015) action
182 V for Vendetta 8.2 (2005) action
183 Heat 8.2 (1995) action
184 Die Hard 8.2 (1988) action
185 Hoe tem je een draak 8.2 (2010) action
186 The General 8.2 (1926) action
187 Deadpool 8.1 (2016) action
188 Pirates of the Caribbean: The Curse of the Black Pearl 8.1 (2003) action
189 Mad Max: Fury Road 8.1 (2015) action
190 Guardians of the Galaxy 8.1 (2014) action
191 The Avengers 8.1 (2012) action
192 Kill Bill: Vol. 1 8.1 (2003) action
193 The Terminator 8.1 (1984) action
194 Rush 8.1 (I) (2013) action
195 The Bourne Ultimatum 8.1 (2007) action
196 Yip Man 8.1 (2008) action
197 Akira 8.1 (1988) action
198 Tropa de Elite 8.1 (2007) action
199 Tropa de Elite 2: O Inimigo Agora <U+00E9> Outro 8.1 (2010) action
200 Baby 8.1 (I) (2015) action
我使用的代码:
output$boxplot <- renderPlot({
p <- ggplot(all_movies, aes(x = Genre, y = Rating)) +
geom_boxplot()
p
})
如何为此数据集获取正确的箱图?感谢所有帮助
编辑 dput(all_movies)
structure(list(Name = structure(c(42L, 38L, 36L, 39L, 27L, 1L,
13L, 6L, 9L, 43L, 31L, 45L, 19L, 4L, 10L, 48L, 37L, 41L, 3L,
16L, 29L, 25L, 23L, 21L, 8L, 49L, 30L, 32L, 2L, 34L, 18L, 47L,
44L, 28L, 11L, 14L, 46L, 35L, 15L, 20L, 5L, 24L, 7L, 17L, 50L,
12L, 33L, 22L, 26L, 40L, 62L, 42L, 38L, 36L, 39L, 27L, 72L, 78L,
1L, 60L, 59L, 77L, 13L, 69L, 6L, 73L, 79L, 9L, 52L, 64L, 43L,
71L, 31L, 45L, 19L, 4L, 76L, 66L, 53L, 65L, 67L, 54L, 10L, 37L,
81L, 82L, 58L, 57L, 61L, 41L, 51L, 55L, 80L, 63L, 68L, 75L, 56L,
70L, 74L, 3L, 90L, 57L, 63L, 105L, 127L, 97L, 123L, 126L, 125L,
93L, 96L, 94L, 122L, 113L, 103L, 50L, 106L, 83L, 100L, 115L,
120L, 86L, 116L, 111L, 84L, 99L, 117L, 109L, 108L, 104L, 95L,
87L, 112L, 124L, 102L, 107L, 121L, 85L, 98L, 89L, 118L, 110L,
119L, 129L, 92L, 101L, 114L, 128L, 88L, 91L, 36L, 78L, 140L,
77L, 149L, 148L, 157L, 73L, 79L, 71L, 48L, 155L, 61L, 142L, 152L,
74L, 130L, 132L, 150L, 23L, 131L, 133L, 162L, 135L, 141L, 146L,
163L, 11L, 136L, 14L, 151L, 161L, 15L, 138L, 96L, 156L, 137L,
145L, 144L, 139L, 153L, 143L, 158L, 147L, 154L, 164L, 83L, 159L,
160L, 134L), .Label = c("12 Angry Men", "A Clockwork Orange",
"A Wednesday", "American History X", "Casino", "Cidade de Deus",
"Dial M for Murder", "Double Indemnity", "Drishyam", "Eskiya",
"Gangs of Wasseypur", "Gone Girl", "Goodfellas", "Haider", "Heat",
"Hera Pheri", "Kind Hearts and Coronets", "L.A. Confidential",
"L<U+00E9>on", "Lock, Stock and Two Smoking Barrels", "M", "No Country for Old Men",
"North by Northwest", "On the Waterfront", "Once Upon a Time in America",
"Prisoners", "Pulp Fiction", "Rash<U+00F4>mon", "Reservoir Dogs",
"Scarface", "Se7en", "Snatch", "Spotlight", "Taxi Driver", "The Big Lebowski",
"The Dark Knight", "The Departed", "The Godfather", "The Godfather: Part II",
"The Grand Budapest Hotel", "The Green Mile", "The Shawshank Redemption",
"The Silence of the Lambs", "The Sting", "The Usual Suspects",
"The Wolf of Wall Street", "To Kill a Mockingbird", "Vishwaroopam",
"Witness for the Prosecution", "Zootropolis", "Apocalypse Now",
"Babam ve Oglum", "Casablanca", "City Lights", "Das Leben der Anderen",
"De dictator", "De leeuwekoning", "Django Unchained", "Fight Club",
"Forrest Gump", "Gladiator", "Hababam Sinifi", "Hotaru no haka",
"Interstellar", "It's a Wonderful Life", "La vita <U+00E8> bella",
"Modern Times", "Nuovo Cinema Paradiso", "One Flew Over the Cuckoo's Nest",
"Paths of Glory", "Saving Private Ryan", "Schindler's List",
"Shichinin no samurai", "Sholay", "Sunset Blvd.", "The Intouchables",
"The Lord of the Rings: The Fellowship of the Ring", "The Lord of the Rings: The Return of the King",
"The Lord of the Rings: The Two Towers", "The Pianist", "The Prestige",
"Whiplash", "Akira", "Aladdin", "Batman: Mask of the Phantasm",
"Belle en het Beest", "Big Hero 6", "By<U+00F4>soku 5 senchim<U+00EA>toru",
"Cowboy Bebop: Tengoku no tobira", "De reis van Chihiro", "Fantasia",
"Fantastic Mr. Fox", "Finding Nemo", "Hauru no ugoku shiro",
"Hoe Tem Je Een Draak 2", "Hoe tem je een draak", "Inside Out",
"J<U+00FB>b<U+00EA> ninp<U+00FB>ch<U+00F4>", "K<U+00F4>kaku Kid<U+00F4>tai",
"Kaze no tani no Naushika", "Kaze tachinu", "Kiki's vliegende koeriersdienst",
"Mary and Max", "Mimi wo sumaseba", "Mononoke-hime", "Monsters, Inc.",
"Pafekuto buru", "Persepolis", "Pink Floyd: The Wall", "Rapunzel",
"Ratatouille", "Shrek", "Song of the Sea", "South Park: Bigger, Longer & Uncut",
"Tenk<U+00FB> no shiro Rapyuta", "The Incredibles", "The Iron Giant",
"The Lego Movie", "The Little Prince", "The Nightmare Before Christmas",
"Toki o kakeru sh<U+00F4>jo", "Tonari no Totoro", "Toy Story",
"Toy Story 2", "Toy Story 3", "Up", "WALL<U+00B7>E", "Waking Life",
"Wreck-It Ralph", "1 - Nenokkadine", "Airlift", "Aliens", "Baahubali: The Beginning",
"Baby", "Batman Begins", "Bhaag Milkha Bhaag", "Deadpool", "Die Hard",
"Guardians of the Galaxy", "Inception", "Indiana Jones and the Last Crusade",
"Indiana Jones and the Raiders of the Lost Ark", "Kill Bill: Vol. 1",
"Mad Max: Fury Road", "Pirates of the Caribbean: The Curse of the Black Pearl",
"Ran", "Rush", "Star Wars: Episode IV - A New Hope", "Star Wars: Episode V - The Empire Strikes Back",
"Star Wars: Episode VI - Return of the Jedi", "Star Wars: Episode VII - The Force Awakens",
"Terminator 2: Judgment Day", "The Avengers", "The Bourne Ultimatum",
"The Dark Knight Rises", "The General", "The Matrix", "The Terminator",
"Tropa de Elite", "Tropa de Elite 2: O Inimigo Agora <U+00E9> Outro",
"V for Vendetta", "Waar", "Y<U+00F4>jinb<U+00F4>", "Yip Man"), class = "factor"),
Rating = structure(c(11L, 10L, 9L, 9L, 8L, 8L, 7L, 7L, 7L,
6L, 6L, 6L, 6L, 6L, 6L, 6L, 5L, 5L, 5L, 5L, 4L, 4L, 4L, 4L,
4L, 4L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 13L, 11L, 10L,
9L, 9L, 8L, 8L, 8L, 8L, 12L, 12L, 12L, 7L, 7L, 7L, 7L, 7L,
7L, 7L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L,
6L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L,
5L, 5L, 5L, 6L, 5L, 5L, 4L, 4L, 3L, 3L, 3L, 3L, 2L, 2L, 2L,
2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 16L, 16L, 16L, 16L, 16L,
16L, 16L, 16L, 16L, 16L, 15L, 15L, 15L, 15L, 15L, 15L, 15L,
15L, 15L, 15L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L,
14L, 9L, 8L, 12L, 12L, 12L, 7L, 7L, 7L, 7L, 6L, 6L, 5L, 5L,
5L, 5L, 5L, 5L, 4L, 4L, 4L, 4L, 4L, 4L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c("8.1", "8.2", "8.3",
"8.4", "8.5", "8.6", "8.7", "8.9", "9.0", "9.2", "9.3", "8.8",
"9.5", "7.8", "7.9", "8.0"), class = "factor"), Year = structure(c(19L,
10L, 29L, 12L, 19L, 6L, 16L, 26L, 33L, 17L, 20L, 20L, 19L,
23L, 21L, 31L, 27L, 24L, 29L, 25L, 18L, 15L, 7L, 1L, 2L,
6L, 14L, 25L, 9L, 13L, 22L, 8L, 11L, 4L, 30L, 32L, 31L, 23L,
20L, 23L, 20L, 5L, 5L, 3L, 34L, 32L, 35L, 28L, 31L, 32L,
40L, 19L, 10L, 29L, 12L, 19L, 43L, 45L, 6L, 19L, 24L, 44L,
16L, 40L, 26L, 5L, 26L, 33L, 46L, 32L, 17L, 23L, 20L, 20L,
19L, 23L, 47L, 22L, 38L, 39L, 36L, 1L, 21L, 27L, 27L, 32L,
30L, 19L, 25L, 24L, 41L, 27L, 26L, 42L, 42L, 4L, 37L, 6L,
40L, 29L, 44L, 19L, 42L, 22L, 29L, 35L, 20L, 52L, 53L, 45L,
53L, 51L, 42L, 32L, 52L, 34L, 44L, 42L, 15L, 49L, 43L, 17L,
51L, 28L, 18L, 20L, 24L, 48L, 28L, 20L, 32L, 32L, 44L, 24L,
50L, 22L, 27L, 43L, 43L, 44L, 32L, 53L, 35L, 30L, 52L, 31L,
24L, 44L, 28L, 37L, 29L, 45L, 53L, 44L, 57L, 56L, 24L, 5L,
26L, 23L, 31L, 30L, 25L, 58L, 17L, 40L, 32L, 49L, 14L, 7L,
34L, 33L, 31L, 46L, 50L, 59L, 55L, 30L, 31L, 32L, 33L, 46L,
20L, 42L, 53L, 54L, 34L, 45L, 33L, 32L, 30L, 45L, 15L, 60L,
28L, 29L, 42L, 28L, 53L, 35L), .Label = c("(1931)", "(1944)",
"(1949)", "(1950)", "(1954)", "(1957)", "(1959)", "(1962)",
"(1971)", "(1972)", "(1973)", "(1974)", "(1976)", "(1983)",
"(1984)", "(1990)", "(1991)", "(1992)", "(1994)", "(1995)",
"(1996)", "(1997)", "(1998)", "(1999)", "(2000)", "(2002)",
"(2006)", "(2007)", "(2008)", "(2012)", "(2013)", "(2014)",
"(2015)", "(2016)", "(I) (2015)", "(1936)", "(1940)", "(1942)",
"(1946)", "(1975)", "(1979)", "(1988)", "(1993)", "(2001)",
"(2003)", "(2005)", "(2011)", "(1982)", "(1986)", "(1989)",
"(2004)", "(2009)", "(2010)", "(1926)", "(1961)", "(1977)",
"(1980)", "(1981)", "(1985)", "(I) (2013)"), class = "factor"),
Genre = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L), .Label = c("crime",
"drama", "animation", "action"), class = "factor")), .Names = c("Name",
"Rating", "Year", "Genre"), row.names = c(NA, 200L), class = "data.frame")
答案 0 :(得分:1)
发布解决方案作为答案:
在dput
输出中,我们看到Rating
列是一个因素,为了将它传递给ggplot,就像你想要它一样,它需要是一个数字,所以我们需要重新编码为:
all_movies$Rating <- sapply(sapply(all_movies$Rating, as.character), as.numeric)
然后我们可以将它传递给ggplot:
ggplot(all_movies) + geom_boxplot(aes(x = Genre, y = Rating))