• Want to help us with this year's BoS Trials?
    Let us know before 30 June. See this thread for details
  • Looking for HSC notes and resources?
    Check out our Notes & Resources page

Using the software R (1 Viewer)

YannY

Member
Joined
Aug 28, 2007
Messages
190
Gender
Male
HSC
2008
Does anyone know how to bin a set of data?

for example how would you bin

40 different data sets in a vector into groups of 4?
 

Iruka

Member
Joined
Jan 25, 2006
Messages
544
Gender
Undisclosed
HSC
N/A
This probably belongs in the extracurricular topics forum.
 

YannY

Member
Joined
Aug 28, 2007
Messages
190
Gender
Male
HSC
2008
[1] 65 15 111 62 35 30 14 11 11 17 12 40 23 16 39 11 16 10
[19] 6 68 49 65 70 11 84 25 124 52 86 26 155 10 2 32 95 1
[37] 10 1 12 16 48 67 70 6 200 6 26 26 38 20 19 20 72 5
[55] 42 9 26 8 116 1 5 4 13 24 44 9 69 64 13 20 87 40
[73] 43 13 22 8 10 142 64 36 61 121 42 9 12 7 88 61 31 7
[91] 156 20 83 5 225 77 90 36 4 18 24 50 83 20 81 10 5 89
[109] 66 80 4 30 5 39 5 57 94 19 9 46 12 163 14 23 16 28
[127] 41 26 56 32 36 6 42 16 29 15 34 63 22 12 51 19 17 13
[145] 7 53 17 38 69 153 23 19 45 27 7 21 33 22 22 74 32 19
[163] 19 53 13 7 67 50 10 25 18 116 46 19 47 1 3 32 8 17
[181] 15 11 165 9 48 26 3 2 26 3 6 32 23 87 4 30 18 130
[199] 45 61 29 6 2 3 29 50 15 59 12 10 45 34 3 13 5 2
[217] 40 17 26 30 121 43 63 8 12 97 33 29 56 10 1 12 5 56
[235] 28 3 90 10 22 5 19 126 18 22 7 3 144 34 35 55 7 14
[253] 1 108 12 10 35 4 36 73 56 43 13 208 23 23 10 27 4 22
[271] 26 5 39 18 8 16 93 46 70 56 71 88 46 47 20 33 36 5
[289] 110 20 7 68 14 37 32 9 8 18 39 64 192 4 29 9 3 50
[307] 4 8 7 105 44 24 17 8 3 9 52 19 7 50 44 3 86 54
[325] 32 11 49 40 1 22 24 39 83 5 5 22 35 41 13 36 3 23
[343] 7 2 12 30 14 35 10 48 27 23 26 29 16 7 64 23 14 57
[361] 15 50 7 37 96 62 38 9 100 15 20 52 65 16 18 23 2 38
[379] 75 9 48 16 2 149 28 11 42 10 42 6 4 6 29 90 137 9
[397] 16 23 10 78 32 5 17 5 72 47 41 49 1 22 34 8 14 82
[415] 18 45 30 99 13 83 2 36 27 5 15 5 25 3 11 6 24 35
[433] 70 16 8 27 63 71 30 8 5 63 75 5 37 10 20 124 4 82
[451] 2 8 8 41 27 96 5 30 25 7 3 32 38 71 156 40 36 65
[469] 8 28 37 43 16 14 51 50 141 18 3 29 17 13 10 40 23 29
[487] 89 30 55 63 54 25 4 87 51 12 11 24 45 43 6 12 8 23
[505] 19 52 29 18 54 26 62 29 96 27 14 8 3 79 20 8 11 16
[523] 3 25 1 17 6 2 32 3 76 39 51 53 90 27 22 45 26 4
[541] 6 72 23 2 61 17 95 7 17 22 57 26 61 82 8 57 92 20
[559] 15 96 70 25 22 5 79 306 64 42 8 4 19 58 67 12

This is my data and i'm supposed to bin it into binwidth of 10. So what i think that means is that im supposed to find the frequency of 1-10,11-20,21-30 and so on. I need a R code for this and i have no clue where to start.

Supposedly we're meant to use a loop to do this.

Thanks to anyone who can help
 

YannY

Member
Joined
Aug 28, 2007
Messages
190
Gender
Male
HSC
2008
Sorry i couldn't up load the data file for you but if you know how to do this maybe you can show me via an example
 

Affinity

Active Member
Joined
Jun 9, 2003
Messages
2,062
Location
Oslo
Gender
Undisclosed
HSC
2003
try something like floor(v/10,0)*10 for that.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top