问题陈述
我有一个名为'New_Blue'的数据框(请参见下文),我想通过使用'subset()'函数'dplyr'软件包。
我知道这个问题已被问过无数次,但是在咨询Stack Overflow和其他论坛后,作为R用户没有经验,我仍然无法解决我的问题。
在整个分析过程中,除了“ 9月” 和“ 10月” 之外,我成功地划分了所有月份的数据框。
运行代码时,'9月'和 '10月'的结果在下面显示此错误:
<0 rows> (or 0-length row.names)
<0行>(或长度为0的row.names)。如检查所示,这发生在变量名末尾有空格或没有值的情况下。但是,没有列缺少值,并且数据框具有536个观测值。
我已经重新检查了数据帧是否存在不一致的错误,但是我找不到任何错误,我用零填充所有空单元格,我想知道问题是否出在行逻辑与行号与行名之间。
经过数小时的广泛研究,我仍然无法解决这个问题!
有人可以帮忙吗?
在此先感谢您,我将不胜感激!
R代码:
##Set the seed
set.seed(45L)
##Change the format of the columns
New_Blue$Year<-as.numeric(New_Blue$Year)
New_Blue$Month<-as.factor(New_Blue$Month)
New_Blue$Latitude<-as.numeric(New_Blue$Latitude)
New_Blue$Longitude<-as.numeric(New_Blue$Longitude)
New_Blue$Best<-as.numeric(New_Blue$Best)
##Structure of the data
str(New_Blue)
##Results
New_Blue$Year<-as.numeric(New_Blue$Year)
New_Blue$Month<-as.factor(New_Blue$Month)
New_Blue$Latitude<-as.numeric(New_Blue$Latitude)
New_Blue$Longitude<-as.numeric(New_Blue$Longitude)
New_Blue$Best<-as.numeric(New_Blue$Best)
尝试解决问题
##Is the problem the row logicals vs row numbers vs row names?
New_Blue_Data <- New_Blue[1:536, ]
New_Blue_Data[rep(TRUE, 536), ]
#Convert NA's to zero's
New_Blue[is.na(New_Blue)] <- 0
按月子集数据:
package(dplyr)
##Subset the data frame by the column 'Month'
January_Whales<-subset(Blue, Month == "January")
February_Whales<-subset(Blue, Month == "February")
March_Whales<-subset(Blue, Month == "March")
April_Whales<-subset(Blue, Month == "April")
May_Whales<-subset(Blue, Month == "May")
August_Whales<-subset(Blue, Month == "August")
September_Whales<-subset(Blue, Month == "September")
October_Whales<-subset(Blue, Month == "October")
November_Whales<-subset(Blue, Month == "November")
December_Whales<-subset(Blue, Month == "December")
##Error message
September_Whales
[1] Year Month Latitude Longitude Best
<0 rows> (or 0-length row.names)
October_Whales
[1] Year Month Latitude Longitude Best
<0 rows> (or 0-length row.names)
数据框:
structure(list(Year = c(2015L, 2015L, 2015L, 2015L, 2015L, 2015L,
2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L,
2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L,
2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L,
2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L,
2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L,
2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L,
2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L,
2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L,
2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L,
2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L,
2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L,
2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L,
2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L,
2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L,
2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L,
2015L, 2015L, 2015L, 2015L, 2015L, 2016L, 2016L, 2016L, 2016L,
2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
2016L, 2016L, 2016L, 2016L, 2016L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L), Month = structure(c(6L,
6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 5L, 5L, 5L, 5L,
5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 8L, 8L, 8L, 8L, 8L, 8L, 8L,
8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L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,
10L, 10L, 10L, 10L, 10L, 10L, 10L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L,
6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L,
5L, 5L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L,
8L, 8L, 8L, 8L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L,
9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 7L, 7L, 7L, 7L, 7L, 7L,
7L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 13L, 13L, 13L,
13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L,
13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L,
13L, 13L, 13L, 13L, 13L, 13L, 12L, 12L, 12L, 12L, 12L, 12L, 12L,
12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L,
12L, 12L, 12L, 12L, 12L, 12L, 12L, 11L, 11L, 11L, 11L, 11L, 11L,
11L, 11L, 11L, 11L, 11L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L), .Label = c("April", "August", "August ", "December",
"February", "January", "July ", "March", "May", "November", "November ",
"October ", "September "), class = "factor"), Latitude = c(5.832,
5.836, 5.83, 5.823, 5.823, 5.83, 5.803, 5.803, 5.886, 5.858,
5.931, 5.931, 5.865, 5.761, 5.859, 5.911, 5.919, 5.82, 5.841,
5.799, 5.776, 5.83, 5.797, 5.787, 5.795, 5.795, 5.807, 5.808,
5.807, 5.811, 5.762, 5.74, 5.773, 5.846, 5.78, 5.816, 5.831,
5.813, 5.785, 5.81, 5.819, 5.795, 5.801, 5.77, 5.853, 5.834,
5.814, 5.799, 5.826, 5.826, 5.829, 5.834, 5.878, 5.862, 5.925,
5.88, 5.867, 5.833, 5.8, 5.803, 5.809, 5.817, 5.847, 5.878, 5.879,
5.842, 5.83, 5.834, 5.873, 5.786, 5.833, 5.821, 5.821, 5.836,
5.836, 5.836, 5.828, 5.838, 5.828, 5.82, 5.8, 5.86, 5.841, 5.864,
5.862, 5.901, 5.841, 5.844, 5.844, 5.843, 5.836, 5.838, 5.757,
5.836, 5.869, 5.667, 5.818, 5.802, 5.8, 5.809, 5.725, 5.715,
5.722, 5.674, 5.706, 5.679, 5.814, 5.85, 5.839, 5.839, 5.823,
5.836, 5.832, 5.88, 5.781, 5.83, 5.875, 5.875, 5.782, 5.825,
5.856, 5.849, 5.797, 5.767, 5.78, 5.812, 5.806, 5.827, 5.847,
5.819, 5.804, 5.795, 5.867, 5.859, 5.811, 5.804, 5.865, 5.781,
5.816, 5.82, 5.83, 5.815, 5.822, 5.808, 5.789, 5.822, 5.789,
5.822, 5.87, 5.828, 5.824, 5.852, 5.864, 5.86, 5.845, 5.866,
5.758, 5.805, 5.842, 5.838, 5.838, 5.783, 5.853, 5.868, 5.883,
5.88, 5.803, 5.787, 5.811, 5.748, 5.826, 5.818, 5.783, 5.794,
5.779, 5.818, 5.754, 5.811, 5.754, 5.846, 5.846, 5.834, 5.79,
5.794, 5.885, 5.823, 5.787, 5.869, 5.76, 5.841, 5.783, 5.887,
5.847, 5.82, 5.812, 5.789, 5.805, 5.797, 5.904, 5.806, 5.843,
5.829, 5.841, 5.829, 5.839, 5.821, 5.806, 5.825, 5.836, 5.829,
5.812, 5.825, 5.816, 5.821, 5.857, 5.799, 5.839, 5.841, 5.837,
5.806, 5.855, 5.857, 5.849, 5.817, 5.805, 5.822, 5.853, 5.852,
5.838, 5.873, 5.803, 5.817, 5.848, 5.826, 5.789, 5.796, 5.837,
5.827, 5.83, 5.827, 5.823, 5.816, 5.822, 5.87, 5.863, 5.847,
5.839, 5.774, 5.8, 5.834, 5.838, 5.826, 5.826, 5.835, 5.841,
5.858, 5.363, 5.857, 5.856, 5.853, 5.857, 5.863, 5.835, 5.834,
5.842, 5.846, 5.849, 5.838, 5.833, 5.828, 5.837, 5.838, 5.811,
5.833, 5.869, 5.91, 5.863, 5.833, 5.831, 5.805, 5.826, 5.85,
5.821, 5.81, 5.805, 5.824, 5.821, 5.846, 5.845, 5.806, 5.817,
5.805, 5.819, 5.814, 5.819, 5.815, 5.812, 5.804, 5.814, 5.826,
5.825, 5.807, 5.82, 5.812, 5.824, 5.798, 5.831, 5.81, 5.792,
5.816, 5.802, 5.767, 5.761, 5.727, 5.76, 5.86, 5.789, 5.894,
5.798, 5.848, 5.821, 5.829, 5.794, 0, 5.805, 5.734, 5.776, 5.749,
5.83, 5.775, 5.824, 5.833, 5.82, 5.863, 5.835, 5.775, 5.761,
5.753, 5.849, 5.839, 5.836, 5.801, 5.837, 5.84, 5.862, 5.843,
5.859, 5.849, 5.863, 5.842, 5.838, 5.862, 5.846, 5.873, 5.844,
5.84, 5.876, 5.844, 5.872, 5.84, 5.836, 5.84, 5.855, 5.829, 5.807,
5.827, 5.837, 5.831, 5.875, 5.849, 5.841, 5.837, 5.803, 5.895,
5.769, 5.825, 5.829, 5.827, 5.81, 5.865, 5.787, 5.807, 5.821,
5.823, 5.848, 5.847, 5.902, 5.868, 5.868, 5.825, 5.837, 5.817,
5.817, 5.813, 5.839, 5.839, 5.843, 5.825, 5.973, 5.856, 5.856,
5.829, 5.844, 5.859, 5.839, 5.821, 5.832, 5.833, 5.842, 5.842,
5.842, 5.842, 5.842, 5.842, 5.842, 5.842, 5.85, 5.807, 5.847,
5.845, 5.842, 5.804, 5.793, 5.842, 5.822, 5.842, 5.844, 5.83,
5.824, 5.822, 5.806, 5.789, 5.816, 5.804, 5.888, 5.831, 5.828,
5.812, 5.822, 5.835, 5.835, 5.859, 5.811, 5.764, 5.782, 5.797,
5.825, 5.824, 5.841, 5.871, 5.823, 5.841, 5.787, 5.812, 5.802,
5.807, 5.758, 5.792, 5.789, 5.791, 5.826, 5.774, 5.809, 5.821,
5.76, 5.747, 5.846, 5.827, 5.813, 5.815, 5.864, 5.823, 5.779,
5.77, 5.815, 5.79, 5.811, 5.823, 5.789, 5.828, 5.842, 5.787,
5.81, 5.794, 5.811, 5.737, 5.75, 5.737, 5.729, 5.775, 5.772,
5.832, 5.832, 5.847, 5.748, 5.754, 5.824, 5.795, 5.769, 5.77,
5.815, 5.738, 5.837, 5.822, 5.829, 5.812, 5.845, 5.82, 5.827,
5.802, 5.821, 5.859, 5.88, 5.853, 5.854, 5.84, 5.805, 5.85, 5.848,
5.844, 5.823, 5.877, 5.853, 5.78, 5.805, 5.844, 5.808, 5.84,
5.842, 5.822, 5.819, 5.787, 5.788, 5.797, 5.869, 5.822), Longitude = c(80.35,
80.326, 80.275, 80.281, 80.216, 80.112, 80.287, 80.17, 80.441,
80.453, 80.431, 80.431, 80.469, 80.452, 80.502, 80.453, 80.441,
80.28, 80.181, 80.177, 80.13, 80.533, 80.436, 80.442, 80.629,
80.64, 80.712, 80.668, 80.611, 80.438, 80.493, 80.53, 80.501,
80.519, 80.519, 80.619, 80.572, 80.581, 80.581, 80.507, 80.574,
80.526, 80.52, 80.509, 80.468, 80.42, 80.369, 80.344, 80.39,
80.447, 80.491, 80.403, 80.444, 80.47, 80.439, 80.422, 80.411,
80.483, 80.433, 80.419, 80.503, 80.53, 80.503, 80.489, 80.558,
80.621, 80.712, 80.746, 80.556, 80.675, 80.462, 80.496, 80.497,
80.533, 80.45, 80.508, 80.53, 80.497, 80.503, 80.52, 80.463,
80.491, 80.603, 80.424, 80.46, 80.445, 80.472, 80.503, 80.393,
80.403, 80.421, 80.471, 80.418, 80.391, 80.607, 80.603, 80.449,
80.435, 80.436, 80.428, 80.41, 80.374, 80.381, 80.554, 80.469,
80.567, 80.634, 80.483, 80.548, 80.548, 80.605, 80.617, 80.554,
80.474, 80.459, 80.486, 80.486, 80.486, 80.483, 80.378, 80.376,
80.441, 80.405, 80.393, 80.423, 80.373, 80.492, 80.727, 80.611,
80.39, 80.286, 80.451, 80.594, 80.435, 80.471, 80.448, 80.462,
80.522, 80.471, 80.541, 80.526, 80.471, 80.455, 80.419, 80.411,
80.448, 80.411, 80.448, 80.436, 80.383, 80.361, 80.42, 80.45,
80.477, 80.488, 80.476, 80.492, 80.54, 80.602, 80.601, 80.617,
80.572, 80.511, 80.475, 80.423, 80.366, 80.404, 80.432, 80.531,
80.539, 80.456, 80.616, 80.667, 80.68, 80.662, 80.431, 80.544,
80.381, 80.334, 80.559, 80.579, 80.59, 80.45, 80.654, 80.5, 80.671,
80.553, 80.397, 80.604, 80.689, 80.65, 80.62, 80.818, 80.676,
80.737, 80.609, 80.672, 80.71, 80.537, 80.611, 80.468, 80.434,
80.459, 80.451, 80.443, 80.351, 80.369, 80.583, 80.491, 80.697,
80.675, 80.768, 80.707, 80.671, 80.622, 80.705, 80.436, 80.424,
80.441, 80.437, 80.544, 80.555, 80.535, 80.564, 80.543, 80.424,
80.475, 80.434, 80.449, 80.443, 80.518, 80.498, 80.515, 80.43,
80.436, 80.378, 80.404, 80.373, 80.391, 80.354, 80.286, 80.246,
80.398, 80.26, 80.391, 80.364, 80.335, 80.492, 80.51, 80.442,
80.432, 80.46, 80.46, 80.455, 80.425, 80.422, 80.475, 80.449,
80.481, 80.442, 80.47, 80.458, 80.508, 80.507, 80.501, 80.528,
80.528, 80.52, 80.493, 80.489, 80.5, 80.5, 80.557, 80.454, 80.464,
80.448, 80.45, 80.477, 80.487, 80.509, 80.5, 80.463, 80.453,
80.436, 80.483, 80.458, 80.461, 80.444, 80.459, 80.246, 80.176,
80.151, 80.144, 80.15, 80.401, 80.488, 80.45, 80.382, 80.413,
80.426, 80.431, 80.425, 80.388, 80.378, 80.448, 80.6, 80.334,
80.665, 80.425, 80.596, 80.495, 80.634, 80.436, 80.352, 80.847,
80.389, 80.404, 80.32, 80.394, 80.381, 80.433, 80.435, 80.276,
80.16, 80.385, 80.274, 80.275, 80.262, 80.275, 80.331, 80.656,
80.55, 80.494, 80.56, 80.27, 80.475, 80.481, 80.55, 80.58, 80.6,
80.539, 80.59, 80.477, 80.463, 80.471, 80.513, 80.539, 80.519,
80.464, 80.384, 80.387, 80.53, 80.527, 80.473, 80.527, 80.545,
80.576, 80.401, 80.582, 80.534, 80.488, 80.518, 80.49, 80.507,
80.489, 80.533, 80.555, 80.482, 80.45, 80.462, 80.478, 80.514,
80.607, 80.484, 80.565, 80.358, 80.42, 80.429, 80.364, 80.386,
80.399, 80.392, 80.29, 80.344, 80.497, 80.5, 80.415, 80.413,
80.413, 80.473, 80.51, 80.394, 80.386, 80.318, 80.431, 80.414,
80.416, 80.365, 80.455, 80.452, 80.461, 80.429, 80.459, 80.456,
80.419, 80.412, 80.454, 80.387, 80.387, 80.421, 80.421, 80.421,
80.421, 80.438, 80.438, 80.438, 80.438, 80.437, 80.437, 80.44,
80.441, 80.442, 80.45, 80.349, 80.449, 80.502, 80.437, 80.585,
80.539, 80.314, 80.462, 80.387, 80.34, 80.325, 80.427, 80.524,
80.546, 80.609, 80.377, 80.432, 80.414, 80.449, 80.504, 80.368,
80.402, 80.553, 80.592, 80.602, 80.537, 80.481, 80.558, 80.513,
80.432, 80.432, 80.47, 80.515, 80.337, 80.427, 80.41, 80.447,
80.514, 80.446, 80.459, 80.465, 80.416, 80.449, 80.427, 80.5,
80.54, 80.49, 80.462, 80.472, 80.361, 80.231, 80.254, 80.216,
80.18, 80.112, 80.074, 80.443, 80.454, 80.391, 80.409, 80.43,
80.433, 80.645, 80.378, 80.283, 80.319, 80.399, 80.418, 80.412,
80.412, 80.44, 80.435, 80.466, 80.488, 80.452, 80.441, 80.433,
80.404, 80.392, 80.42, 80.487, 80.542, 80.605, 80.557, 80.402,
80.47, 80.46, 80.417, 80.402, 80.427, 80.414, 80.41, 80.387,
80.19, 80.319, 80.454, 80.12, 80.119, 80.391, 80.402, 80.314,
80.304, 80.42, 80.403, 80.537, 80.44, 80.377, 80.492, 80.559,
80.553, 80.554, 80.594, 80.32), Best = c(1L, 3L, 12L, 7L, 4L,
15L, 2L, 2L, 1L, 1L, 1L, 2L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 2L, 1L, 2L, 1L, 3L, 1L, 3L, 1L, 1L, 5L, 1L, 4L, 1L, 1L, 1L,
1L, 1L, 1L, 3L, 2L, 2L, 3L, 2L, 9L, 6L, 6L, 6L, 7L, 3L, 3L, 4L,
4L, 2L, 1L, 8L, 1L, 3L, 6L, 2L, 1L, 7L, 6L, 2L, 3L, 2L, 1L, 1L,
1L, 1L, 1L, 1L, 2L, 2L, 2L, 3L, 1L, 2L, 3L, 1L, 1L, 1L, 2L, 8L,
8L, 1L, 4L, 4L, 5L, 10L, 4L, 1L, 1L, 1L, 1L, 2L, 1L, 4L, 1L,
1L, 1L, 1L, 1L, 2L, 2L, 1L, 1L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 2L, 1L, 2L, 3L,
11L, 2L, 1L, 3L, 1L, 4L, 8L, 3L, 6L, 4L, 20L, 20L, 20L, 9L, 14L,
4L, 5L, 3L, 2L, 4L, 12L, 9L, 10L, 15L, 3L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 2L, 3L, 1L, 1L, 1L, 1L, 3L, 1L, 1L, 3L, 3L, 1L, 2L, 1L,
1L, 4L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 3L,
1L, 1L, 2L, 1L, 1L, 1L, 5L, 1L, 3L, 1L, 7L, 3L, 1L, 1L, 1L, 1L,
7L, 1L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, 2L, 4L, 8L, 1L, 8L, 6L, 5L,
3L, 6L, 10L, 10L, 1L, 3L, 1L, 10L, 10L, 10L, 4L, 10L, 4L, 6L,
1L, 7L, 6L, 1L, 5L, 1L, 7L, 7L, 3L, 10L, 8L, 8L, 3L, 4L, 1L,
1L, 1L, 7L, 1L, 8L, 5L, 12L, 10L, 12L, 2L, 3L, 3L, 3L, 10L, 1L,
10L, 10L, 15L, 2L, 3L, 10L, 10L, 1L, 6L, 7L, 2L, 4L, 3L, 10L,
1L, 1L, 2L, 1L)), class = "data.frame", row.names = c(NA, -536L
))
答案 0 :(得分:1)
以R为基准的底线(分成12个数据框-带入全局环境):
list2env(split(df, df$Month), .GlobalEnv)
一个R底线(在列表中存储12个数据帧):
# Split the dataframe up into a list of dataframes by the month:
month_list <- split(df, df$Month)
# Name the dataframes appropriately:
names(month_list) <- paste0(trimws(unique(df$Month), "both"), "_Whales")