[R] Barplot for data frame

Ivan Krylov kry|ov@r00t @end|ng |rom gm@||@com
Wed Nov 29 10:25:08 CET 2023


В Wed, 29 Nov 2023 00:29:49 +0000
Livio Beqiri <liviob using live.com> пишет:

> how can i create a vertical barplot that displays brands in x-axis
> and Revenue in Y-axis

What have you tried? If you're not currently studying R with an
instructor (who should be contacted with basic questions like this
instead; see the posting guide at [1]), I can recommend a free book by
A. Shipunov [2] to give you the basic R knowledge.

> df <- data.frame (Revenue = c("100", "300", "500"),
>                   Brand = c("Apple", "HP", "Lenovo")
>                   )

My psychic debugging powers tell me that you're getting an error
complaining about the wrong argument type. If that's the case, you
should either avoid quoting your numbers (i.e. say 100 instead of
"100") or transform the character vector into a vector of numbers using
as.numeric().

Either way, it's best to show your work and your error messages because
the psychic debugging powers don't always work properly.

-- 
Best regards,
Ivan

[1]
https://www.r-project.org/posting-guide.html

[2]
https://web.archive.org/web/20230501112111/http://ashipunov.info/shipunov/school/biol_240/en/visual_statistics.pdf



More information about the R-help mailing list