r

Unequal horizontal adjustment to title lines in ggplot

泪湿孤枕 提交于 2021-02-10 12:06:22
问题 I've got a plot with a fairly wide y-axis label, so I want to adjust the title to the left so that it's flush with the label rather than the axis (like this question) but the twist is that I have a multiline title. I've been using hjust, but it adjusts the two lines differently. For example ggplot(mtcars,aes(x=wt,y=mpg))+ geom_point()+ ggtitle("Figure: My long and winding title\nthat goes on and on and on") + ylab("My long label") + theme_bw() + theme(plot.title = element_text(size=16, hjust=

Osmar package in R “Error in file(con, ”r“) : cannot open the connection”

故事扮演 提交于 2021-02-10 12:05:56
问题 I am trying to run the osmar package on my windows 10, R 3.4.2, and have correctly installed osmosis. However when I try to run the code: >library("osmar") > >src <- osmsource_osmosis(file = "c:/users/ben_c/Documents/FYP/FYP_NL_Map/muenchen.osm", osmosis = "osmosis") > > >nl_bbox <- center_bbox(11.575278, 48.137222, 3000, 3000) > >nl <- get_osm(nl_bbox, src) > >plot(nl) I get the warning, after osmosis has run: >Error in file(con, "r") : cannot open the connection >In addition: Warning

Convert NULL from Python to R using rpy2

南楼画角 提交于 2021-02-10 12:05:45
问题 In R often the NULL value is used as default. Using Python and RPy2, how can one explicitly provide a NULL argument? None is not convertible ( NotImplementedError ), a string 'NULL' will just be converted to a string and result in an error during execution. Take the following example using the tsintermittent package: import numpy as np from rpy2.robjects.packages import importr from rpy2.robjects import numpy2ri numpy2ri.activate() tsintermittent = importr('tsintermittent') crost =

Osmar package in R “Error in file(con, ”r“) : cannot open the connection”

坚强是说给别人听的谎言 提交于 2021-02-10 12:05:02
问题 I am trying to run the osmar package on my windows 10, R 3.4.2, and have correctly installed osmosis. However when I try to run the code: >library("osmar") > >src <- osmsource_osmosis(file = "c:/users/ben_c/Documents/FYP/FYP_NL_Map/muenchen.osm", osmosis = "osmosis") > > >nl_bbox <- center_bbox(11.575278, 48.137222, 3000, 3000) > >nl <- get_osm(nl_bbox, src) > >plot(nl) I get the warning, after osmosis has run: >Error in file(con, "r") : cannot open the connection >In addition: Warning

Unequal horizontal adjustment to title lines in ggplot

喜夏-厌秋 提交于 2021-02-10 12:04:59
问题 I've got a plot with a fairly wide y-axis label, so I want to adjust the title to the left so that it's flush with the label rather than the axis (like this question) but the twist is that I have a multiline title. I've been using hjust, but it adjusts the two lines differently. For example ggplot(mtcars,aes(x=wt,y=mpg))+ geom_point()+ ggtitle("Figure: My long and winding title\nthat goes on and on and on") + ylab("My long label") + theme_bw() + theme(plot.title = element_text(size=16, hjust=

Unequal horizontal adjustment to title lines in ggplot

旧时模样 提交于 2021-02-10 12:04:58
问题 I've got a plot with a fairly wide y-axis label, so I want to adjust the title to the left so that it's flush with the label rather than the axis (like this question) but the twist is that I have a multiline title. I've been using hjust, but it adjusts the two lines differently. For example ggplot(mtcars,aes(x=wt,y=mpg))+ geom_point()+ ggtitle("Figure: My long and winding title\nthat goes on and on and on") + ylab("My long label") + theme_bw() + theme(plot.title = element_text(size=16, hjust=

Osmar package in R “Error in file(con, ”r“) : cannot open the connection”

前提是你 提交于 2021-02-10 12:04:49
问题 I am trying to run the osmar package on my windows 10, R 3.4.2, and have correctly installed osmosis. However when I try to run the code: >library("osmar") > >src <- osmsource_osmosis(file = "c:/users/ben_c/Documents/FYP/FYP_NL_Map/muenchen.osm", osmosis = "osmosis") > > >nl_bbox <- center_bbox(11.575278, 48.137222, 3000, 3000) > >nl <- get_osm(nl_bbox, src) > >plot(nl) I get the warning, after osmosis has run: >Error in file(con, "r") : cannot open the connection >In addition: Warning

Convert NULL from Python to R using rpy2

此生再无相见时 提交于 2021-02-10 12:04:04
问题 In R often the NULL value is used as default. Using Python and RPy2, how can one explicitly provide a NULL argument? None is not convertible ( NotImplementedError ), a string 'NULL' will just be converted to a string and result in an error during execution. Take the following example using the tsintermittent package: import numpy as np from rpy2.robjects.packages import importr from rpy2.robjects import numpy2ri numpy2ri.activate() tsintermittent = importr('tsintermittent') crost =

Manually bootstrapping linear regression in R

早过忘川 提交于 2021-02-10 11:53:05
问题 |Hi guys, I am asking you for help as I am stucked with bootstrapping... The task is: Use the nonparametric bootstrap to compute bootstrap standard error of CAPM beta estimate based on 1000 bootstrap replications and bootstrap sample size equal to the size of the original sample. If I understand it correctly, I am supposed to run my regression model 1000 times to estimate different estimates of the beta and its standard error. However, I am not able to put my thoughts into an actual R code.

Can't Calculate pixel-wise regression in R on raster stack with fun

三世轮回 提交于 2021-02-10 11:51:00
问题 I am working with rasters and I've a RasterStack with 7n layers. I would like to calculate pixel-wise regression, using formula beneath. I was trying to do it with raster::calc , but my function failed with message : 'Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) : 0 (non-NA) cases.' But all rasters are OK, and contain numbers (not only NAs), I can plot it, and I can calculate general linear regression with formula cr.sig=lm (raster::as.array(MK_trend.EVI.sig_Only) ~