![]() So 7 corresponds only to 0, but 1 corresponds to 20 and 25 since the last two values of carb_tab are (1, 1) and the last two values of fives are (20, 25). You can see that what happened here was that the carb frequencies were taken in the order that they occurred ( 7, 10, 3, 10, 1, 1) and matched against the sequence of 5s ( 0, 5, 10, 15, 20, 25) in the order that they occurred. # This cross-tabulates the table of `carb` value frequencies with the sequence of fivesĬreated on by the reprex package (v0.2.0) # same length as our table of `carb` value frequencies ![]() # Now we'll make a sequence of multiples of 5 that's the # This produces a frequency table of the values in `carb` In this case, it is being set to mean and thereby producing the mean value of the x vector. In my example, mtcars$carb stands in for your GAGurine.GAG: # Let's use this as our sample vector to start with In this example, we have the ave() function setting the averaging function properly. Like I suspect you're actually trying to do something else, but here's an example to illustrate what this operation achieves if the sequence of fives is the right length. This is trying to cross-tabulate your existing table (a 1-dimensional array of GAGurine.GAG frequencies) with a vector of integers that count by 5s. One strategy for the 2nd question would be to use dplyr's group_by and summarize functions, first replicate the counting you did with table, then again to count those counts: GAGurine_counts % One strategy for the 1st question would be to add a column showing which group you want each GAG value to go into. how many values showed up 0-5 times, how many values showed up 5-10 times, etc. how many results have a GAG value between 0 and 5, how many are in the range 5-10, etc.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |