Category Archives: R

R: How to reshape data from wide to long format, and back again

Many studies take repeated observations on subjects. For example, clinical trials record outcomes from subjects before and after treatments, and laboratory studies might record physiological outcomes from the same subjects over time. In a dataframe, when observations from each subject are written on one row and repeated observations are stored as different column variables, we say the data are in

Read more

Add jitter to your figures using Python and R

Scientific figures are at their most informative when they include the individual data used to calculate summary statistics such as means and standard deviations. Why is showing data important? As previously pointed out here and here, figures with means, standard deviations, standard errors, etc. can be misleading and conceal the nature of the underlying data. As highlighted in our previous

Read more

Independent t-test in R

As scientists, we often want to know if the difference between two groups is important or significant. For example, you may have data on leg strength from students who came to class wearing dress shoes or running shoes. How would you decide if there was a difference in strength between these two groups? How would you quantify the size of

Read more

R: Analysing small datasets – Part 2

In the previous post we plotted repeated measures data from 10 subjects under 2 conditions. There are different ways to analyse small datasets. We could apply parametric methods to analyse the data values, such as describing the data with means and standard deviations, and calculating a paired difference. Or, we could also apply non-parametric methods by analysing data values based

Read more
« Older Entries