[R] correlation by factor

Marlin Keith Cox m@r||nkcox @end|ng |rom gm@||@com
Wed Jul 28 02:29:33 CEST 2021

I am having problems making a correlation/association between two variables
by a factor.

In the case below, I need to know the correlation between R and Day at each
frequency (a1-a5). Each frequency would have a corresponding correlation
between R and day.

I have found a lm function that is similar to what I need.
lm(R~Day*Freq), but this wont apply to the cor function.

Mind you, I have hundreds of these to with these same three columns, so if
there is an association package, I would be interested in those too.  I did
research it, but it quickly went over my head, so I thought I would
approach my problem this way.

Data is below.



M. Keith Cox, Ph.D.
17415 Christine Ave.
Juneau, AK 99801
U.S. 907.957.4606

	[[alternative HTML version deleted]]

More information about the R-help mailing list