I am trying to figure out the best way to organize and plot data generated by a Excel spreadsheet (one driving a sample turntable and collecting optical spectra).

The output of the equipment and software is an excel spreadsheet with sample numbers in the first row, and in the first column there is the wavelength in nm.  2048 individual measurements (per wavelength) - 2048 rows plus the sample number row, and at present I've tested 250 samples, with a LOT more to follow.

After I get the spreadsheet, I add a row (just below the sample numbers) containing site locations.  I've collected 50 samples per site (each assigned a different number), so far 5 sites.  The spreadsheet ends up with 2050 rows, 250 columns.

What I want to do is generate a line graph of the data (which could be separated out into sections of the optical spectrum), with line colors assigned by the site name.  Once that's done, the graphs make sense (right now the only way I can do that is using the spreadsheet software, and assigning each line the color manually - a very tiresome and time-consuming process).

So far, I've tried everything I can to get a graph out using R, without luck.  I'm rusty with R and programming... I've used Rcmdr (tried transposing data, various settings and so on) and 'played' with ggplot - no success.  I'm using Rcmdr to make it easier to work out the bugs, then will write a short program to process data.

What I'd like to know is (1) what would be the best way to organize the data - sample numbers (cases) in the first row, or in the first column with the next row or column being the site name, (2) how would I get ggplot to plot the line graph showing all of the samples (number listing not important) and all (or a selection) of the different wavelengths, while assigning line color based on site name.  Once that's done, I can show the within-group vs between-group variation compared to wavelength.

To give an idea of what the data look like:

(name = Longwave)

Sample     34900   34901  34902    34903    34904    (and so on)

Site            Tp         Tc          Cr           Ws Gs

200(nm)    300.5    783.9    101.3      623.8     1385.7

201....

You get the idea.  (maximum measurement value is 4098, the instrument takes multiple scans and averages them).

If I can figure this out, it will speed up my work - which I need to do so I can get a grant proposal off on time.

Thank you,

Bob

Doctoral Candidate, Applied Anthropology

University of South Florida

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to