How creates a chart from the data imported from a website in R
Welcome to the RStudio community!
In order for us to help you with your question, please provide us a minimal reproducible example where you provide a minimal (dummy) dataset and code that can recreate the issue. Once we have that, we can go from there. For help on creating a Reprex, see this guide:
Thank for your support.
Then I need to extract the Result ;;Pre World War I;;
I wish to know to creat a chart after extracting the data
Your question is still very vague. I assume you have the table as shown on the Wikipedia page as a data frame in R, and now you like to visualise it. There are many different ways you can display data, and so you must first decide the type of chart you like, which data is going to be plotted and how it needs to be changed in order to fit your needs.
You will have to start writing some code before we can help you here, because we have nothing to work with. A great way to get inspiration and examples is to use the R gallery
I see . Extracting from Wikipedia is easy. But the data I want to extract is from a website that doesnot a class table. Pleas see the link below.
Please what can be the synthax code to extract this data in R
This is actually an API, so you can query it to extract data easily. Just by changing the last part of the URL from "html" into "csv" I could get the data in R in just one line of code.
myData = read.csv("https://danepubliczne.imgw.pl/api/data/synop/format/csv") head(myData) #> id_stacji stacja data_pomiaru godzina_pomiaru temperatura #> 1 12295 BiaÅ‚ystok 2021-11-11 19 2.9 #> 2 12600 Bielsko BiaÅ‚a 2021-11-11 19 3.4 #> 3 12235 Chojnice 2021-11-11 19 6.1 #> 4 12550 CzÄ\231stochowa 2021-11-11 19 3.6 #> 5 12160 ElblÄ…g 2021-11-11 19 4.8 #> 6 12155 GdaÅ„sk 2021-11-11 19 7.9 #> predkosc_wiatru kierunek_wiatru wilgotnosc_wzgledna suma_opadu cisnienie #> 1 2 240 97.2 0 1020.9 #> 2 2 290 95.8 0 1026.1 #> 3 4 240 97.9 0 1021.8 #> 4 1 200 89.2 0 1025.0 #> 5 6 230 97.2 0 1020.3 #> 6 3 230 90.1 0 1019.7
Created on 2021-11-11 by the reprex package (v2.0.1)
This won't work for regular websites, but does for this particular API
Hi thank for your support.
What about is you want plot the the data directly? Using the gglot library
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.