Может ли кто-нибудь помочь мне понять, как действительный r-код скрипта вызывает утилизацию документа в rStudio, чтобы висеть и не реагировать на то, что мне нужно прекратить сеанс и среду IDE? Ни один документ не вяжется ниРабочий код сценария R не работает в Markdown - RStudio висит
Справочная информация:
- Пробовал на 2 разных машинах, работает последняя версия rStudio 0.99.489 и R 3.2.2 (64Bit) на ОС Windows 7 & для Windows 10.
- Пробовал использовать packrat для управления пакетами
- Пробовал загружать файл формы из каталога проекта
- Пробовал загружать другой файл формы из spdep pr роект загрузить
- Пробовал переустановить пакеты снова
R Script Получить необходимые библиотеки и загрузить их
#Install the GIS packages
install.packages("spdep",dependencies = TRUE)
install.packages("maptools",dependencies = TRUE)
#Load the libraries
library(spdep)
library(maptools)
Это работает в R (вам нужно будет получить правильное место для файл формы в вашей системе)
#See where the library files are stored
.libPaths()
#Load the Eire shape file which came in spdep package using the readShapePoly function from maptools (needed to change the slashes from windows to those supported in R)
eireMap <- readShapePoly("C:R/3.2/spdep/etc/shapes/eire.shp"[1],ID="names", proj4string=CRS("+proj=utm +zone=30 +units=km"))
#Plot the map as there was no problem reading the shape file correctly in R script
plot(eireMap)
R Markdown
---
title: "GIS using R"
author: "Me"
date: "18 November 2015"
output: word_document
---
This is an R Markdown document of the R worksheet for GIS. Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code contained in that snippet
```{r, echo=FALSE}
#Install the packages if not done already
install.packages("spdep",dependencies = TRUE)
install.packages("maptools",dependencies = TRUE)
```
Load the libraries
```{r, echo=FALSE}
library(spdep)
library(maptools)
```
See where the library files are stored
```{r}
.libPaths()
```
Try to Load the Eire shape file but it causes R Studio to hang and become unresponsive
```{r}
eireMap <- readShapePoly("C:R/win- library/3.2/spdep/etc/shapes/eire.shp"[1],ID="names", proj4string=CRS("+proj=utm +zone=30 +units=km"))
```
Can't plot the map because the system has hung by this stage
```{r}
plot(eireMap)
names(eireMap)
eireMap $names
```
Строки кода для создания '' eireMap кажутся различными, это намеренно? – Heroka
FWIW 'system.file (" etc/shapes/eire.shp ", package =" spdep ")' - это правильный способ добраться до этого шейп-файла. Кроме того, почему вы принудительно переустанавливаете пакеты каждый раз, когда вы вязать? – hrbrmstr