我不知道如何使用head函数来满足我的需要
small<- "Chicago_small.xlsx"
head(small, n=10)
发布于 2022-03-10 08:53:50
尝试一些类似于…的东西
small[1:10, 1:5]
发布于 2022-03-10 12:02:26
有效R规划中的Colin建议在RProfile中添加以下函数:
# ht == headtail
# Show the first 6 rows & last 6 rows of a data frame
ht = function(d, n=6) rbind(head(d, n), tail(d, n))
# Show the first 5 rows & first 5 columns of a data frame
hh = function(d) d[1:5, 1:5]
然后,您将能够运行hh(mtcars)
以获得下面的快速摘要:
>> hh(mtcars)
mpg cyl disp hp drat
Mazda RX4 21.0 6 160 110 3.90
Mazda RX4 Wag 21.0 6 160 110 3.90
Datsun 710 22.8 4 108 93 3.85
Hornet 4 Drive 21.4 6 258 110 3.08
Hornet Sportabout 18.7 8 360 175 3.15
https://stackoverflow.com/questions/71421145
复制相似问题