using contour() in R to make shapefiles [closed] - r

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
How to use the output from contour(), which is just x, y and z data, to make a shapefile of the contour lines for output into ArcMap?

As a matter of fact there is a function for that in package maptools: ContourLines2SLDF converts the output of contourLines into a SpatialLinesDataFrame object.
cl <- contourLines(volcano)
shp <- ContourLines2SLDF(cl)
You can then save it to a file using maptools's writeSpatialShape or rgdal's writeOGR.

Related

R prophet select dates [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
I have a question about R prophet. I can plot the forecast using:
plot(
prophet_plot[[1]],
prophet_plot[[2]])
However, I would like to plot only the past X data points before the forecast and the forecast itself.
Namely, I am using data from 2013-01-01 until 2018-11-25 and making a forecast until 2018-12-25. What I would like to see on the plot is the data+forecast from 2015-11-25 until 2018-12-25.
So basically an xlim, but on a Prophet object.
Could someone help me with this?
Cheers,
Irina

Plotting Location data in R [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
Can anyone please tell me how to plot location data in the R language?
Suppose I have data "Date-time" with X and Y coordinates (latitude and Longitude) as mentioned below;I am trying to do in R language.
Date: 2016-02-25 17:21:09.147,
Location (2.39, 48.71)
To visualise your 3D data, you can use plot3d and combine it with datetick to format the time axes.

how to plot this function in R [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I know that looks like a silly question but how can I plot this function,
|x|+|y|=z
in 2D by R. I know that is a kind of contour plot but don't know how to manage that.
you can use contour and try this small example
X=seq(-1, 1, length.out=10)
Y=seq(-1, 1, length.out=10)
Z=outer(X, Y, FUN= function(x,y) abs(x)+abs(y))
contour(x=X, y=Y, z=Z)

passing a data frame to a function in R language [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I want to pass a data frame to a function as an argument. And then inside the function, I want to work on different combinations of columns for graphical presentation. Basically, I want to do graphical presentation on different data files. I want that, I pass the data file as an argument and then get the graphs. How can I do this in R.
You are not giving us much info but here is a very basic starting point:
library(ggplot2) # if you don't have this library run install.packages('ggplot2')
myAmazingFunction <- function(myDF) {
ggplot(myDF,aes(X,Y))+geom_line()
}
df <-data.frame(X=1:30, Y=runif(30), Z=1.3*runif(30))
myAmazingFunction(df)

R : Do not understanding the objective of a code [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
Given the following setup:
area.factor <- cut(state.x77[,"Area"],
breaks=quantile(state.x77[,"Area"],c(0,.25,.75,1)),
labels=c("small","medium","large"),
include.lowest=TRUE)
state <- data.frame(pop=state.x77[,"Population"],
inc=state.x77[,"Income"],
area=area.factor,
region=state.region)
pop.area.region <- with(state,ftable(pop,area,region))
The following two lines of code are show the same result:
head(ftable(prop.table(pop.area.region,margin=2)))
head(prop.table(pop.area.region,margin=2))
I don't understand what effect adding ftable has, if any, in:
head(ftable(prop.table(pop.area.region,margin=2)))
Adding ftable witll try to coerce the pop.area.region to a ftable class. Here
No need to add ftable since pop.area.region is already an ftable.
identical(ftable(prop.table(pop.area.region,margin=2)),
prop.table(pop.area.region,margin=2))
TRUE

Resources