Hi,
Just came across a little problem when practicing R. If I want to columns in d(except the first) to substract the first column in d, I make it based the example code. Is there anything not serious and reasonable, and other ways? And if some calculations between dataframes, dataframes must be equal size?
Any help would be appreciated.
d <- data.frame(n1 = c(7.3,12.5,18.4,15.0,11.8,13.7,10.2,9.5,7.6,2.5),
n2 = c(5.2,6.0,5.5,2.0,NA,6.7,5.6,3.5,10.4,6.8),
n3 = c(5.6,5.8,13.3,13.8,3.0,10.1,10.7,7.7,12.3,15.8),
n4 = c(6,3.3,2.6,3.8,19,23,24,25,29,2.9))
d1<-d[,-1]-d$n1
Created on 2023-06-03 with reprex v2.0.2