Representing a "radiomatrix" question from a survey - r

Hi I am making a report of a survey where we have what we call a "radiomatrix" and it looks like this.
alt text http://img193.imageshack.us/img193/9288/radiomatrix.png
Then we import the answers is a table in R into something that looks like this:
user tiramisu cupcake chocolate carrot
test01 loves_it loves_it loves_it hate_it
test02 likes_it likes_it loves_it likes_it
test03 likes_it loves_it loves_it hate_it
What would be the best and most meaningful graphical representation for this?

One of the things I would do is to constract a contingency table and then perform correspondence analysis (look fot it here), to produce something like this
Another one is that I would try to show correlations between preferences (something like this)
Perhaps one could also mine association rules, e.g.
If Loves Tiramisu then hates Cupcake
If you would like to create mosaic plots with R, check out this.

There isn't a "best" representation for any given set of data. It depends on what you're trying to show. Some examples:
If you want to test the hypothesis that people are extreme about their cake preferences -- that is, that there are very few likes vs. loves/hates -- you could show a plot of preference intensity versus quantity.
If you want to show that chocolate is more preferred than tiramisu, you could use a simple table that assigns -1 to "hate", 0 to "like", and 1 to "love" to come up with a mean/median score for each dessert.

A mosaic plot might be interesting. See here (PDF) for examples.

Related

How can I select specific sections of an image to determine RGB values using R?

I use R for my stats analyses and I am trying to use it as well to do some image analyze. I am not an expert in coding or R, but I am trying to learn more. So sorry if my question could sound basic.
I am doing some staining to potato slices, the staining turns my potato slices dark brown in the parts where is the compound I want to see. So I used package "jpeg" and "lessR" This image is what I get using this package so I could have a section of my image analyze to get the RGB values. But I just can make a rectangular section, and like that, I lose parts of my stained image. Is there a way where I can "tell" R to analyze all the slice? My background is whitish.example of one my images
Thank you in advance.
Claudia

heatmap.2 color legend custom bins

Hi there stackoverflow community!
I am a graduate student inquiring for some consultation on an aethetics R problem I am encountering.
The data I am working with is in the form of a VERY large matrix (49x51).
My problem is that my data ranges from very small to very large, with the bulk of my data falling within the "very large" end of the spectrum, so unless I convert my data to log10, the heatmap is rather boring and almost entirely the same color.
The spectrum of my data is totally within the range I am expecting, but I am hoping to display it in a more aesthetic way.
Proposed solution: I think I need to bin my data in a non-uniform way. If you look at the attached image, you will see that their heatmap looks nice and the color key shows the heat spectrum in a non-fixed bin format. I would like to do something like that, however, I am not sure how to declare cutoffs for each bin. I would ideally like to declare the cutoffs.
For example, bin 1 (0-1), bin 2 (2-50), bin 3 (51-5000). As you can see, my bins would not be fixed in equal increments.
I have been using heatmap.2 for this. Thanks so much in advance!
heatmap with color legend in non-uniform bins:
Hey #Punintended and #S Rivero,
I think I have reached the point that my heatmap will only improve marginally. Both of you contributed deeply to this success, so thanks! First, to condense the matrix values as much as possible, I normalized by column. I was then able to assign gradients. This turned out much better than I had hoped. As you can see, most of my data is clustered (check out the density in the key) at very low values, this is okay though, for I am interested in the higher values. I had to use custom color gradients to account for possible instances of colorblind attendees that might look at my poster. Anyways, if you guys have comments or recommendations, they will be much appreciated :). Again, thanks a bunch!
enter image description here

Map image into matrix in R to 3d Print

We have an image like this:
Where I have a skull, and the raw counts of how many bones were broken in each area of the skull.
I also have a 3d printer and can make things like this:
Which was made in R using a matrix and the r2stl package.
What I want to do is map the x's and y's of that skull into certain locations of a matrix so that I could add the raw counts to those cells and 3d print that skull in a way where each portion of the skull would be higher based on how many fractures were in that location. Thoughts? It didn't seem like an example where an example dataset would be useful, I apologize if I should have included that.

How to bind and sort multiple columns into a treemap in R

This is my first StackOverflow post. I think my main problem here is not having the vocabulary to ask this question, but I'll try my best below.
I have data with the following structure.
Neighborhood Dominant.Discipline Rent.vs.Own ADA.Compliant
Alki Heritage O Y
Ballard Multi-use Don't.know Partial
Ballard CommunityCenter R Partial
Belltown Music O N
As you can see, I have more than one instance of a neighborhood, more than one instance of the Dominant.Discipline, of Rent.vs.Own and ADA.Complianct.
What I want to do is create a visualizations by taking a particular neighborhood, only pick the spaces that are rented and have some ADA.compliant status.
I then want to compare other neighborhoods on the same parameters on a Treemap. How do I achieve this?
My ideal treemap will display various neighborhoods, the surface area will represent the number of rented spaces, and the colors will represent the ADA compliance status. Red being "N", Blue being "Y", and yellow being "I don't know."
Please excuse me if I may be unclear. I'm just trying to wrap my head around this.

Overlay of multiple time series in Quantmod in R

I want to create a chart using chartSeries with two or more time series on the SAME chart (overlaying each other). Bing/search doc have gotten me nowhere. Seems like should be fairly easy, I tried addTA, but didn't work. I tried the following code.
chartSeries(c(PSEC, ARCC), type = "line")
That resulted into this: (nevermind the fonts, the hell is the green blob?)
The green blob is what you asked R to plot. c(PSEC, ARCC) is the same as rbind(PSEC, ARCC), which creates a single OHLCVA object with two observations per index value (one for PSEC, one for ARCC). You said you tried addTA, but it "didn't work". Saying something "doesn't work" does not help people help you, especially when you don't even show the code that "doesn't work".
Here's a chartSeries call that uses addTA, and a corresponding chart_Series version. Note that chart_Series automatically handles the y-axis range for you.
> chartSeries(Cl(PSEC), TA="addTA(Cl(ARCC), on=1)")
> chart_Series(Cl(PSEC), TA="add_TA(Cl(ARCC), on=1)")
Your data, if it is not daily, could easily look like a green blob.
For example, if that's minute-by-minute prices, I'd expect it to look like this upon visual inspection.

Resources