[R] Newbie question - how to do it 'right'

JohnDoe365 johann.hoechtl at myrealbox.com
Tue Sep 2 11:24:56 CEST 2008

I read the documentation carefully, yet I miss the experience to do it right

Suppose I have a data.frame DS with this data:

Homepage?		Willhaveone?	When?
levels='Yes', 'No'	levels='Yes', 'No', 'NV'	levels='Now', 'Half Year',
'Year', 'Later'
yes				NV				NV
no				no				NV
no				yes				half year

1300 rows.

This is data I obtained from an online questionnaire.

The participant was  asked whether he/she has a homepage (varaible HP). In
that case zhe question about "Will you have one?" was not applicable nor the
question about the time when he/she will have one.

If the answer was No, the participant could either say 'yes' to the question
if he/she will ever have a homepage (variable WHP). If the answer was yes,
the third question was applicable (variable WHEN) with the values 'Now' ,
'Half Year' 'Year' or 'Later'

So all the three coloumns are of type factor. However I wonder what would be
the best way to analyse and plot that data.

The value 'NV' means not valid, as the question as whole is not useful to
answer when the participant will not have a homepage, he need not be asked
about when he will have one.

What I did so far were things like table(DS(factor(DS['HP'])['yes'])) to get
the amount of answers for for: 'yes I will  have a homepage' and so on for
those who will never have a homepage or if they have not yet a homepage,
when 'Now', 'Half year' , ... they will have one. The 'NV' value ist not of
my interesst and as such left out.

As a result I pasted the sub-results together c(X, Y, Z) and made a barplot.

I found this tedious and cumbersome so I wonder what would be the right
approach to analyse such data.


View this message in context: http://www.nabble.com/Newbie-question---how-to-do-it-%27right%27-tp19266789p19266789.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list