I have a large data set
of the following format
:
First column is type
, and the subsequent columns
are different times that 'type'
happens. I want to calculate the slope of each row (~7000 rows)
for subset T0-T2
and then t0-t2
and output that information, then get the average of the slopes for each row. For example, get the slope of subset T0-T2 and of t0-t2 for type1 then get an average of the two values for row type1.
Some rows have missing data entirely, while some are missing either a single or two values.
Type T0 T1 T2 t0 t1 t2
type1 0.2 0.3 0.4 0.3 0.2 0.1
type2 1.4 2.5 3.4 1.5 0.5 3.4
type3 0.4 8.1 8.1 2.2
type4
...
I am a beginner in R
, and so it has been challenging trying to do this, as much as in my head it seems simple. I am getting errors in the missing values (NA) and I will appreciate any ideas, or directions to a similar question on this site. Thanks