Skip to content

help with line graphs - rather lengthy to explain need

1 message · David L Carlson

#
Reformatting helps because your spreadsheet as currently designed is not R-friendly or tidy. R data structures include vectors, matrices, data.frames, and lists. If you try to create your own structure you are just creating problems for yourself.

Your numeric data are a matrix - all numbers (but they could as well be all character data). They could also be viewed as a vector if you stacked all of the columns on top of one another. Your first two rows are vectors, but location is not numeric (and it is not clear if sample number is to be treated as numeric or character, e.g. sample 0056 would have to be treated as character whereas 56 could be numeric). 

A data.frame is a collection of vectors with headings (column names) and different columns can be different types, e.g. some numeric and some character, BUT all of the values in a column must be the same type. You could make this work if you combined location and sample number into a single row, but if you want to keep them separate, your spreadsheet cannot be converted into a data frame. If you try to read your data into R Commander, it will probably treat the first row (sample numbers) as column names. The second row is characters so R will convert all of your measurements to character strings (and then probably to factors). The mess that you are complaining about.

R Commander is helpful and useful, but it only helps if you use the data structures that R provides. You can also type commands into the script window in R Commander if you need to do something that is not available on the menus. If you want to use R, you are really going to have to invest a bit of time understanding how the program works. There are many free resources to help you learn more about R. 

David L. Carlson
Department of Anthropology
Texas A&M University

-----Original Message-----
From: Robert D. Bowers M.A. [mailto:rdbowers at mail.usf.edu] 
Sent: Friday, November 30, 2018 10:48 AM
To: David L Carlson <dcarlson at tamu.edu>
Subject: Re: [R] help with line graphs - rather lengthy to explain need

I'm not really sure how re-formatting it like that would help - IMO that 
doesn't make sense - but then, I also have to admit that I learned 
programming LONG before I learned statistics (1974 vs 2006/2008) and 
tend to think in terms of arrays (and spreadsheets) when working with 
data - and really don't understand the difference between ggplot and the 
"standard" plotting found in Rcmdr (which can't handle more than a few 
cases - a few samples).

I've been using Rcmdr in this because it simplifies a lot of the steps, 
and is closer to the formal statistics software I studied in school.

Part of my problem is the learning curve - and I really don't have the 
time to try to re-learn a lot of the things I studied a few years ago 
(when I first experienced R and studied it on my own).? I've not done 
much statistical stuff in the last couple of years... I've been working 
on other aspects of my research (including gathering samples and 
generating data).

Matplot is a new one for me - thanks for mentioning it.? Maybe that will 
do what I want.? I'll look at it and see what it can do (and how to get 
the data properly into it - a problem I've encountered because I think 
so 'old-fashioned').

Bob
On 11/29/18 8:37 PM, David L Carlson wrote: