[R] converting to POSIXct

2021-11-30 Thread Stefano Sofia
Dear R-list users, I thought I was able to manage easily POSIXct, but this is not true. I am not going to load the input txt file because I know that attachments are not allowed. The structure of my input txt file is data_POSIX,Sensor_code,value 2002-11-01 00:00:00,1694,7.2 2002-11-01 00:00:00,17

Re: [R] converting to POSIXct

2021-11-30 Thread PIKAL Petr
Hi You probably has zero hours in all your data see > temp data_POSIX Sensor_code value 1 2002-11-01 00:00:001694 7.2 2 2002-11-01 00:00:001723 10.8 without hours > as.POSIXct(temp$data_POSIX, format = "%Y-%m-%d %H:%M:%S", tz="Etc/GMT-1") [1] "2002-11-01 +01" "2002-

Re: [R] converting to POSIXct

2021-11-30 Thread Jim Lemon
Hi, Petr is right. Apparently as.POSIXct drops the smallest increments if all are zero: ssdf<-read.csv(text="data_POSIX,Sensor_code,value 2002-11-01 00:00:01,1694,7.2 2002-11-01 00:00:00,1723,10.8", stringsAsFactors=FALSE) ssdf$data_POSIX<-as.POSIXct(ssdf$data_POSIX,"%Y-%m-%d HH:MM:SS") ssdf

Re: [R] converting to POSIXct

2021-11-30 Thread Duncan Murdoch
On 30/11/2021 3:41 a.m., Jim Lemon wrote: Hi, Petr is right. Apparently as.POSIXct drops the smallest increments if all are zero: That's not as.POSIXct doing anything: there's no way to drop increments, the POSIXct format records a number of seconds and that can't be changed. What is happe

Re: [R] converting to POSIXct

2021-11-30 Thread PIKAL Petr
Hi, that is what I tried to show to Stefano. That the issue was only with printing the values on console or as you explained in more depth the default formating when all time values (HMS) are zero. So that Stefano used correct syntax. Cheers Petr > -Original Message- > From: Duncan M

Re: [R] converting to POSIXct

2021-11-30 Thread Stefano Sofia
Thanks to all of you. Stefano (oo) --oOO--( )--OOo-- Stefano Sofia PhD Civil Protection - Marche Region - Italy Meteo Section Snow Section Via del Colle Ameno 5 60126 Torrette di Ancona, Ancona (AN) Uff: +39 071 806 7743 E-mail: stefano.so...@regione.ma

[R] Is 'temp' a reserved/key word in R?

2021-11-30 Thread Rich Shepard
A short data file: site_nbr,sampdate.param,quant,unit 31731,2005-07-12,temp,19.7,oC 31731,2007-03-28,temp,9,oC 31731,2007-06-27,temp,18.3,oC 31731,2007-09-26,temp,15.8,oC 31731,2008-01-17,temp,5.4,oC 31731,2008-03-27,temp,7.4,oC 31731,2010-04-05,temp,8.1,oC 31731,2010-07-26,temp,20.5,oC 31731,2010

Re: [R] Is 'temp' a reserved/key word in R?

2021-11-30 Thread Andrew Simmons
It seems like the headers are misnamed, that should be a comma between sampdate and param, not a period On Tue, Nov 30, 2021, 09:35 Rich Shepard wrote: > A short data file: > site_nbr,sampdate.param,quant,unit > 31731,2005-07-12,temp,19.7,oC > 31731,2007-03-28,temp,9,oC > 31731,2007-06-27,temp,1

Re: [R] Is 'temp' a reserved/key word in R?

2021-11-30 Thread Micha Silver
In header the row of the sample data file, the column names, "sampdate" and "param" are separated by a period, not comma. That would cause the error you're getting. On 30/11/2021 16:34, Rich Shepard wrote: A short data file: site_nbr,sampdate.param,quant,unit   <<<=== 31731,2005-07-12,temp,19

Re: [R] Is 'temp' a reserved/key word in R?

2021-11-30 Thread Sarah Goslee
Andrew is right - it's a typo. More broadly, there's no restriction of that sort on the contents of your data frame - reserved words can't be used for object names. The R Language Definition is the best resource for identifying those words. It would help if you provided the package for read_csv,

Re: [R] Is 'temp' a reserved/key word in R? [FIXED]

2021-11-30 Thread Rich Shepard
On Tue, 30 Nov 2021, Andrew Simmons wrote: It seems like the headers are misnamed, that should be a comma between sampdate and param, not a period Andrew, I completely missed seeing this, probably because I expected a comma and didn't look closely enough. Thanks very much for catching this,

Re: [R] Is 'temp' a reserved/key word in R?

2021-11-30 Thread Rich Shepard
On Tue, 30 Nov 2021, Sarah Goslee wrote: Andrew is right - it's a typo. Sarah, Thanks, Rich __ 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://w

[R] Question about Rfast colMins and colMaxs

2021-11-30 Thread Stephen H. Dawson, DSL via R-help
Hi, I am working to understand the Rfast functions of colMins and colMaxs. I worked through the example listed on page 54 of the PDF. https://cran.r-project.org/web/packages/Rfast/index.html https://cran.r-project.org/web/packages/Rfast/Rfast.pdf My data is in a CSV file. So, I bring it int

[R] Degree symbol as axis label superscript

2021-11-30 Thread Rich Shepard
I want to present the temperature on the Y-axis label as 'Water Temperature (oC)' with the degree symbol as a superscript. My web search found a couple of methods; one put the entire example string in the axis label, the other is close, but still incorrect. Source example: #define expression wit

Re: [R] Degree symbol as axis label superscript

2021-11-30 Thread Andrew Simmons
Excuse my brevity, but take a look at ?plotmath It has tons of tips for making pretty labels On Tue, Nov 30, 2021, 14:05 Rich Shepard wrote: > I want to present the temperature on the Y-axis label as 'Water Temperature > (oC)' with the degree symbol as a superscript. > > My web search found a c

Re: [R] Degree symbol as axis label superscript

2021-11-30 Thread Rich Shepard
On Tue, 30 Nov 2021, Andrew Simmons wrote: Excuse my brevity, but take a look at ?plotmath It has tons of tips for making pretty labels Thanks, Andrew. I will. Rich __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.e

Re: [R] Question about Rfast colMins and colMaxs

2021-11-30 Thread Bert Gunter
RStudio is **not** R. In particular, the so-called TidyVerse consists of all *non*-standard contributed packages, about which the PG says: "For questions about functions in standard packages distributed with R (see the FAQ Add-on packages in R), ask questions on R-help. [The link is: https://cran.

Re: [R] Question about Rfast colMins and colMaxs

2021-11-30 Thread Bill Dunlap
You can use as.matrix() to convert your data.frame to a matrix, but that loses the speed/space advantages of colMins (as well as causing issues if some columns are not numeric). You could write to the maintainer of the package to ask that data.frames be directly supported. In the meantime you cou

Re: [R] Degree symbol as axis label superscript [RESOLVED]

2021-11-30 Thread Rich Shepard
On Tue, 30 Nov 2021, Rich Shepard wrote: Thanks, Andrew. I will. plotmath didn't have the solution; the use of the LaTeX ^ for a superscript had a character or number preceeding it. Using 'degree' prints that string on the axis. What does work is using the unicode for the degree symbol as pre

Re: [R] Question about Rfast colMins and colMaxs

2021-11-30 Thread Jeff Newmiller
I don't know anything about this package, but read.csv returns a data frame. How you go about forming a matrix using that data frame depends what is in it. If it is all numeric then as.matrix may be all you need. Half of any R data analysis is data... and the details are almost always crucial.

Re: [R] Degree symbol as axis label superscript [RESOLVED]

2021-11-30 Thread Andrew Simmons
I think you have to not put the word degree in quotes, something like: graphics::plot( x = 1, xlab = quote( 32 * degree ) ) works for me, though yours seems like a good solution too On Tue, Nov 30, 2021 at 3:31 PM Rich Shepard wrote: > On Tue, 30 Nov 2021, Rich Shepard w

Re: [R] Degree symbol as axis label superscript [RESOLVED]

2021-11-30 Thread David Winsemius
On 11/30/21 12:29 PM, Rich Shepard wrote: On Tue, 30 Nov 2021, Rich Shepard wrote: Thanks, Andrew. I will. plotmath didn't have the solution; Really? What was wrong with this? plot(1, 1, xlab=expression(32^degree) )  # the example given on ?plotmath -- David. the use of the LaT

Re: [R] Degree symbol as axis label superscript [RESOLVED]

2021-11-30 Thread Bill Dunlap
The following makes degree signs appropriately, as shown in ?plotmath: plot(68, 20, xlab=expression(degree*F), ylab=expression(degree*C)) If you want the word "degree" spelled out, put it in quotes. -Bill On Tue, Nov 30, 2021 at 12:31 PM Rich Shepard wrote: > On Tue, 30 Nov 2021, Rich Shepa

Re: [R] Degree symbol as axis label superscript [RESOLVED]

2021-11-30 Thread Rich Shepard
On Tue, 30 Nov 2021, Bill Dunlap wrote: The following makes degree signs appropriately, as shown in ?plotmath: plot(68, 20, xlab=expression(degree*F), ylab=expression(degree*C)) If you want the word "degree" spelled out, put it in quotes. Bill, I missed that last point; thought it was alwa

Re: [R] Degree symbol as axis label superscript [RESOLVED]

2021-11-30 Thread Rich Shepard
On Tue, 30 Nov 2021, David Winsemius wrote: Really? What was wrong with this? plot(1, 1, xlab=expression(32^degree) )  # the example given on ?plotmath David, Absolutely nothing. When there's no specific degree value in the label because the axis represents a range of values there's no digit

Re: [R] Degree symbol as axis label superscript

2021-11-30 Thread Bert Gunter
True, but unnecessary with UTF-8 encodings of unicode (subject to some caveats, though): plot(1:5, runif(5),xlab = "Temp (°F)", ylab = "result") should work fine, where the º ("degree") symbol was inserted by the symbol insertion facility on my Mac. Windows has something similar. See the comments

Re: [R] Question about Rfast colMins and colMaxs

2021-11-30 Thread Stephen H. Dawson, DSL via R-help
Right, R Studio is not R. However, the Rfast package is part of R. https://cran.r-project.org/web/packages/Rfast/index.html So, rephrasing my question... What is the best practice to bring a csv file into R so it can be accessed by colMaxs and colMins, please? *Stephen Dawson, DSL* /Executiv

Re: [R] Question about Rfast colMins and colMaxs

2021-11-30 Thread Stephen H. Dawson, DSL via R-help
Hi Jeff, Thanks for the data review offer. Attached is the CSV. *Stephen Dawson, DSL* /Executive Strategy Consultant/ Business & Technology +1 (865) 804-3454 http://www.shdawson.com On 11/30/21 3:29 PM, Jeff Newmiller wrote: I don't know anything about this package

Re: [R] Question about Rfast colMins and colMaxs

2021-11-30 Thread Stephen H. Dawson, DSL via R-help
Thanks, Bill. How do you go about getting maximum and minimum values from your columns? Do you simply do them one column at a time? The functions I am identifying from Rfast do this work in bulk. *Stephen Dawson, DSL* /Executive Strategy Consultant/ Business & Technology +1 (865) 804-3454 ht

Re: [R] Question about Rfast colMins and colMaxs

2021-11-30 Thread Stephen H. Dawson, DSL via R-help
Well, no it is not. The email list stripped off the attachment. The data is numeric, happens to be all whole numbers. Kindest Regards, *Stephen Dawson, DSL* /Executive Strategy Consultant/ Business & Technology +1 (865) 804-3454 http://www.shdawson.com On 11/30/21 5:

Re: [R] Question about Rfast colMins and colMaxs

2021-11-30 Thread Bert Gunter
... but Rfast is *not* a "standard" package, as the rest of the PG excerpt says. So contact the maintainer and ask him/her what they think the best practice should be for their package. As has been pointed out already, it appears to differ from the usual "read it in as a data frame" procedure. Ber

Re: [R] Question about Rfast colMins and colMaxs

2021-11-30 Thread Stephen H. Dawson, DSL via R-help
Oh, you are segmenting standard R from the rest of R. Well, that part did not come across to me in your original reply. I am not clear on a standard versus non-standard list. I will look into this aspect and see what I can learn going forward. Thanks, *Stephen Dawson, DSL* /Executive Strateg

Re: [R] Question about Rfast colMins and colMaxs

2021-11-30 Thread Bert Gunter
If you look at my original reply, it gives the link that tells you *exactly* what packages are "standard" (and all the thousands of others which therefore are not). Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkel

Re: [R] Degree symbol as axis label superscript [RESOLVED]

2021-11-30 Thread David Winsemius
On 11/30/21 1:22 PM, Rich Shepard wrote: On Tue, 30 Nov 2021, David Winsemius wrote: Really? What was wrong with this? plot(1, 1, xlab=expression(32^degree) )  # the example given on ?plotmath David, Absolutely nothing. When there's no specific degree value in the label because the axis r

Re: [R] Degree symbol as axis label superscript

2021-11-30 Thread ani jaya
one of my solution : text(x,y,"\u00B0C", cex=1.1, font=2) it will produce "°C" text(x,y,"\u00B3C", cex=1.1, font=2) it will produce "superscript(3)C" so basically change the character after the "\u00B..." will produce the superscript. Best, Ani On Wed, Dec 1, 2021 at 4:05 AM Rich Shepard wro

Re: [R] Question about Rfast colMins and colMaxs

2021-11-30 Thread Avi Gross via R-help
Stephen, Although what is in the STANDARD R distribution can vary several ways, in general, if you need to add a line like: library(something) or require(something) and your code does not work unless you have done that, then you can imagine it is not sort of built in to R as it starts. Having s

Re: [R] Degree symbol as axis label superscript

2021-11-30 Thread Andrew Simmons
Using the degree character seems perfectly legit to me. The reason I suggest looking at plotmath is that I think plotmath is easier to read (that is, if you're escaping your characters with \u), and because for anything more complicated like set notation, big sums, integrals, you'll need to get use

Re: [R] Degree symbol as axis label superscript

2021-11-30 Thread Bert Gunter
Yes, but I should acknowledge my ignorance in not realizing that "\u00b0" (hex 176) is a simpler way to get the character in R without the OS tool than intToUtf8() . If you need math notation beyond simple symbol characters, plotmath is certainly indispensable. Bert On Tue, Nov 30, 2021 at 7:51