[R] Novice users in need of urgent help with boxplots
Marc Schwartz
marc_schwartz at me.com
Tue Feb 28 20:05:33 CET 2017
> On Feb 28, 2017, at 8:11 AM, Ashley Patton via R-help <r-help at r-project.org> wrote:
>
>
> Hi, please forgive me but I am completely new to R and have no experience with it other than a 3 day training course but I need to use it for an urgent project and don't have time to learn a whole new language before the deadline, although I hope to get there soon.
>
>
> My question is this. I have a dataset in Excel containing data from 20 sites. The data comes from loggers recording every half hour for a year. So my Excel file has 20 columns each with the name of the site as the header and each column contains the data recorded throughout the year. What I want to do is show the variation in that data at each site. So I would have a boxplot showing site 1, site 2, site 3... etc across the x axis and then the variable data (which in this case in air temperature) on the y axis so I can see what range in temperatures occurred throughout the year, what where the max, min, outliers etc. I have trawled the Internet looking for a code that will allow me to do this but all I can find is plots that refer to data where you are looking at a range in data with a category (like range in mpg with cylinder size) whereas I want to so look at the data for all of my sites just on one plot. I know this is possible because I have seen it down by someone else b!
> ut I don't know where to start. Does anyone have any code that would do this or at least know where I could go? Like I say, I am a complete begging so writing code is a brand new thing for me. Many, many thanks to anyone who helps me with this one.
>
>
> Many thanks
>
>
> A
Hi,
First, please post in plain text, not HTML/RTF, as the formatting of the text above is problematic for reading.
Second, posting "urgent" requests to an e-mail list with thousands of **volunteer** subscribers to meet your deadline, is an expectation that is not reasonable. You don't need to learn the entire language to complete your task, but learning pretty basic commands would be required.
I am surprised that a three day intro to R course would not have covered the basics of importing data into R from common sources, such as Excel, CSV files, etc, along with basic plot operations, which in your case, would be using the boxplot() function. From my perspective, you or your employer did not get your money's worth.
See the help page for the boxplot function for examples (accessed by typing ?boxplot in the R console), notably with a formula to specify the data to be plotted.
The basic incantation for the boxplot for you would be something along the lines of:
boxplot(AirTemp ~ Site, data = DataFrameContainingYourData)
where AirTemp and Site are replaced by the actual column names for the temperature data and site grouping variables, respectively. DataFrameContainingYourData is the data frame that results from importing your data into R.
Also, there is a general framework for getting help with R, that is linked from the R home page:
https://www.r-project.org/help.html
Specifically, there is a dedicated Data Import/Export manual here:
https://cran.r-project.org/manuals.html
along with other basic R manuals listed there (notably An Introduction to R), that you should avail yourself of, along with any materials that the course itself provided.
Regards,
Marc Schwartz
More information about the R-help
mailing list