[英]Extracting ancillary date from array in R
I have an object called data
(representing a field of wind strengths at geographical locations) obtained by using some code to read in a.grib file:我有一个 object 称为
data
(表示地理位置的风强度场),通过使用一些代码读取 a.grib 文件获得:
> data
ecmf : u-component of wind
Time:
2020/07/09 z00:00 0-0 h
Domain summary:
601 x 351 domain
Projection summary:
proj= latlong
NE = ( 50 , 75 )
SW = ( -10 , 40 )
Data summary:
-89.06099 -50.08242 -41.13694 -43.42623 -34.77617 -25.03278
data
is 601 x 351
array of doubles: data
是601 x 351
的双精度数组:
> typeof(data)
[1] "double"
> is.array(data)
[1] TRUE
> dim(data)
[1] 601 351
but, as shown above, it also has extra information attached beyond the numerical values of the array elements ( Time:
, Projection summary
etc).但是,如上所示,除了数组元素的数值(
Time:
、 Projection summary
等)之外,它还附加了额外的信息。 How do I extract these?我如何提取这些? Attempts such as
data$time
do not seem to work.诸如
data$time
之类的尝试似乎不起作用。
As suggested in the comments to the question, I was able to access the values I wanted using attributes()
.正如问题评论中所建议的那样,我能够使用
attributes()
访问我想要的值。 attributes(data)
returns a list of all the relevant elements. attributes(data)
返回所有相关元素的列表。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.