Re: [R] ISO recommendations for plot output format from R to MS Word

2021-02-12 Thread Ivan Krylov
On Fri, 12 Feb 2021 15:05:33 -0800
Robert Dodier  wrote:

> Towards the goal of creating an MS Word document which others with
> unspecified versions of MS Word can view correctly, in what format
> should I export figures from R?

A cross-platform plotting device designed specifically for word
processors is devEMF. In my experience, best compatibility with Word
can be achieved by creating figures with parameters (emfPlus = TRUE,
emfPlusFont = FALSE, emfPlusRaster = TRUE), but I only checked Word
2003 and 2010 (for Windows).

-- 
Best regards,
Ivan

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Plotting world maps with locations.

2021-02-12 Thread David Winsemius



Sent from my iPhone

> On Feb 12, 2021, at 9:01 PM, David Winsemius  wrote:
> 
> 
> 
> Sent from my iPhone
> 
>> On Feb 12, 2021, at 1:35 PM, Jibrin Alhassan  
>> wrote:
>> 
>> Hello Romanus,
>> You are to post only the code and the error messages and not all the
>> information from your terminal in R session.
> 
> That’s not actually the best practice for rhelp questions. More info is 
> better than less. What’s missing, however, is the data. 
> 
> — 
> David
>> 
>>> On Fri, Feb 12, 2021, 4:35 PM Romanus Ejike 
>>> wrote:
>>> 
>>> Please, I need help from anyone that can solve this problem.
>>> I wanted to plot a world map with locations and names of the locations but
>>> could not. The codes I have tried are as shown below.
>>> ugwoke@ugwoke-HP-ENVY-Laptop-13-aq0xxx:~/Desktop$ R
>>> 
>>> R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
>>> Copyright (C) 2020 The R Foundation for Statistical Computing
>>> Platform: x86_64-pc-linux-gnu (64-bit)
>>> 
>>> R is free software and comes with ABSOLUTELY NO WARRANTY.
>>> You are welcome to redistribute it under certain conditions.
>>> Type 'license()' or 'licence()' for distribution details.
>>> 
>>> Natural language support but running in an English locale
>>> 
>>> R is a collaborative project with many contributors.
>>> Type 'contributors()' for more information and
>>> 'citation()' on how to cite R or R packages in publications.
>>> 
>>> Type 'demo()' for some demos, 'help()' for on-line help, or
>>> 'help.start()' for an HTML browser interface to help.
>>> Type 'q()' to quit R.
>>> 
 NMdata <-
>>> 
>>> read.table("NM1989.txt",col.names=c("SNAME","FNAME","NMTYPE","LAT","LON","ALTI"))
Here the file is named NMdata. 

 library(ggplot2)
 library(sf)
>>> Linking to GEOS 3.9.0, GDAL 3.2.0, PROJ 7.2.0
 library(rnaturalearth)
 library(rnaturalearthdata)
 world <- ne_countries(scale = "medium", returnclass = "sf")
 ggplot(data = world) + geom_sf() + labs( x = "Longitude", y = "Latitude")
>>> + coord_sf(xlim = c(-180.00, 180.00), ylim = c(-90.00, 90.00), expand =
>>> FALSE) + ggtitle("World map") + points(NMdata$LON,Nmdata$LAT,col = "red",
>>> cex = 0.01)
>>> Error in xy.coords(x, y) : object 'Nmdata' not found

But the error says Nmdata not found. SPELLING

— 
David
 ggplot(data = world) + geom_sf() + labs( x = "Longitude", y = "Latitude")
>>> + coord_sf(xlim = c(-180.00, 180.00), ylim = c(-90.00, 90.00), expand =
>>> FALSE) + ggtitle("World map") + points(NMdata$LON,NMdata$LAT,col = "red",
>>> cex = 0.01)
>>> Error in plot.xy(xy.coords(x, y), type = type, ...) :
>>> plot.new has not been called yet
>>> In addition: Warning messages:
>>> 1: In xy.coords(x, y) : NAs introduced by coercion
>>> 2: In xy.coords(x, y) : NAs introduced by coercion
>>> 3: In (function (display = "", width, height, pointsize, gamma, bg,  :
>>> locale not supported by Xlib: some X ops will operate in C locale
>>> 4: In (function (display = "", width, height, pointsize, gamma, bg,  :
>>> X cannot set locale modifiers
 ggplot(data = world) + geom_sf() + labs( x = "Longitude", y = "Latitude")
>>> + coord_sf(xlim = c(-180.00, 180.00), ylim = c(-90.00, 90.00), expand =
>>> FALSE) + ggtitle("World map") + points(NMdata$LON,NMdata$LAT,col = "red",
>>> cex = 0.01, pch = 20)
>>> Error in plot.xy(xy.coords(x, y), type = type, ...) :
>>> plot.new has not been called yet
>>> In addition: Warning messages:
>>> 1: In xy.coords(x, y) : NAs introduced by coercion
>>> 2: In xy.coords(x, y) : NAs introduced by coercion.
>>> I have also tried the codes below but it did not show the locations.
>>> ugwoke@ugwoke-HP-ENVY-Laptop-13-aq0xxx:~/Desktop$ R
>>> 
>>> R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
>>> Copyright (C) 2020 The R Foundation for Statistical Computing
>>> Platform: x86_64-pc-linux-gnu (64-bit)
>>> 
>>> R is free software and comes with ABSOLUTELY NO WARRANTY.
>>> You are welcome to redistribute it under certain conditions.
>>> Type 'license()' or 'licence()' for distribution details.
>>> 
>>> Natural language support but running in an English locale
>>> 
>>> R is a collaborative project with many contributors.
>>> Type 'contributors()' for more information and
>>> 'citation()' on how to cite R or R packages in publications.
>>> 
>>> Type 'demo()' for some demos, 'help()' for on-line help, or
>>> 'help.start()' for an HTML browser interface to help.
>>> Type 'q()' to quit R.
>>> 
 library("ggplot2")
 library(sf)
>>> Linking to GEOS 3.9.0, GDAL 3.2.0, PROJ 7.2.0
 library("rnaturalearth")
 library("rnaturalearthdata")
 theme_set(theme_bw())
 world <- ne_countries(scale = "medium", returnclass = "sf")
 class(world)
>>> [1] "sf" "data.frame"
 ggplot(data = world) + geom_sf() + labs( x = "Longitude", y = "Latitude")
>>> +
>>> + + ggtitle("World map") + coord_sf(crs = "+proj=laea +lat_0=52 +lon_0=10
>>> +x_0=4321000 +y_0=321 +ellps=GRS80 +units=m +no_defs ")
>>> Error in +ggtitle("World map") : 

Re: [R] Plotting world maps with locations.

2021-02-12 Thread David Winsemius



Sent from my iPhone

> On Feb 12, 2021, at 1:35 PM, Jibrin Alhassan  
> wrote:
> 
> Hello Romanus,
> You are to post only the code and the error messages and not all the
> information from your terminal in R session.

That’s not actually the best practice for rhelp questions. More info is better 
than less. What’s missing, however, is the data. 

— 
David
> 
>> On Fri, Feb 12, 2021, 4:35 PM Romanus Ejike 
>> wrote:
>> 
>> Please, I need help from anyone that can solve this problem.
>> I wanted to plot a world map with locations and names of the locations but
>> could not. The codes I have tried are as shown below.
>> ugwoke@ugwoke-HP-ENVY-Laptop-13-aq0xxx:~/Desktop$ R
>> 
>> R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
>> Copyright (C) 2020 The R Foundation for Statistical Computing
>> Platform: x86_64-pc-linux-gnu (64-bit)
>> 
>> R is free software and comes with ABSOLUTELY NO WARRANTY.
>> You are welcome to redistribute it under certain conditions.
>> Type 'license()' or 'licence()' for distribution details.
>> 
>>  Natural language support but running in an English locale
>> 
>> R is a collaborative project with many contributors.
>> Type 'contributors()' for more information and
>> 'citation()' on how to cite R or R packages in publications.
>> 
>> Type 'demo()' for some demos, 'help()' for on-line help, or
>> 'help.start()' for an HTML browser interface to help.
>> Type 'q()' to quit R.
>> 
>>> NMdata <-
>> 
>> read.table("NM1989.txt",col.names=c("SNAME","FNAME","NMTYPE","LAT","LON","ALTI"))
>>> library(ggplot2)
>>> library(sf)
>> Linking to GEOS 3.9.0, GDAL 3.2.0, PROJ 7.2.0
>>> library(rnaturalearth)
>>> library(rnaturalearthdata)
>>> world <- ne_countries(scale = "medium", returnclass = "sf")
>>> ggplot(data = world) + geom_sf() + labs( x = "Longitude", y = "Latitude")
>> + coord_sf(xlim = c(-180.00, 180.00), ylim = c(-90.00, 90.00), expand =
>> FALSE) + ggtitle("World map") + points(NMdata$LON,Nmdata$LAT,col = "red",
>> cex = 0.01)
>> Error in xy.coords(x, y) : object 'Nmdata' not found
>>> ggplot(data = world) + geom_sf() + labs( x = "Longitude", y = "Latitude")
>> + coord_sf(xlim = c(-180.00, 180.00), ylim = c(-90.00, 90.00), expand =
>> FALSE) + ggtitle("World map") + points(NMdata$LON,NMdata$LAT,col = "red",
>> cex = 0.01)
>> Error in plot.xy(xy.coords(x, y), type = type, ...) :
>>  plot.new has not been called yet
>> In addition: Warning messages:
>> 1: In xy.coords(x, y) : NAs introduced by coercion
>> 2: In xy.coords(x, y) : NAs introduced by coercion
>> 3: In (function (display = "", width, height, pointsize, gamma, bg,  :
>>  locale not supported by Xlib: some X ops will operate in C locale
>> 4: In (function (display = "", width, height, pointsize, gamma, bg,  :
>>  X cannot set locale modifiers
>>> ggplot(data = world) + geom_sf() + labs( x = "Longitude", y = "Latitude")
>> + coord_sf(xlim = c(-180.00, 180.00), ylim = c(-90.00, 90.00), expand =
>> FALSE) + ggtitle("World map") + points(NMdata$LON,NMdata$LAT,col = "red",
>> cex = 0.01, pch = 20)
>> Error in plot.xy(xy.coords(x, y), type = type, ...) :
>>  plot.new has not been called yet
>> In addition: Warning messages:
>> 1: In xy.coords(x, y) : NAs introduced by coercion
>> 2: In xy.coords(x, y) : NAs introduced by coercion.
>> I have also tried the codes below but it did not show the locations.
>> ugwoke@ugwoke-HP-ENVY-Laptop-13-aq0xxx:~/Desktop$ R
>> 
>> R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
>> Copyright (C) 2020 The R Foundation for Statistical Computing
>> Platform: x86_64-pc-linux-gnu (64-bit)
>> 
>> R is free software and comes with ABSOLUTELY NO WARRANTY.
>> You are welcome to redistribute it under certain conditions.
>> Type 'license()' or 'licence()' for distribution details.
>> 
>>  Natural language support but running in an English locale
>> 
>> R is a collaborative project with many contributors.
>> Type 'contributors()' for more information and
>> 'citation()' on how to cite R or R packages in publications.
>> 
>> Type 'demo()' for some demos, 'help()' for on-line help, or
>> 'help.start()' for an HTML browser interface to help.
>> Type 'q()' to quit R.
>> 
>>> library("ggplot2")
>>> library(sf)
>> Linking to GEOS 3.9.0, GDAL 3.2.0, PROJ 7.2.0
>>> library("rnaturalearth")
>>> library("rnaturalearthdata")
>>> theme_set(theme_bw())
>>> world <- ne_countries(scale = "medium", returnclass = "sf")
>>> class(world)
>> [1] "sf" "data.frame"
>>> ggplot(data = world) + geom_sf() + labs( x = "Longitude", y = "Latitude")
>> +
>> + + ggtitle("World map") + coord_sf(crs = "+proj=laea +lat_0=52 +lon_0=10
>> +x_0=4321000 +y_0=321 +ellps=GRS80 +units=m +no_defs ")
>> Error in +ggtitle("World map") : invalid argument to unary operator
>>> ggplot(data = world) + geom_sf() + labs( x = "Longitude", y = "Latitude")
>> + ggtitle("World map") + coord_sf(crs = "+proj=laea + lat_0=52 + lon_0=10 +
>> x_0=4321000 + y_0=321 + ellps=GRS80 + units=m + no_defs ")
>> Warning messages:
>> 1: In 

[R] Just Published, Thanks for your assistance

2021-02-12 Thread Ogbos Okike
Dear Experts,
In the first few months of last year, I was asking a question based on of
one my codes. I received useful help here. Many thanks again.

I am glad to share one of the results of the script. I acknowledged the
entire list and some specific individuals that contributed.

Best regards.
Ogbos
https://academic.oup.com/mnras/article/502/1/300/6054537?guestAccessKey=9d83237e-54ae-45b1-b802-90ddb3b9e837


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] ISO recommendations for plot output format from R to MS Word

2021-02-12 Thread Jinsong Zhao

On 2021/2/13 7:05, Robert Dodier wrote:

I need to export plots (constructed with plot and with ggplot) from R
to be imported into a MS Word document.

I am working with MS Word for Mac version 16.16.10 (copyright 2018)
and R versions 3.6.3 and/or 4.0.3.

I have verified that the version of MS Word which I am working with
can import SVG exported from R via svglite.

What I am mostly worried about is that other people with possibly
different versions of MS Word will not be able to view the document
correctly.



On Windows, MS Word can not display the SVG imported. In my memory, the 
only fully supported vector graphic format is "emf" or "wmf" (both a 
same?). Encapsulated PostScript(EPS) seems to be supported with specific 
plugin (I am not very sure about it).


However, some figures produced by win.metafile() could display correctly 
in Word, but weird when convert to PDF.



Towards the goal of creating an MS Word document which others with
unspecified versions of MS Word can view correctly, in what format
should I export figures from R?

I am working with a fairly large number of figures so there is some
motivation towards a fully automated process.

I have searched various forums and archives, but much of the
information may be out of date, so I am hoping that you can help me
with some up to date information.

Thank you very much for any light you can shed on this problem.

Robert Dodier



__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] ISO recommendations for plot output format from R to MS Word

2021-02-12 Thread Robert Dodier
I need to export plots (constructed with plot and with ggplot) from R
to be imported into a MS Word document.

I am working with MS Word for Mac version 16.16.10 (copyright 2018)
and R versions 3.6.3 and/or 4.0.3.

I have verified that the version of MS Word which I am working with
can import SVG exported from R via svglite.

What I am mostly worried about is that other people with possibly
different versions of MS Word will not be able to view the document
correctly.

Towards the goal of creating an MS Word document which others with
unspecified versions of MS Word can view correctly, in what format
should I export figures from R?

I am working with a fairly large number of figures so there is some
motivation towards a fully automated process.

I have searched various forums and archives, but much of the
information may be out of date, so I am hoping that you can help me
with some up to date information.

Thank you very much for any light you can shed on this problem.

Robert Dodier

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Is it Possible to Create S4 Function Objects?

2021-02-12 Thread /əˈbi/
Dear All,

I was wondering if it's possible to create S4 function objects?
(Or S4 closures, if you prefer).

i.e.
An R object, that is both an S4 object, and a function.

This would allow one to write:

> f <- constructor4.functionobj ()
> f ()
> f...@slot.of.f

I've searched for this, but I can't find any examples.

If it's possible, then that leads to the question of if/how the body
of f() could directly access the value of the slot?

> f <- function ()
>t...@slot.of.f

I should note that the more common approach of storing values in a
function's environment, doesn't work well for top-level objects.
This approach is dependent on immutability of the function's data, and
I'm reluctant to create such constraints.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Plotting world maps with locations.

2021-02-12 Thread Jibrin Alhassan
Hello Romanus,
You are to post only the code and the error messages and not all the
information from your terminal in R session.

On Fri, Feb 12, 2021, 4:35 PM Romanus Ejike 
wrote:

> Please, I need help from anyone that can solve this problem.
> I wanted to plot a world map with locations and names of the locations but
> could not. The codes I have tried are as shown below.
> ugwoke@ugwoke-HP-ENVY-Laptop-13-aq0xxx:~/Desktop$ R
>
> R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
> Copyright (C) 2020 The R Foundation for Statistical Computing
> Platform: x86_64-pc-linux-gnu (64-bit)
>
> R is free software and comes with ABSOLUTELY NO WARRANTY.
> You are welcome to redistribute it under certain conditions.
> Type 'license()' or 'licence()' for distribution details.
>
>   Natural language support but running in an English locale
>
> R is a collaborative project with many contributors.
> Type 'contributors()' for more information and
> 'citation()' on how to cite R or R packages in publications.
>
> Type 'demo()' for some demos, 'help()' for on-line help, or
> 'help.start()' for an HTML browser interface to help.
> Type 'q()' to quit R.
>
> > NMdata <-
>
> read.table("NM1989.txt",col.names=c("SNAME","FNAME","NMTYPE","LAT","LON","ALTI"))
> > library(ggplot2)
> > library(sf)
> Linking to GEOS 3.9.0, GDAL 3.2.0, PROJ 7.2.0
> > library(rnaturalearth)
> > library(rnaturalearthdata)
> > world <- ne_countries(scale = "medium", returnclass = "sf")
> > ggplot(data = world) + geom_sf() + labs( x = "Longitude", y = "Latitude")
> + coord_sf(xlim = c(-180.00, 180.00), ylim = c(-90.00, 90.00), expand =
> FALSE) + ggtitle("World map") + points(NMdata$LON,Nmdata$LAT,col = "red",
> cex = 0.01)
> Error in xy.coords(x, y) : object 'Nmdata' not found
> > ggplot(data = world) + geom_sf() + labs( x = "Longitude", y = "Latitude")
> + coord_sf(xlim = c(-180.00, 180.00), ylim = c(-90.00, 90.00), expand =
> FALSE) + ggtitle("World map") + points(NMdata$LON,NMdata$LAT,col = "red",
> cex = 0.01)
> Error in plot.xy(xy.coords(x, y), type = type, ...) :
>   plot.new has not been called yet
> In addition: Warning messages:
> 1: In xy.coords(x, y) : NAs introduced by coercion
> 2: In xy.coords(x, y) : NAs introduced by coercion
> 3: In (function (display = "", width, height, pointsize, gamma, bg,  :
>   locale not supported by Xlib: some X ops will operate in C locale
> 4: In (function (display = "", width, height, pointsize, gamma, bg,  :
>   X cannot set locale modifiers
> > ggplot(data = world) + geom_sf() + labs( x = "Longitude", y = "Latitude")
> + coord_sf(xlim = c(-180.00, 180.00), ylim = c(-90.00, 90.00), expand =
> FALSE) + ggtitle("World map") + points(NMdata$LON,NMdata$LAT,col = "red",
> cex = 0.01, pch = 20)
> Error in plot.xy(xy.coords(x, y), type = type, ...) :
>   plot.new has not been called yet
> In addition: Warning messages:
> 1: In xy.coords(x, y) : NAs introduced by coercion
> 2: In xy.coords(x, y) : NAs introduced by coercion.
> I have also tried the codes below but it did not show the locations.
> ugwoke@ugwoke-HP-ENVY-Laptop-13-aq0xxx:~/Desktop$ R
>
> R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
> Copyright (C) 2020 The R Foundation for Statistical Computing
> Platform: x86_64-pc-linux-gnu (64-bit)
>
> R is free software and comes with ABSOLUTELY NO WARRANTY.
> You are welcome to redistribute it under certain conditions.
> Type 'license()' or 'licence()' for distribution details.
>
>   Natural language support but running in an English locale
>
> R is a collaborative project with many contributors.
> Type 'contributors()' for more information and
> 'citation()' on how to cite R or R packages in publications.
>
> Type 'demo()' for some demos, 'help()' for on-line help, or
> 'help.start()' for an HTML browser interface to help.
> Type 'q()' to quit R.
>
> > library("ggplot2")
> > library(sf)
> Linking to GEOS 3.9.0, GDAL 3.2.0, PROJ 7.2.0
> > library("rnaturalearth")
> > library("rnaturalearthdata")
> > theme_set(theme_bw())
> > world <- ne_countries(scale = "medium", returnclass = "sf")
> > class(world)
> [1] "sf" "data.frame"
> > ggplot(data = world) + geom_sf() + labs( x = "Longitude", y = "Latitude")
> +
> + + ggtitle("World map") + coord_sf(crs = "+proj=laea +lat_0=52 +lon_0=10
> +x_0=4321000 +y_0=321 +ellps=GRS80 +units=m +no_defs ")
> Error in +ggtitle("World map") : invalid argument to unary operator
> > ggplot(data = world) + geom_sf() + labs( x = "Longitude", y = "Latitude")
> + ggtitle("World map") + coord_sf(crs = "+proj=laea + lat_0=52 + lon_0=10 +
> x_0=4321000 + y_0=321 + ellps=GRS80 + units=m + no_defs ")
> Warning messages:
> 1: In (function (display = "", width, height, pointsize, gamma, bg,  :
>   locale not supported by Xlib: some X ops will operate in C locale
> 2: In (function (display = "", width, height, pointsize, gamma, bg,  :
>   X cannot set locale modifiers.
> I really appreciate any help rendered. Thanks
>
> [[alternative HTML version 

Re: [R] Axis whitout all the row, that contains time

2021-02-12 Thread Rui Barradas

Hello,

In order to select every 20 s, set the date_breaks = "20 secs", not the 
breaks.
The axis labels are also formatted, with date_labels, standard datetime 
format strings are used for this. And rotated, not part of the question.


# Create some data
set.seed(2021)
time <- seq(as.POSIXct("2021-02-11"), as.POSIXct("2021-02-11 00:29:59"), 
by = "1 secs")

y <- cumsum(rnorm(length(time)))
df1 <- data.frame(time, y)

# Plot the data
library(ggplot2)

ggplot(df1, aes(time, y)) +
  geom_line() +
  scale_x_datetime(date_breaks = "20 secs", date_labels = "%M:%S") +
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1, 
size = 5))



Hope this helps,

Rui Barradas

Às 15:05 de 12/02/21, Informatique escreveu:

Hello,

i'm using Rstudio from a few day, and i have some information in a CVS file, 
take every five second, format of the time is HH:MM:SS.
I use the hour on the X axis, but i don't want having all the time print. For 
example only every 10 values.

I think it will be possible with   scale_x_datetime(breaks = date_breaks(XXX)

but i don't understand how select every 20 s.

Thank's for your help

François-marie BILLARD



__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Axis whitout all the row, that contains time

2021-02-12 Thread John Kane
With a dat.frame "mydata" create a new variable mydata$num
mydata$num  <-  1:nrow(mydata)

new_data  <-  subset(mydata, num == 10)

plot using new_data

On Fri, 12 Feb 2021 at 10:35, Informatique <
informati...@billard-francois-marie.eu> wrote:

> Hello,
>
> i'm using Rstudio from a few day, and i have some information in a CVS
> file, take every five second, format of the time is HH:MM:SS.
> I use the hour on the X axis, but i don't want having all the time print.
> For example only every 10 values.
>
> I think it will be possible with   scale_x_datetime(breaks =
> date_breaks(XXX)
>
> but i don't understand how select every 20 s.
>
> Thank's for your help
>
> François-marie BILLARD
> --
> Informatique 
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>


-- 
John Kane
Kingston ON Canada

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[ESS] Difficulty installing ESS from MELPA

2021-02-12 Thread Mark Seeto via ESS-help
Hi ESS users,

I'm using Vincent Goulet's modified Emacs 27.1 for Windows, with ESS
18.10.2, on a Windows 10 computer.

I'm having trouble installing the latest ESS from MELPA. I don't
normally install things from MELPA (I usually use MELPA Stable), and
as far as I can remember, I haven't installed ESS from MELPA before,
except for these recent attempts.

I did M-x package-list-packages, then went down the list to ess, then
pressed i, then pressed x.

The installation process seemed to get "stuck" with the message
"Checking c:/Users/marks/.emacs.d/elpa/ess-20210210.1202..." being
displayed. After 15 minutes, I stopped the installation process using
C-g. In the list of packages, it now says ess 20210210.1202 has Status
"installed", but I don't know if it's installed correctly.

The directory C:\Users\marks\.emacs.d\elpa\ess-20210210.1202 contains
only 48 items, whereas C:\Users\marks\.emacs.d\elpa\ess-18.10.2
contains 134 items.

I restarted Emacs, and when I start R, there is a message "Symbol’s
function definition is void: ess-local-process-name", which I don't
usually get. When I do C-h v ess-version, it says "18.10.3snapshot".

When I send a command from a .R file to the R console buffer, the
command is sent successfully, but there is a message "Error running
timer ‘ess--idle-timer-function’: (void-function
ess-local-process-name)", which I don't usually get.

I tried deleting the C:\Users\marks\.emacs.d\elpa\ess-20210210.1202
directory and installing ESS again, but the same thing happened. I had
also tried installing ESS from MELPA about a week ago, and had the
same problem.

For comparison, I installed packages 0blayout and 2048-game from MELPA
using M-x package-list-packages i x, and they both finished
successfully within about one second, with message "Operation
finished.  Packages that are no longer needed: 7.  Type `M-x
package-autoremove' to remove them".

My first question is, does having only 48 items in
C:\Users\marks\.emacs.d\elpa\ess-20210210.1202 compared to 134 items
in C:\Users\marks\.emacs.d\elpa\ess-18.10.2 indicate that the new ess
did not install correctly?

If the new ess is not correctly installed, what can I do to
troubleshoot the installation process? Should the installation take
more than 15 minutes?

If the new ess is correctly installed, how can I avoid getting the
error messages "Symbol’s function definition is void:
ess-local-process-name" and "Error running timer
‘ess--idle-timer-function’: (void-function ess-local-process-name)"?

Thanks,

Mark Seeto
-

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


[R] Axis whitout all the row, that contains time

2021-02-12 Thread Informatique
Hello,

i'm using Rstudio from a few day, and i have some information in a CVS file, 
take every five second, format of the time is HH:MM:SS.
I use the hour on the X axis, but i don't want having all the time print. For 
example only every 10 values.

I think it will be possible with   scale_x_datetime(breaks = date_breaks(XXX)

but i don't understand how select every 20 s.

Thank's for your help

François-marie BILLARD
-- 
Informatique 

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Plotting world maps with locations.

2021-02-12 Thread Romanus Ejike
Please, I need help from anyone that can solve this problem.
I wanted to plot a world map with locations and names of the locations but
could not. The codes I have tried are as shown below.
ugwoke@ugwoke-HP-ENVY-Laptop-13-aq0xxx:~/Desktop$ R

R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> NMdata <-
read.table("NM1989.txt",col.names=c("SNAME","FNAME","NMTYPE","LAT","LON","ALTI"))
> library(ggplot2)
> library(sf)
Linking to GEOS 3.9.0, GDAL 3.2.0, PROJ 7.2.0
> library(rnaturalearth)
> library(rnaturalearthdata)
> world <- ne_countries(scale = "medium", returnclass = "sf")
> ggplot(data = world) + geom_sf() + labs( x = "Longitude", y = "Latitude")
+ coord_sf(xlim = c(-180.00, 180.00), ylim = c(-90.00, 90.00), expand =
FALSE) + ggtitle("World map") + points(NMdata$LON,Nmdata$LAT,col = "red",
cex = 0.01)
Error in xy.coords(x, y) : object 'Nmdata' not found
> ggplot(data = world) + geom_sf() + labs( x = "Longitude", y = "Latitude")
+ coord_sf(xlim = c(-180.00, 180.00), ylim = c(-90.00, 90.00), expand =
FALSE) + ggtitle("World map") + points(NMdata$LON,NMdata$LAT,col = "red",
cex = 0.01)
Error in plot.xy(xy.coords(x, y), type = type, ...) :
  plot.new has not been called yet
In addition: Warning messages:
1: In xy.coords(x, y) : NAs introduced by coercion
2: In xy.coords(x, y) : NAs introduced by coercion
3: In (function (display = "", width, height, pointsize, gamma, bg,  :
  locale not supported by Xlib: some X ops will operate in C locale
4: In (function (display = "", width, height, pointsize, gamma, bg,  :
  X cannot set locale modifiers
> ggplot(data = world) + geom_sf() + labs( x = "Longitude", y = "Latitude")
+ coord_sf(xlim = c(-180.00, 180.00), ylim = c(-90.00, 90.00), expand =
FALSE) + ggtitle("World map") + points(NMdata$LON,NMdata$LAT,col = "red",
cex = 0.01, pch = 20)
Error in plot.xy(xy.coords(x, y), type = type, ...) :
  plot.new has not been called yet
In addition: Warning messages:
1: In xy.coords(x, y) : NAs introduced by coercion
2: In xy.coords(x, y) : NAs introduced by coercion.
I have also tried the codes below but it did not show the locations.
ugwoke@ugwoke-HP-ENVY-Laptop-13-aq0xxx:~/Desktop$ R

R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library("ggplot2")
> library(sf)
Linking to GEOS 3.9.0, GDAL 3.2.0, PROJ 7.2.0
> library("rnaturalearth")
> library("rnaturalearthdata")
> theme_set(theme_bw())
> world <- ne_countries(scale = "medium", returnclass = "sf")
> class(world)
[1] "sf" "data.frame"
> ggplot(data = world) + geom_sf() + labs( x = "Longitude", y = "Latitude")
+
+ + ggtitle("World map") + coord_sf(crs = "+proj=laea +lat_0=52 +lon_0=10
+x_0=4321000 +y_0=321 +ellps=GRS80 +units=m +no_defs ")
Error in +ggtitle("World map") : invalid argument to unary operator
> ggplot(data = world) + geom_sf() + labs( x = "Longitude", y = "Latitude")
+ ggtitle("World map") + coord_sf(crs = "+proj=laea + lat_0=52 + lon_0=10 +
x_0=4321000 + y_0=321 + ellps=GRS80 + units=m + no_defs ")
Warning messages:
1: In (function (display = "", width, height, pointsize, gamma, bg,  :
  locale not supported by Xlib: some X ops will operate in C locale
2: In (function (display = "", width, height, pointsize, gamma, bg,  :
  X cannot set locale modifiers.
I really appreciate any help rendered. Thanks

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.