0

I have data in 2 columns

VisitNumber,Scored Labels
1,30
1,38
1,38
1,38
2,39
2,39
2,999
2,999
3,36
3,999
4,42
6,25
6,999

I want unique values of scored labels as column names and data as count of visitnumber.

Sample look of data format

Please help me how can I do this in R.

hrbrmstr
  • 77,368
  • 11
  • 139
  • 205
Shankar Pandala
  • 969
  • 2
  • 8
  • 28
  • 2
    Which web site/twitter account/redditer is the one recommending this "post screen shots from RStudio data viewer" trend? – hrbrmstr Oct 27 '15 at 12:02
  • The data in the image and the data you have given us contradict. Please give us consistent data to work with. – Ultimater Oct 27 '15 at 12:05
  • 1
    Please consider reading up on [ask] and how to produce a [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). Some effort of your own wouldn't go amiss either. – Heroka Oct 27 '15 at 12:07
  • . Try `library(reshape2);dcast(df1, VisitNumber~ScoreLabels, value.var='VisitNumber', function(x) sum(x!=0))` – akrun Oct 27 '15 at 12:31
  • 1
    Thank you so much @akrun You are the best!! – Shankar Pandala Oct 27 '15 at 12:40

0 Answers0