Open Dataset
Data Structure ?
24K
Data Structure ?
*The above analysis is the result extracted and analyzed by the system, and the specific actual data shall prevail.
README.md
require(rgdal)
require(sp)
x<-"rgdal"
if (!require(x,character.only=TRUE))
{
install.packages(pkgs=x,dependencies = TRUE)
require(x,character.only=TRUE)
}
位置
location="C:/Users/acer/documents/R/data/India Map"
india1<- readOGR(dsn = location,"IND_adm1")
インドをプロットする
plot(india1)
slotNames(india1)
names(india1)
head(india1@data)
データセットに含まれる名前
head(india1$NAME_1,10)
サンプルとして1つの州をプロットする
plot(india1[india1$NAME_1=="Delhi",],col="red")
title("Delhi")
森林情報を含むファイルを読み込む
forestdata<-read.csv(file="C:/Users/acer/documents/R/data/Recorded_Forest_Area.csv", stringsAsFactors = FALSE)
head(forestdata)
names(forestdata)
名前が長すぎるので変更する
colnames(forestdata)<-c("state","statearea","forestarea2005","reserved","protected","unclassed","totalforestarea","forestareapercent")
names(forestdata)
head(forestdata)
今度は因子を文字型に変更する
india1$NAME_1 = as.character(india1$NAME_1)
forestdata$state=as.character(forestdata$state)
今度はマップとCSVファイルのデータがすべて一致しているか確認する
india1$NAME_1 %in% forestdata$state
不一致の行を返す
india1$NAME_1[which(!india1$NAME_1 %in% forestdata$state)]
問題は「and」の代わりに「&」が使われていること、そして州名の「Uttaranchal」が後に「Uttrakhand」に変更されたことである
#
関連する変更を行う
india1$NAME_1[grepl("Andaman and Nicobar",india1$NAME_1)]="Andaman & Nicobar"
india1$NAME_1[grepl("Dadra and Nagar Haveli",india1$NAME_1)]="Dadra & Nagar Haveli"
india1$NAME_1[grepl("Jammu and Kashmir",india1$NAME_1)]="Jammu & Kashmir"
india1$NAME_1[grepl("Daman and Diu",india1$NAME_1)]="Daman & Diu"
india1$NAME_1[grepl("Uttaranchal",india1$NAME_1)]="Uttarakhand"
今度は再度一致を確認する
india1$NAME_1%in%forestdata$state
The dataset is currently being organized and other channels have been prepared for you. Please use them
The dataset is currently being organized and other channels have been prepared for you. Please use them
- Share your thoughts
ALL
Data usage instructions: h1>
I. Data Source and Display Explanation:
- 1. The data originates from internet data collection or provided by service providers, and this platform offers users the ability to view and browse datasets.
- 2. This platform serves only as a basic information display for datasets, including but not limited to image, text, video, and audio file types.
- 3. Basic dataset information comes from the original data source or the information provided by the data provider. If there are discrepancies in the dataset description, please refer to the original data source or service provider's address.
II. Ownership Explanation:
- 1. All datasets on this site are copyrighted by their original publishers or data providers.
III. Data Reposting Explanation:
- 1. If you need to repost data from this site, please retain the original data source URL and related copyright notices.
IV. Infringement and Handling Explanation:
- 1. If any data on this site involves infringement, please contact us promptly, and we will arrange for the data to be taken offline.
- 1. The data originates from internet data collection or provided by service providers, and this platform offers users the ability to view and browse datasets.
- 2. This platform serves only as a basic information display for datasets, including but not limited to image, text, video, and audio file types.
- 3. Basic dataset information comes from the original data source or the information provided by the data provider. If there are discrepancies in the dataset description, please refer to the original data source or service provider's address.
- 1. All datasets on this site are copyrighted by their original publishers or data providers.
- 1. If you need to repost data from this site, please retain the original data source URL and related copyright notices.
- 1. If any data on this site involves infringement, please contact us promptly, and we will arrange for the data to be taken offline.