我有一个由类似结构的数据构成的矩阵:
airport.departure <- c("CDG", "QNY", "QXO", "CDG", "QNY")
airport.arrival <- c("SYD", "CDG", "QNY", "SYD", "QXO")
amount <- c(1, 3, 1, 10, 5)
df <- data.frame(airport.departure, airport.arrival, amount)
xtabs(amount ~ airport.arrival + airport.departure
结果如下:
airport.departure
airport.arrival CDG QNY QXO
CDG 0 3 0
QNY 0 0 1
QXO 0 5 0
SYD 11 0 0
现在,我需要过滤掉包含非常少量值的行/列。仅显示包含总数据超过10%的行/列。