Using data stored in a file for a heatmap
I might suggest you use read.csv() instead of scan if your data really is a csv (what you provided isn't). Once you have it in R, I'd recommend you use a formula interface to levelplot(). Taking an example from the help page [which you can access by typing ?levelplot and run the examples by typing example(levelplot)], it'd be something like levelplot(z ~ x*y, data = inp) # Help page uses the grid data set. which will plot z depending on x and y. Note that x,y,z are here expected to be names of columns of the data frame inp. If your data frame has different column names (which it likely does), you need to change those to fit what you want to plot. Best, Michael Assuming your data looks something like the provided: On Wed, Jul 11, 2012 at 2:14 PM, Richard M?ller
<mueller.eisborn at googlemail.com> wrote:
Hi all,
I just try to get familiar with levelplot() for generating heatmaps. I
have x, y, z-data stored in a file: e.g.:
"file.csv":
0 0 0.1
0 1 0.5
0 2 0.4
1 0 0.3
1 1 0.4
1 2 0.6
...
I can use scan() for generating the matrix for R:
inp <- scan("file.csv", list(0, 0, 0))
How can I feed inp into levelplot()?
Thanks a lot for your help
Richard
--
Richard M?ller . Am Spring 9 . D-58802 Balve
www.oeko-sorpe.de
______________________________________________ R-help at r-project.org mailing list 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.