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 PM Andrew Simmons  wrote:

> 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 used to plotmath to make your labels. Either way, nice
> suggestion, both work perfectly well for this situation
>
> On Tue, Nov 30, 2021, 16:24 Bert Gunter  wrote:
>
>> 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 in the plotmath documentation just before the
>> examples for more details on this, along with some caveats about the
>> need for a suitable display/plot device.
>>
>> More laboriously, but perhaps more informatively, one can look up
>> "unicode code point for degree symbol" to find that it is decimal 176.
>> Then R's intToUtf8() function converts this to the UTF-8 encoding that
>> **should** display as a "degree" symbol, subject to the above
>> referenced caveats.
>> Hence:
>> > intToUtf8(176)
>> [1] "°"  ##degree character
>>
>> ## So, for example, you can do:
>> > degrF <-paste0(intToUtf8(176),"F")
>> > degrF
>> [1] "°F" ("degrees F")
>>
>> > plot(1:5, runif(5),xlab = paste0("Temp (", degrF,")"), ylab = "result")
>>
>> As Andrew said, you can use plotmath to do this, too; it just isn't
>> needed for simple insertion of "standard" symbols.
>>
>> NOTE: As I am far from an expert on all of this, I would appreciate
>> clarification or correction of any errors or misstatements in the
>> above.
>>
>> Bert Gunter
>>
>>
>> On Tue, Nov 30, 2021 at 11:34 AM Andrew Simmons 
>> wrote:
>> >
>> > 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 couple of methods; one put the entire example
>> string
>> > > in the axis label, the other is close, but still incorrect.
>> > >
>> > > Source example:
>> > > #define expression with superscript
>> > > x_expression <- expression(x^3 ~ variable ~ label)
>> > > # The example axis label is:
>> > > 'X3 variable label' (with the 3 as a superscript)
>> > >
>> > > My use:
>> > > # Set degree symbol as superscript in plot's y axis:
>> > > y_expression <- expression(^o ~ C)
>> > >
>> > > R's error message:
>> > > Error in source("../scripts/all_temp_plots.r") :
>> > >../scripts/all_temp_plots.r:10:28: unexpected '^'
>> > > 9: # Set degree symbol as superscript in plot's y axis:
>> > > 10: y_expression <- expression(^
>> > > ^
>> > >
>> > > What is the proper way to display a degree symbol in a plot's axis
>> label?
>> > >
>> > > 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://www.R-project.org/posting-guide.html
>> > > and provide commented, minimal, self-contained, reproducible code.
>> > >
>> >
>> > [[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.
>>
>

[[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] 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 used to plotmath to make your labels. Either way, nice
suggestion, both work perfectly well for this situation

On Tue, Nov 30, 2021, 16:24 Bert Gunter  wrote:

> 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 in the plotmath documentation just before the
> examples for more details on this, along with some caveats about the
> need for a suitable display/plot device.
>
> More laboriously, but perhaps more informatively, one can look up
> "unicode code point for degree symbol" to find that it is decimal 176.
> Then R's intToUtf8() function converts this to the UTF-8 encoding that
> **should** display as a "degree" symbol, subject to the above
> referenced caveats.
> Hence:
> > intToUtf8(176)
> [1] "°"  ##degree character
>
> ## So, for example, you can do:
> > degrF <-paste0(intToUtf8(176),"F")
> > degrF
> [1] "°F" ("degrees F")
>
> > plot(1:5, runif(5),xlab = paste0("Temp (", degrF,")"), ylab = "result")
>
> As Andrew said, you can use plotmath to do this, too; it just isn't
> needed for simple insertion of "standard" symbols.
>
> NOTE: As I am far from an expert on all of this, I would appreciate
> clarification or correction of any errors or misstatements in the
> above.
>
> Bert Gunter
>
>
> On Tue, Nov 30, 2021 at 11:34 AM Andrew Simmons 
> wrote:
> >
> > 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 couple of methods; one put the entire example
> string
> > > in the axis label, the other is close, but still incorrect.
> > >
> > > Source example:
> > > #define expression with superscript
> > > x_expression <- expression(x^3 ~ variable ~ label)
> > > # The example axis label is:
> > > 'X3 variable label' (with the 3 as a superscript)
> > >
> > > My use:
> > > # Set degree symbol as superscript in plot's y axis:
> > > y_expression <- expression(^o ~ C)
> > >
> > > R's error message:
> > > Error in source("../scripts/all_temp_plots.r") :
> > >../scripts/all_temp_plots.r:10:28: unexpected '^'
> > > 9: # Set degree symbol as superscript in plot's y axis:
> > > 10: y_expression <- expression(^
> > > ^
> > >
> > > What is the proper way to display a degree symbol in a plot's axis
> label?
> > >
> > > 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://www.R-project.org/posting-guide.html
> > > and provide commented, minimal, self-contained, reproducible code.
> > >
> >
> > [[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.
>

[[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] 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 said that, tons of exceptions may exist that cause R to load in
things on your machine for everyone or just for you without you having to
notice.

I think this forum lately has been deluged with questions about all kinds of
add-on packages and in particular, lots of the ones in the tidyverse.
Clearly the purpose here is not that broad.

But since I use some packages like the tidyverse extensively, and I am far
from alone, I wonder if someday the powers that be realize it is a losing
battle to exclude at least some of it. It would be so nice not having to
include a long list of packages for some programs or somehow arrange that
people using something you shared had installed and loaded them. But there
are too many packages out there of varying quality and usefulness and
popularity with more every day being added. Worse, many are somewhat
incompatible such as having functions with the same names that hide earlier
ones loaded.

Base R doe come with functions like colSums and colMeans and similar row
functions. But as mentioned, a data.frame is a list of vectors and R
supports certain functional programming constructs over lists using things
like:

lapply(df, min)
sapply(df, min)

And actually quite a few ways depending on what info you want back and
whether you insist it be returned as a list or vector or other things . You
can even supply additional arguments that might be needed such as if you
want to ignore any NA values,

lapply(df, min, na.rm=TRUE

The package you looked at it is trying to be fast and uses what looks like
compiled external code but so does lapply.

If this is too bothersome for you, consider making a one-liner function like
this:

mycolMins <- function(df, ...) lapply(df, min, ...)

Once defined, you can use that just fine and not think about it again and I
note this answer (like others) is offering you something in base R that
works fine on data.frames and the like.

You can extend to many similar ideas like this one that calulates the min
unless you over-ride it with max or mean or sd or a bizarre function like
`[` so a call to:

mycolCalc(df, `[`, 3)

Will return exactly the third items in each row!

I find it to be very common for someone these days to do a quick search for
a way to do something in a language like R and not really look to see if it
is a standard way or something special/ Matrices in R are not quite the same
as some other objects like a data.frame or tibble and a package written to
be used on one may (or may not) happen to work with another. Some packages
are carefully written to try to detect what kind of object it gets and when
possible convert it to another. The "apply" function is meant for matrices
but if it sees something else it looks ta the dimensionality and tries to
coerce it with as.matrix or as.array first. As others have noted, this mean
a data.frame containing non-numeric parts may fail or should have any other
columns hidden/removed as in this df that has some non-numeric fields:

> df
i   s   f b i2
1 1   hello 1.2  TRUE  5
2 2   there 2.3 FALSE  4
3 3 goodbye 3.4  TRUE  3

So a bit more complex one-liner removes any non-numeric columns like this:

> mycolMins(df[, sapply(df, is.numeric)])
$i
[1] 1

$f
[1] 1.2

$i2
[1] 3

Clearly converting that to a matrix while whole would result in everything
being converted to character and a minimum may be elusive.

-Original Message-
From: R-help  On Behalf Of Stephen H. Dawson,
DSL via R-help
Sent: Tuesday, November 30, 2021 5:37 PM
To: Bert Gunter 
Cc: r-help@r-project.org
Subject: Re: [R] Question about Rfast colMins and colMaxs

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 Strategy Consultant/
Business & Technology
+1 (865) 804-3454
http://www.shdawson.com 


On 11/30/21 5:26 PM, Bert Gunter wrote:
> ... 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.
>
> Bert
>
> On Tue, Nov 30, 2021 at 2:11 PM Stephen H. Dawson, DSL 
>  wrote:
>> 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 

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  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 couple of methods; one put the entire example string
> in the axis label, the other is close, but still incorrect.
>
> Source example:
> #define expression with superscript
> x_expression <- expression(x^3 ~ variable ~ label)
> # The example axis label is:
> 'X3 variable label' (with the 3 as a superscript)
>
> My use:
> # Set degree symbol as superscript in plot's y axis:
> y_expression <- expression(^o ~ C)
>
> R's error message:
> Error in source("../scripts/all_temp_plots.r") :
>../scripts/all_temp_plots.r:10:28: unexpected '^'
> 9: # Set degree symbol as superscript in plot's y axis:
> 10: y_expression <- expression(^
> ^
>
> What is the proper way to display a degree symbol in a plot's axis label?
>
> 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://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
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] 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 represents a range of values there's no digit preceeding
the ^ symbol.

The axis label is 'Temperature (oC)' with the degree symbol preceeding a
character, not following a specific digit.



There's nothing special about following a digit. You can have it follow 
anything. Since you were going to need to quote the parentheses anywa, 
then have it superscripted above the level of the paren:



plot(1,1, ylab = expression(Temperature~"("^degree*C*")")   )

--

David.



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://www.R-project.org/posting-guide.html

and provide commented, minimal, self-contained, reproducible code.


__
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] 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 Berkeley Breathed in his "Bloom County" comic strip )
On Tue, Nov 30, 2021 at 2:37 PM Stephen H. Dawson, DSL
 wrote:
>
> 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 Strategy Consultant/
> Business & Technology
> +1 (865) 804-3454
> http://www.shdawson.com 
>
>
> On 11/30/21 5:26 PM, Bert Gunter wrote:
> > ... 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.
> >
> > Bert
> >
> > On Tue, Nov 30, 2021 at 2:11 PM Stephen H. Dawson, DSL
> >  wrote:
> >> 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*
> >> /Executive Strategy Consultant/
> >> Business & Technology
> >> +1 (865) 804-3454
> >> http://www.shdawson.com 
> >>
> >>
> >> On 11/30/21 3:19 PM, Bert Gunter wrote:
> >>> 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.r-project.org/doc/FAQ/R-FAQ.html#Add-on-packages-in-R
> >>> This gives the list of current _standard_ packages]
> >>>
> >>> If the question relates to a contributed package , e.g., one
> >>> downloaded from CRAN, try contacting the package maintainer first. You
> >>> can also use find("functionname") and
> >>> packageDescription("packagename") to find this information. Only send
> >>> such questions to R-help or R-devel if you get no reply or need
> >>> further assistance. This applies to both requests for help and to bug
> >>> reports."
> >>>
> >>> Note that RStudio maintains its own help resources at:
> >>> https://community.rstudio.com/
> >>> This is where questions about the TidyVerse, ggplot, etc. should be 
> >>> posted.
> >>>
> >>>
> >>>
> >>> Bert Gunter
> >>>
> >>> "The trouble with having an open mind is that people keep coming along
> >>> and sticking things into it."
> >>> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
> >>>
> >>> On Tue, Nov 30, 2021 at 10:55 AM Stephen H. Dawson, DSL via R-help
> >>>  wrote:
>  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 into R Studio using:
>  Data <- read.csv("./input/DataSet05.csv", header=T)
> 
>  However, I read the instructions listed on page 54 of the PDF saying I
>  need to bring data into R using a matrix. I think read.csv brings the
>  data in as a dataframe. I think colMins is failing because it is looking
>  for a matrix but finds a dataframe.
> 
> > colMaxs(Data)
>  Error in colMaxs(Data) :
>   Not compatible with requested type: [type=list; target=double].
> > colMins(Data, na.rm = TRUE)
>  Error in colMins(Data, na.rm = TRUE) :
>   unused argument (na.rm = TRUE)
> > colMins(Data, value = FALSE, parallel = FALSE)
>  Error in colMins(Data, value = FALSE, parallel = FALSE) :
>   Not compatible with requested type: [type=list; target=double].
> 
>  QUESTION
>  What is the best practice to bring a csv file into R Studio so it can be
>  accessed by colMaxs and colMins, please?
> 
> 
>  Thanks,
>  --
>  *Stephen Dawson, DSL*
>  /Executive Strategy Consultant/
>  Business & Technology
>  +1 (865) 804-3454
>  http://www.shdawson.com 
> 
>  __
>  R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>  https://stat.ethz.ch/mailman/listinfo/r-help
>  PLEASE do read the 

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 Strategy Consultant/
Business & Technology
+1 (865) 804-3454
http://www.shdawson.com 


On 11/30/21 5:26 PM, Bert Gunter wrote:

... 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.

Bert

On Tue, Nov 30, 2021 at 2:11 PM Stephen H. Dawson, DSL
 wrote:

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*
/Executive Strategy Consultant/
Business & Technology
+1 (865) 804-3454
http://www.shdawson.com 


On 11/30/21 3:19 PM, Bert Gunter wrote:

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.r-project.org/doc/FAQ/R-FAQ.html#Add-on-packages-in-R
This gives the list of current _standard_ packages]

If the question relates to a contributed package , e.g., one
downloaded from CRAN, try contacting the package maintainer first. You
can also use find("functionname") and
packageDescription("packagename") to find this information. Only send
such questions to R-help or R-devel if you get no reply or need
further assistance. This applies to both requests for help and to bug
reports."

Note that RStudio maintains its own help resources at:
https://community.rstudio.com/
This is where questions about the TidyVerse, ggplot, etc. should be posted.



Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )

On Tue, Nov 30, 2021 at 10:55 AM Stephen H. Dawson, DSL via R-help
 wrote:

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 into R Studio using:
Data <- read.csv("./input/DataSet05.csv", header=T)

However, I read the instructions listed on page 54 of the PDF saying I
need to bring data into R using a matrix. I think read.csv brings the
data in as a dataframe. I think colMins is failing because it is looking
for a matrix but finds a dataframe.

   > colMaxs(Data)
Error in colMaxs(Data) :
 Not compatible with requested type: [type=list; target=double].
   > colMins(Data, na.rm = TRUE)
Error in colMins(Data, na.rm = TRUE) :
 unused argument (na.rm = TRUE)
   > colMins(Data, value = FALSE, parallel = FALSE)
Error in colMins(Data, value = FALSE, parallel = FALSE) :
 Not compatible with requested type: [type=list; target=double].

QUESTION
What is the best practice to bring a csv file into R Studio so it can be
accessed by colMaxs and colMins, please?


Thanks,
--
*Stephen Dawson, DSL*
/Executive Strategy Consultant/
Business & Technology
+1 (865) 804-3454
http://www.shdawson.com 

__
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-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] 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.

Bert

On Tue, Nov 30, 2021 at 2:11 PM Stephen H. Dawson, DSL
 wrote:
>
> 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*
> /Executive Strategy Consultant/
> Business & Technology
> +1 (865) 804-3454
> http://www.shdawson.com 
>
>
> On 11/30/21 3:19 PM, Bert Gunter wrote:
> > 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.r-project.org/doc/FAQ/R-FAQ.html#Add-on-packages-in-R
> > This gives the list of current _standard_ packages]
> >
> > If the question relates to a contributed package , e.g., one
> > downloaded from CRAN, try contacting the package maintainer first. You
> > can also use find("functionname") and
> > packageDescription("packagename") to find this information. Only send
> > such questions to R-help or R-devel if you get no reply or need
> > further assistance. This applies to both requests for help and to bug
> > reports."
> >
> > Note that RStudio maintains its own help resources at:
> > https://community.rstudio.com/
> > This is where questions about the TidyVerse, ggplot, etc. should be posted.
> >
> >
> >
> > Bert Gunter
> >
> > "The trouble with having an open mind is that people keep coming along
> > and sticking things into it."
> > -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
> >
> > On Tue, Nov 30, 2021 at 10:55 AM Stephen H. Dawson, DSL via R-help
> >  wrote:
> >> 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 into R Studio using:
> >> Data <- read.csv("./input/DataSet05.csv", header=T)
> >>
> >> However, I read the instructions listed on page 54 of the PDF saying I
> >> need to bring data into R using a matrix. I think read.csv brings the
> >> data in as a dataframe. I think colMins is failing because it is looking
> >> for a matrix but finds a dataframe.
> >>
> >>   > colMaxs(Data)
> >> Error in colMaxs(Data) :
> >> Not compatible with requested type: [type=list; target=double].
> >>   > colMins(Data, na.rm = TRUE)
> >> Error in colMins(Data, na.rm = TRUE) :
> >> unused argument (na.rm = TRUE)
> >>   > colMins(Data, value = FALSE, parallel = FALSE)
> >> Error in colMins(Data, value = FALSE, parallel = FALSE) :
> >> Not compatible with requested type: [type=list; target=double].
> >>
> >> QUESTION
> >> What is the best practice to bring a csv file into R Studio so it can be
> >> accessed by colMaxs and colMins, please?
> >>
> >>
> >> Thanks,
> >> --
> >> *Stephen Dawson, DSL*
> >> /Executive Strategy Consultant/
> >> Business & Technology
> >> +1 (865) 804-3454
> >> http://www.shdawson.com 
> >>
> >> __
> >> 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-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] 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:14 PM, Stephen H. Dawson, DSL via R-help wrote:

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, 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. Since you have told us nothing useful about the data, 
it is up to you to inspect your data and figure out what to do with it.


On November 30, 2021 10:55:13 AM PST, "Stephen H. Dawson, DSL via 
R-help"  wrote:

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 into R Studio using:
Data <- read.csv("./input/DataSet05.csv", header=T)

However, I read the instructions listed on page 54 of the PDF saying I
need to bring data into R using a matrix. I think read.csv brings the
data in as a dataframe. I think colMins is failing because it is 
looking

for a matrix but finds a dataframe.


colMaxs(Data)

Error in colMaxs(Data) :
   Not compatible with requested type: [type=list; target=double].

colMins(Data, na.rm = TRUE)

Error in colMins(Data, na.rm = TRUE) :
   unused argument (na.rm = TRUE)

colMins(Data, value = FALSE, parallel = FALSE)

Error in colMins(Data, value = FALSE, parallel = FALSE) :
   Not compatible with requested type: [type=list; target=double].

QUESTION
What is the best practice to bring a csv file into R Studio so it 
can be

accessed by colMaxs and colMins, please?


Thanks,


__
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-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] 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
http://www.shdawson.com 


On 11/30/21 3:24 PM, Bill Dunlap wrote:
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 could use

   vapply(yourDataFrame, which.min, FUN.VALUE=NA_real_)
or
    vapply(yourDataFrame, min, FUN.VALUE=NA_real_)
instead of colMins.

-Bill

On Tue, Nov 30, 2021 at 10:55 AM Stephen H. Dawson, DSL via R-help 
mailto:r-help@r-project.org>> wrote:


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 into R Studio using:
Data <- read.csv("./input/DataSet05.csv", header=T)

However, I read the instructions listed on page 54 of the PDF
saying I
need to bring data into R using a matrix. I think read.csv brings the
data in as a dataframe. I think colMins is failing because it is
looking
for a matrix but finds a dataframe.

 > colMaxs(Data)
Error in colMaxs(Data) :
   Not compatible with requested type: [type=list; target=double].
 > colMins(Data, na.rm = TRUE)
Error in colMins(Data, na.rm = TRUE) :
   unused argument (na.rm = TRUE)
 > colMins(Data, value = FALSE, parallel = FALSE)
Error in colMins(Data, value = FALSE, parallel = FALSE) :
   Not compatible with requested type: [type=list; target=double].

QUESTION
What is the best practice to bring a csv file into R Studio so it
can be
accessed by colMaxs and colMins, please?


Thanks,
-- 
*Stephen Dawson, DSL*

/Executive Strategy Consultant/
Business & Technology
+1 (865) 804-3454
http://www.shdawson.com 
>

__
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-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] 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, 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. Since you have told us nothing useful about the data, it is up to you 
to inspect your data and figure out what to do with it.

On November 30, 2021 10:55:13 AM PST, "Stephen H. Dawson, DSL via R-help" 
 wrote:

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 into R Studio using:
Data <- read.csv("./input/DataSet05.csv", header=T)

However, I read the instructions listed on page 54 of the PDF saying I
need to bring data into R using a matrix. I think read.csv brings the
data in as a dataframe. I think colMins is failing because it is looking
for a matrix but finds a dataframe.


colMaxs(Data)

Error in colMaxs(Data) :
   Not compatible with requested type: [type=list; target=double].

colMins(Data, na.rm = TRUE)

Error in colMins(Data, na.rm = TRUE) :
   unused argument (na.rm = TRUE)

colMins(Data, value = FALSE, parallel = FALSE)

Error in colMins(Data, value = FALSE, parallel = FALSE) :
   Not compatible with requested type: [type=list; target=double].

QUESTION
What is the best practice to bring a csv file into R Studio so it can be
accessed by colMaxs and colMins, please?


Thanks,


__
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] 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*
/Executive Strategy Consultant/
Business & Technology
+1 (865) 804-3454
http://www.shdawson.com 


On 11/30/21 3:19 PM, Bert Gunter wrote:

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.r-project.org/doc/FAQ/R-FAQ.html#Add-on-packages-in-R
This gives the list of current _standard_ packages]

If the question relates to a contributed package , e.g., one
downloaded from CRAN, try contacting the package maintainer first. You
can also use find("functionname") and
packageDescription("packagename") to find this information. Only send
such questions to R-help or R-devel if you get no reply or need
further assistance. This applies to both requests for help and to bug
reports."

Note that RStudio maintains its own help resources at:
https://community.rstudio.com/
This is where questions about the TidyVerse, ggplot, etc. should be posted.



Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )

On Tue, Nov 30, 2021 at 10:55 AM Stephen H. Dawson, DSL via R-help
 wrote:

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 into R Studio using:
Data <- read.csv("./input/DataSet05.csv", header=T)

However, I read the instructions listed on page 54 of the PDF saying I
need to bring data into R using a matrix. I think read.csv brings the
data in as a dataframe. I think colMins is failing because it is looking
for a matrix but finds a dataframe.

  > colMaxs(Data)
Error in colMaxs(Data) :
Not compatible with requested type: [type=list; target=double].
  > colMins(Data, na.rm = TRUE)
Error in colMins(Data, na.rm = TRUE) :
unused argument (na.rm = TRUE)
  > colMins(Data, value = FALSE, parallel = FALSE)
Error in colMins(Data, value = FALSE, parallel = FALSE) :
Not compatible with requested type: [type=list; target=double].

QUESTION
What is the best practice to bring a csv file into R Studio so it can be
accessed by colMaxs and colMins, please?


Thanks,
--
*Stephen Dawson, DSL*
/Executive Strategy Consultant/
Business & Technology
+1 (865) 804-3454
http://www.shdawson.com 

__
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-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] 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 in the plotmath documentation just before the
examples for more details on this, along with some caveats about the
need for a suitable display/plot device.

More laboriously, but perhaps more informatively, one can look up
"unicode code point for degree symbol" to find that it is decimal 176.
Then R's intToUtf8() function converts this to the UTF-8 encoding that
**should** display as a "degree" symbol, subject to the above
referenced caveats.
Hence:
> intToUtf8(176)
[1] "°"  ##degree character

## So, for example, you can do:
> degrF <-paste0(intToUtf8(176),"F")
> degrF
[1] "°F" ("degrees F")

> plot(1:5, runif(5),xlab = paste0("Temp (", degrF,")"), ylab = "result")

As Andrew said, you can use plotmath to do this, too; it just isn't
needed for simple insertion of "standard" symbols.

NOTE: As I am far from an expert on all of this, I would appreciate
clarification or correction of any errors or misstatements in the
above.

Bert Gunter


On Tue, Nov 30, 2021 at 11:34 AM Andrew Simmons  wrote:
>
> 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 couple of methods; one put the entire example string
> > in the axis label, the other is close, but still incorrect.
> >
> > Source example:
> > #define expression with superscript
> > x_expression <- expression(x^3 ~ variable ~ label)
> > # The example axis label is:
> > 'X3 variable label' (with the 3 as a superscript)
> >
> > My use:
> > # Set degree symbol as superscript in plot's y axis:
> > y_expression <- expression(^o ~ C)
> >
> > R's error message:
> > Error in source("../scripts/all_temp_plots.r") :
> >../scripts/all_temp_plots.r:10:28: unexpected '^'
> > 9: # Set degree symbol as superscript in plot's y axis:
> > 10: y_expression <- expression(^
> > ^
> >
> > What is the proper way to display a degree symbol in a plot's axis label?
> >
> > 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://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
>
> [[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.

__
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] 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 preceeding
the ^ symbol.

The axis label is 'Temperature (oC)' with the degree symbol preceeding a
character, not following a specific digit.

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://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


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 always spelled out.

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://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


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 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 prefix to
> either C or F. In my case:
> ylab('Water Temperature (\u00B0C)')
> does the job.
>
> I found this solution with the DDG search string, 'degree symbol in R plot
> axis label'. This stackexchange thread has the answer:
> <
> https://stackoverflow.com/questions/51799118/writing-the-symbol-degrees-celsius-in-axis-titles-with-r-plotly
> >
>
> Regards,
>
> 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://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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] 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 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 prefix to
either C or F. In my case:
ylab('Water Temperature (\u00B0C)')
does the job.

I found this solution with the DDG search string, 'degree symbol in R 
plot

axis label'. This stackexchange thread has the answer:
 



Regards,

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://www.R-project.org/posting-guide.html

and provide commented, minimal, self-contained, reproducible code.


__
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] 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 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 prefix to
> either C or F. In my case:
> ylab('Water Temperature (\u00B0C)')
> does the job.
>
> I found this solution with the DDG search string, 'degree symbol in R plot
> axis label'. This stackexchange thread has the answer:
> <
> https://stackoverflow.com/questions/51799118/writing-the-symbol-degrees-celsius-in-axis-titles-with-r-plotly
> >
>
> Regards,
>
> 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://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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] 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. Since you have told us nothing useful about the data, it is up to you 
to inspect your data and figure out what to do with it.

On November 30, 2021 10:55:13 AM PST, "Stephen H. Dawson, DSL via R-help" 
 wrote:
>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 into R Studio using:
>Data <- read.csv("./input/DataSet05.csv", header=T)
>
>However, I read the instructions listed on page 54 of the PDF saying I 
>need to bring data into R using a matrix. I think read.csv brings the 
>data in as a dataframe. I think colMins is failing because it is looking 
>for a matrix but finds a dataframe.
>
> > colMaxs(Data)
>Error in colMaxs(Data) :
>   Not compatible with requested type: [type=list; target=double].
> > colMins(Data, na.rm = TRUE)
>Error in colMins(Data, na.rm = TRUE) :
>   unused argument (na.rm = TRUE)
> > colMins(Data, value = FALSE, parallel = FALSE)
>Error in colMins(Data, value = FALSE, parallel = FALSE) :
>   Not compatible with requested type: [type=list; target=double].
>
>QUESTION
>What is the best practice to bring a csv file into R Studio so it can be 
>accessed by colMaxs and colMins, please?
>
>
>Thanks,

-- 
Sent from my phone. Please excuse my brevity.

__
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] 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 prefix to
either C or F. In my case:
ylab('Water Temperature (\u00B0C)')
does the job.

I found this solution with the DDG search string, 'degree symbol in R plot
axis label'. This stackexchange thread has the answer:


Regards,

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://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


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
could use
   vapply(yourDataFrame, which.min, FUN.VALUE=NA_real_)
or
vapply(yourDataFrame, min, FUN.VALUE=NA_real_)
instead of colMins.

-Bill

On Tue, Nov 30, 2021 at 10:55 AM Stephen H. Dawson, DSL via R-help <
r-help@r-project.org> wrote:

> 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 into R Studio using:
> Data <- read.csv("./input/DataSet05.csv", header=T)
>
> However, I read the instructions listed on page 54 of the PDF saying I
> need to bring data into R using a matrix. I think read.csv brings the
> data in as a dataframe. I think colMins is failing because it is looking
> for a matrix but finds a dataframe.
>
>  > colMaxs(Data)
> Error in colMaxs(Data) :
>Not compatible with requested type: [type=list; target=double].
>  > colMins(Data, na.rm = TRUE)
> Error in colMins(Data, na.rm = TRUE) :
>unused argument (na.rm = TRUE)
>  > colMins(Data, value = FALSE, parallel = FALSE)
> Error in colMins(Data, value = FALSE, parallel = FALSE) :
>Not compatible with requested type: [type=list; target=double].
>
> QUESTION
> What is the best practice to bring a csv file into R Studio so it can be
> accessed by colMaxs and colMins, please?
>
>
> Thanks,
> --
> *Stephen Dawson, DSL*
> /Executive Strategy Consultant/
> Business & Technology
> +1 (865) 804-3454
> http://www.shdawson.com 
>
> __
> 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.
>

[[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] 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.r-project.org/doc/FAQ/R-FAQ.html#Add-on-packages-in-R
This gives the list of current _standard_ packages]

If the question relates to a contributed package , e.g., one
downloaded from CRAN, try contacting the package maintainer first. You
can also use find("functionname") and
packageDescription("packagename") to find this information. Only send
such questions to R-help or R-devel if you get no reply or need
further assistance. This applies to both requests for help and to bug
reports."

Note that RStudio maintains its own help resources at:
https://community.rstudio.com/
This is where questions about the TidyVerse, ggplot, etc. should be posted.



Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )

On Tue, Nov 30, 2021 at 10:55 AM Stephen H. Dawson, DSL via R-help
 wrote:
>
> 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 into R Studio using:
> Data <- read.csv("./input/DataSet05.csv", header=T)
>
> However, I read the instructions listed on page 54 of the PDF saying I
> need to bring data into R using a matrix. I think read.csv brings the
> data in as a dataframe. I think colMins is failing because it is looking
> for a matrix but finds a dataframe.
>
>  > colMaxs(Data)
> Error in colMaxs(Data) :
>Not compatible with requested type: [type=list; target=double].
>  > colMins(Data, na.rm = TRUE)
> Error in colMins(Data, na.rm = TRUE) :
>unused argument (na.rm = TRUE)
>  > colMins(Data, value = FALSE, parallel = FALSE)
> Error in colMins(Data, value = FALSE, parallel = FALSE) :
>Not compatible with requested type: [type=list; target=double].
>
> QUESTION
> What is the best practice to bring a csv file into R Studio so it can be
> accessed by colMaxs and colMins, please?
>
>
> Thanks,
> --
> *Stephen Dawson, DSL*
> /Executive Strategy Consultant/
> Business & Technology
> +1 (865) 804-3454
> http://www.shdawson.com 
>
> __
> 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-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] 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.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] 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 couple of methods; one put the entire example string
> in the axis label, the other is close, but still incorrect.
>
> Source example:
> #define expression with superscript
> x_expression <- expression(x^3 ~ variable ~ label)
> # The example axis label is:
> 'X3 variable label' (with the 3 as a superscript)
>
> My use:
> # Set degree symbol as superscript in plot's y axis:
> y_expression <- expression(^o ~ C)
>
> R's error message:
> Error in source("../scripts/all_temp_plots.r") :
>../scripts/all_temp_plots.r:10:28: unexpected '^'
> 9: # Set degree symbol as superscript in plot's y axis:
> 10: y_expression <- expression(^
> ^
>
> What is the proper way to display a degree symbol in a plot's axis label?
>
> 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://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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.


[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 with superscript
x_expression <- expression(x^3 ~ variable ~ label)
# The example axis label is:
'X3 variable label' (with the 3 as a superscript)

My use:
# Set degree symbol as superscript in plot's y axis:
y_expression <- expression(^o ~ C)

R's error message:
Error in source("../scripts/all_temp_plots.r") :
  ../scripts/all_temp_plots.r:10:28: unexpected '^'
9: # Set degree symbol as superscript in plot's y axis:
10: y_expression <- expression(^
   ^

What is the proper way to display a degree symbol in a plot's axis label?

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://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[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 into R Studio using:
Data <- read.csv("./input/DataSet05.csv", header=T)

However, I read the instructions listed on page 54 of the PDF saying I 
need to bring data into R using a matrix. I think read.csv brings the 
data in as a dataframe. I think colMins is failing because it is looking 
for a matrix but finds a dataframe.


> colMaxs(Data)
Error in colMaxs(Data) :
  Not compatible with requested type: [type=list; target=double].
> colMins(Data, na.rm = TRUE)
Error in colMins(Data, na.rm = TRUE) :
  unused argument (na.rm = TRUE)
> colMins(Data, value = FALSE, parallel = FALSE)
Error in colMins(Data, value = FALSE, parallel = FALSE) :
  Not compatible with requested type: [type=list; target=double].

QUESTION
What is the best practice to bring a csv file into R Studio so it can be 
accessed by colMaxs and colMins, please?



Thanks,
--
*Stephen Dawson, DSL*
/Executive Strategy Consultant/
Business & Technology
+1 (865) 804-3454
http://www.shdawson.com 

__
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] 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://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


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,

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://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


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, since not
everyone uses tidyverse by default, although it isn't necessary for
this question.

Sarah


On Tue, Nov 30, 2021 at 9:45 AM Andrew Simmons  wrote:
>
> 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,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-10-18,temp,12.5,oC
> > 31731,2011-01-10,temp,5.4,oC
> >
> > The import function:
> > sal_temp <- read_csv("../data/geochem/sal-temp.csv", col_names = TRUE,
> >   col_types = list (
> >   site_nbr = col_character(),
> >   sampdate = col_date(),
> >   param = col_character(),
> >   quant = col_double(),
> >   unit = col_character()
> >   ))
> >
> > The response from R:
> > source('../scripts/test.r')
> > Warning message:
> > The following named parsers don't match the column names: sampdate, param
> >
> > I searched the web to see if 'temp' is causing the problem and didn't find
> > an answer; my search term might have been flawed.
> >
> > If that string is a problem please suggest an alternative.
> >
> > TIA,
> >
> > 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://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
>
> [[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.



-- 
Sarah Goslee (she/her)
http://www.numberwright.com

__
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] 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.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-10-18,temp,12.5,oC
31731,2011-01-10,temp,5.4,oC

The import function:
sal_temp <- read_csv("../data/geochem/sal-temp.csv", col_names = TRUE,
 col_types = list (
 site_nbr = col_character(),
 sampdate = col_date(),
 param = col_character(),
 quant = col_double(),
 unit = col_character()
 ))

The response from R:
source('../scripts/test.r')
Warning message:
The following named parsers don't match the column names: sampdate, param

I searched the web to see if 'temp' is causing the problem and didn't 
find

an answer; my search term might have been flawed.

If that string is a problem please suggest an alternative.

TIA,

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://www.R-project.org/posting-guide.html

and provide commented, minimal, self-contained, reproducible code.


--
Micha Silver
Ben Gurion Univ.
Sde Boker, Remote Sensing Lab
cell: +972-523-665918

__
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] 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,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-10-18,temp,12.5,oC
> 31731,2011-01-10,temp,5.4,oC
>
> The import function:
> sal_temp <- read_csv("../data/geochem/sal-temp.csv", col_names = TRUE,
>   col_types = list (
>   site_nbr = col_character(),
>   sampdate = col_date(),
>   param = col_character(),
>   quant = col_double(),
>   unit = col_character()
>   ))
>
> The response from R:
> source('../scripts/test.r')
> Warning message:
> The following named parsers don't match the column names: sampdate, param
>
> I searched the web to see if 'temp' is causing the problem and didn't find
> an answer; my search term might have been flawed.
>
> If that string is a problem please suggest an alternative.
>
> TIA,
>
> 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://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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.


[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-10-18,temp,12.5,oC
31731,2011-01-10,temp,5.4,oC

The import function:
sal_temp <- read_csv("../data/geochem/sal-temp.csv", col_names = TRUE,
 col_types = list (
 site_nbr = col_character(),
 sampdate = col_date(),
 param = col_character(),
 quant = col_double(),
 unit = col_character()
 ))

The response from R:
source('../scripts/test.r')
Warning message:
The following named parsers don't match the column names: sampdate, param

I searched the web to see if 'temp' is causing the problem and didn't find
an answer; my search term might have been flawed.

If that string is a problem please suggest an alternative.

TIA,

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://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


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.marche.it
---Oo-oO


Da: PIKAL Petr [petr.pi...@precheza.cz]
Inviato: martedì 30 novembre 2021 12.45
A: Duncan Murdoch; Jim Lemon
Cc: r-help mailing list; Stefano Sofia
Oggetto: RE: [R] converting to POSIXct

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 Murdoch 
> Sent: Tuesday, November 30, 2021 12:05 PM
> To: Jim Lemon ; PIKAL Petr
> 
> Cc: r-help mailing list ; Stefano Sofia
> 
> Subject: Re: [R] converting to POSIXct
>
> 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 happening is simply the default formatting.
>
> Be explicit about the format if you want to see the seconds, e.g.
>
>  > format(ssdf$data_POSIX, format = '%Y-%m-%d %H:%M:%S') [1] "2002-11-
> 01 00:00:00" "2002-11-01 00:00:00"
>
> Duncan Murdoch
>
> >
> > 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
> >
> > data_POSIX Sensor_code value
> > 1 2002-11-01 00:00:011694   7.2
> > 2 2002-11-01 00:00:001723  10.8
> >
> > but if there is a single small increment, they all show up.
> >
> > Jim
> >
> > On Tue, Nov 30, 2021 at 7:33 PM PIKAL Petr 
> wrote:
> >>
> >> 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-11-01 +01"
> >>
> >> add value to hours
> >>> fix(temp)
> >>> temp
> >> data_POSIX Sensor_code value
> >> 1 2002-11-01 00:01:001694   7.2
> >> 2 2002-11-01 00:00:001723  10.8
> >>
> >> Voila, hours are back.
> >>> as.POSIXct(temp$data_POSIX, format = "%Y-%m-%d %H:%M:%S",
> >>> tz="Etc/GMT-1")
> >> [1] "2002-11-01 00:01:00 +01" "2002-11-01 00:00:00 +01"
> >>
> >> So nothing wrong in uyour code, hours are there but they are probably
> not printed to console and hours are there but hidden.
> >>
> >> Cheers
> >> Petr
> >>
> >>> -Original Message-
> >>> From: R-help  On Behalf Of Stefano
> >>> Sofia
> >>> Sent: Tuesday, November 30, 2021 9:20 AM
> >>> To: r-help mailing list 
> >>> Subject: [R] converting to POSIXct
> >>>
> >>> 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,1723,10.8
> >>> ...
> >>>
> >>> I load it with
> >>> myfile <- read.table(file="mypath/myfile.txt", header = TRUE,
> >>> sep=",", dec = ".", stringsAsFactors = FALSE)
> >>>
> >>> When I try to convert the data_POSIX column (which is a character)
> >>> to POSIXct with
> >>>
> >>> myfile$data_POSIX <- as.POSIXct(myfile$data_POSIX, format =
> >>> "%Y-%m-%d %H:%M:%S", tz="Etc/GMT-1")
> >>>
> >>> the outupt is
> >>>
> >>> 2002-11-01 1694 7.2
> >>> 2002-11-01 1723 10.8
> >>> ...
> >>>
> >>> Why I keep loosing hours, minutes and seconds? Wher eis my mistake
> >>> or my misunderstanding?
> >>>
> >>> Sorry again if I have not been able to reproduce the R code, and
> >>> thank you for your support.
> >>> 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.marche.it
> >>> ---Oo-oO
> >>>
> >>> 
> >>>
> >>> AVVISO IMPORTANTE: Questo messaggio di posta elettronica può
> >>> contenere informazioni confidenziali, pertanto è destinato solo a
> >>> persone autorizzate alla ricezione. I messaggi di posta elettronica
> >>> per i client di 

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 Murdoch 
> Sent: Tuesday, November 30, 2021 12:05 PM
> To: Jim Lemon ; PIKAL Petr
> 
> Cc: r-help mailing list ; Stefano Sofia
> 
> Subject: Re: [R] converting to POSIXct
> 
> 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 happening is simply the default formatting.
> 
> Be explicit about the format if you want to see the seconds, e.g.
> 
>  > format(ssdf$data_POSIX, format = '%Y-%m-%d %H:%M:%S') [1] "2002-11-
> 01 00:00:00" "2002-11-01 00:00:00"
> 
> Duncan Murdoch
> 
> >
> > 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
> >
> > data_POSIX Sensor_code value
> > 1 2002-11-01 00:00:011694   7.2
> > 2 2002-11-01 00:00:001723  10.8
> >
> > but if there is a single small increment, they all show up.
> >
> > Jim
> >
> > On Tue, Nov 30, 2021 at 7:33 PM PIKAL Petr 
> wrote:
> >>
> >> 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-11-01 +01"
> >>
> >> add value to hours
> >>> fix(temp)
> >>> temp
> >> data_POSIX Sensor_code value
> >> 1 2002-11-01 00:01:001694   7.2
> >> 2 2002-11-01 00:00:001723  10.8
> >>
> >> Voila, hours are back.
> >>> as.POSIXct(temp$data_POSIX, format = "%Y-%m-%d %H:%M:%S",
> >>> tz="Etc/GMT-1")
> >> [1] "2002-11-01 00:01:00 +01" "2002-11-01 00:00:00 +01"
> >>
> >> So nothing wrong in uyour code, hours are there but they are probably
> not printed to console and hours are there but hidden.
> >>
> >> Cheers
> >> Petr
> >>
> >>> -Original Message-
> >>> From: R-help  On Behalf Of Stefano
> >>> Sofia
> >>> Sent: Tuesday, November 30, 2021 9:20 AM
> >>> To: r-help mailing list 
> >>> Subject: [R] converting to POSIXct
> >>>
> >>> 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,1723,10.8
> >>> ...
> >>>
> >>> I load it with
> >>> myfile <- read.table(file="mypath/myfile.txt", header = TRUE,
> >>> sep=",", dec = ".", stringsAsFactors = FALSE)
> >>>
> >>> When I try to convert the data_POSIX column (which is a character)
> >>> to POSIXct with
> >>>
> >>> myfile$data_POSIX <- as.POSIXct(myfile$data_POSIX, format =
> >>> "%Y-%m-%d %H:%M:%S", tz="Etc/GMT-1")
> >>>
> >>> the outupt is
> >>>
> >>> 2002-11-01 1694 7.2
> >>> 2002-11-01 1723 10.8
> >>> ...
> >>>
> >>> Why I keep loosing hours, minutes and seconds? Wher eis my mistake
> >>> or my misunderstanding?
> >>>
> >>> Sorry again if I have not been able to reproduce the R code, and
> >>> thank you for your support.
> >>> 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.marche.it
> >>> ---Oo-oO
> >>>
> >>> 
> >>>
> >>> AVVISO IMPORTANTE: Questo messaggio di posta elettronica può
> >>> contenere informazioni confidenziali, pertanto è destinato solo a
> >>> persone autorizzate alla ricezione. I messaggi di posta elettronica
> >>> per i client di Regione Marche possono contenere informazioni
> >>> confidenziali e con privilegi legali. Se non si è il destinatario
> >>> specificato, non leggere, copiare, inoltrare o archiviare questo
> >>> messaggio. Se si è ricevuto questo messaggio per errore, inoltrarlo
> >>> al mittente ed eliminarlo completamente dal sistema del proprio
> >>> computer. Ai sensi dell’art. 6 della DGR n. 1394/2008 si segnala
> >>> che, in caso di necessità ed urgenza, la risposta al presente messaggio di
> posta elettronica può essere visionata da persone estranee al destinatario.
> >>> IMPORTANT 

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 happening is simply the default formatting.

Be explicit about the format if you want to see the seconds, e.g.

> format(ssdf$data_POSIX, format = '%Y-%m-%d %H:%M:%S')
[1] "2002-11-01 00:00:00" "2002-11-01 00:00:00"

Duncan Murdoch



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

data_POSIX Sensor_code value
1 2002-11-01 00:00:011694   7.2
2 2002-11-01 00:00:001723  10.8

but if there is a single small increment, they all show up.

Jim

On Tue, Nov 30, 2021 at 7:33 PM PIKAL Petr  wrote:


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-11-01 +01"

add value to hours

fix(temp)
temp

data_POSIX Sensor_code value
1 2002-11-01 00:01:001694   7.2
2 2002-11-01 00:00:001723  10.8

Voila, hours are back.

as.POSIXct(temp$data_POSIX, format = "%Y-%m-%d %H:%M:%S", tz="Etc/GMT-1")

[1] "2002-11-01 00:01:00 +01" "2002-11-01 00:00:00 +01"

So nothing wrong in uyour code, hours are there but they are probably not 
printed to console and hours are there but hidden.

Cheers
Petr


-Original Message-
From: R-help  On Behalf Of Stefano Sofia
Sent: Tuesday, November 30, 2021 9:20 AM
To: r-help mailing list 
Subject: [R] converting to POSIXct

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,1723,10.8
...

I load it with
myfile <- read.table(file="mypath/myfile.txt", header = TRUE, sep=",", dec =
".", stringsAsFactors = FALSE)

When I try to convert the data_POSIX column (which is a character) to
POSIXct with

myfile$data_POSIX <- as.POSIXct(myfile$data_POSIX, format = "%Y-%m-%d
%H:%M:%S", tz="Etc/GMT-1")

the outupt is

2002-11-01 1694 7.2
2002-11-01 1723 10.8
...

Why I keep loosing hours, minutes and seconds? Wher eis my mistake or my
misunderstanding?

Sorry again if I have not been able to reproduce the R code, and thank you
for your support.
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.marche.it
---Oo-oO



AVVISO IMPORTANTE: Questo messaggio di posta elettronica può contenere
informazioni confidenziali, pertanto è destinato solo a persone autorizzate
alla ricezione. I messaggi di posta elettronica per i client di Regione Marche
possono contenere informazioni confidenziali e con privilegi legali. Se non si è
il destinatario specificato, non leggere, copiare, inoltrare o archiviare questo
messaggio. Se si è ricevuto questo messaggio per errore, inoltrarlo al
mittente ed eliminarlo completamente dal sistema del proprio computer. Ai
sensi dell’art. 6 della DGR n. 1394/2008 si segnala che, in caso di necessità ed
urgenza, la risposta al presente messaggio di posta elettronica può essere
visionata da persone estranee al destinatario.
IMPORTANT NOTICE: This e-mail message is intended to be received only by
persons entitled to receive the confidential information it may contain. E-mail
messages to clients of Regione Marche may contain information that is
confidential and legally privileged. Please do not read, copy, forward, or store
this message unless you are an intended recipient of it. If you have received
this message in error, please forward it to the sender and delete it
completely from your computer system.

--
Questo messaggio  stato analizzato da Libraesva ESG ed  risultato non infetto.
This message was scanned by Libraesva ESG and is believed to be clean.


   [[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.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see

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

   data_POSIX Sensor_code value
1 2002-11-01 00:00:011694   7.2
2 2002-11-01 00:00:001723  10.8

but if there is a single small increment, they all show up.

Jim

On Tue, Nov 30, 2021 at 7:33 PM PIKAL Petr  wrote:
>
> 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-11-01 +01"
>
> add value to hours
> > fix(temp)
> > temp
>data_POSIX Sensor_code value
> 1 2002-11-01 00:01:001694   7.2
> 2 2002-11-01 00:00:001723  10.8
>
> Voila, hours are back.
> > as.POSIXct(temp$data_POSIX, format = "%Y-%m-%d %H:%M:%S", tz="Etc/GMT-1")
> [1] "2002-11-01 00:01:00 +01" "2002-11-01 00:00:00 +01"
>
> So nothing wrong in uyour code, hours are there but they are probably not 
> printed to console and hours are there but hidden.
>
> Cheers
> Petr
>
> > -Original Message-
> > From: R-help  On Behalf Of Stefano Sofia
> > Sent: Tuesday, November 30, 2021 9:20 AM
> > To: r-help mailing list 
> > Subject: [R] converting to POSIXct
> >
> > 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,1723,10.8
> > ...
> >
> > I load it with
> > myfile <- read.table(file="mypath/myfile.txt", header = TRUE, sep=",", dec =
> > ".", stringsAsFactors = FALSE)
> >
> > When I try to convert the data_POSIX column (which is a character) to
> > POSIXct with
> >
> > myfile$data_POSIX <- as.POSIXct(myfile$data_POSIX, format = "%Y-%m-%d
> > %H:%M:%S", tz="Etc/GMT-1")
> >
> > the outupt is
> >
> > 2002-11-01 1694 7.2
> > 2002-11-01 1723 10.8
> > ...
> >
> > Why I keep loosing hours, minutes and seconds? Wher eis my mistake or my
> > misunderstanding?
> >
> > Sorry again if I have not been able to reproduce the R code, and thank you
> > for your support.
> > 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.marche.it
> > ---Oo-oO
> >
> > 
> >
> > AVVISO IMPORTANTE: Questo messaggio di posta elettronica può contenere
> > informazioni confidenziali, pertanto è destinato solo a persone autorizzate
> > alla ricezione. I messaggi di posta elettronica per i client di Regione 
> > Marche
> > possono contenere informazioni confidenziali e con privilegi legali. Se non 
> > si è
> > il destinatario specificato, non leggere, copiare, inoltrare o archiviare 
> > questo
> > messaggio. Se si è ricevuto questo messaggio per errore, inoltrarlo al
> > mittente ed eliminarlo completamente dal sistema del proprio computer. Ai
> > sensi dell’art. 6 della DGR n. 1394/2008 si segnala che, in caso di 
> > necessità ed
> > urgenza, la risposta al presente messaggio di posta elettronica può essere
> > visionata da persone estranee al destinatario.
> > IMPORTANT NOTICE: This e-mail message is intended to be received only by
> > persons entitled to receive the confidential information it may contain. 
> > E-mail
> > messages to clients of Regione Marche may contain information that is
> > confidential and legally privileged. Please do not read, copy, forward, or 
> > store
> > this message unless you are an intended recipient of it. If you have 
> > received
> > this message in error, please forward it to the sender and delete it
> > completely from your computer system.
> >
> > --
> > Questo messaggio  stato analizzato da Libraesva ESG ed  risultato non 
> > infetto.
> > This message was scanned by Libraesva ESG and is believed to be clean.
> >
> >
> >   [[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.
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 

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-11-01 +01"

add value to hours
> fix(temp)
> temp
   data_POSIX Sensor_code value
1 2002-11-01 00:01:001694   7.2
2 2002-11-01 00:00:001723  10.8

Voila, hours are back.
> as.POSIXct(temp$data_POSIX, format = "%Y-%m-%d %H:%M:%S", tz="Etc/GMT-1")
[1] "2002-11-01 00:01:00 +01" "2002-11-01 00:00:00 +01"

So nothing wrong in uyour code, hours are there but they are probably not 
printed to console and hours are there but hidden. 

Cheers
Petr

> -Original Message-
> From: R-help  On Behalf Of Stefano Sofia
> Sent: Tuesday, November 30, 2021 9:20 AM
> To: r-help mailing list 
> Subject: [R] converting to POSIXct
> 
> 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,1723,10.8
> ...
> 
> I load it with
> myfile <- read.table(file="mypath/myfile.txt", header = TRUE, sep=",", dec =
> ".", stringsAsFactors = FALSE)
> 
> When I try to convert the data_POSIX column (which is a character) to
> POSIXct with
> 
> myfile$data_POSIX <- as.POSIXct(myfile$data_POSIX, format = "%Y-%m-%d
> %H:%M:%S", tz="Etc/GMT-1")
> 
> the outupt is
> 
> 2002-11-01 1694 7.2
> 2002-11-01 1723 10.8
> ...
> 
> Why I keep loosing hours, minutes and seconds? Wher eis my mistake or my
> misunderstanding?
> 
> Sorry again if I have not been able to reproduce the R code, and thank you
> for your support.
> 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.marche.it
> ---Oo-oO
> 
> 
> 
> AVVISO IMPORTANTE: Questo messaggio di posta elettronica può contenere
> informazioni confidenziali, pertanto è destinato solo a persone autorizzate
> alla ricezione. I messaggi di posta elettronica per i client di Regione Marche
> possono contenere informazioni confidenziali e con privilegi legali. Se non 
> si è
> il destinatario specificato, non leggere, copiare, inoltrare o archiviare 
> questo
> messaggio. Se si è ricevuto questo messaggio per errore, inoltrarlo al
> mittente ed eliminarlo completamente dal sistema del proprio computer. Ai
> sensi dell’art. 6 della DGR n. 1394/2008 si segnala che, in caso di necessità 
> ed
> urgenza, la risposta al presente messaggio di posta elettronica può essere
> visionata da persone estranee al destinatario.
> IMPORTANT NOTICE: This e-mail message is intended to be received only by
> persons entitled to receive the confidential information it may contain. 
> E-mail
> messages to clients of Regione Marche may contain information that is
> confidential and legally privileged. Please do not read, copy, forward, or 
> store
> this message unless you are an intended recipient of it. If you have received
> this message in error, please forward it to the sender and delete it
> completely from your computer system.
> 
> --
> Questo messaggio  stato analizzato da Libraesva ESG ed  risultato non infetto.
> This message was scanned by Libraesva ESG and is believed to be clean.
> 
> 
>   [[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.
__
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] 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,1723,10.8
...

I load it with
myfile <- read.table(file="mypath/myfile.txt", header = TRUE, sep=",", dec = 
".", stringsAsFactors = FALSE)

When I try to convert the data_POSIX column (which is a character) to POSIXct 
with

myfile$data_POSIX <- as.POSIXct(myfile$data_POSIX, format = "%Y-%m-%d 
%H:%M:%S", tz="Etc/GMT-1")

the outupt is

2002-11-01 1694 7.2
2002-11-01 1723 10.8
...

Why I keep loosing hours, minutes and seconds? Wher eis my mistake or my 
misunderstanding?

Sorry again if I have not been able to reproduce the R code, and thank you for 
your support.
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.marche.it
---Oo-oO



AVVISO IMPORTANTE: Questo messaggio di posta elettronica può contenere 
informazioni confidenziali, pertanto è destinato solo a persone autorizzate 
alla ricezione. I messaggi di posta elettronica per i client di Regione Marche 
possono contenere informazioni confidenziali e con privilegi legali. Se non si 
è il destinatario specificato, non leggere, copiare, inoltrare o archiviare 
questo messaggio. Se si è ricevuto questo messaggio per errore, inoltrarlo al 
mittente ed eliminarlo completamente dal sistema del proprio computer. Ai sensi 
dell’art. 6 della DGR n. 1394/2008 si segnala che, in caso di necessità ed 
urgenza, la risposta al presente messaggio di posta elettronica può essere 
visionata da persone estranee al destinatario.
IMPORTANT NOTICE: This e-mail message is intended to be received only by 
persons entitled to receive the confidential information it may contain. E-mail 
messages to clients of Regione Marche may contain information that is 
confidential and legally privileged. Please do not read, copy, forward, or 
store this message unless you are an intended recipient of it. If you have 
received this message in error, please forward it to the sender and delete it 
completely from your computer system.

--
Questo messaggio  stato analizzato da Libraesva ESG ed  risultato non infetto.
This message was scanned by Libraesva ESG and is believed to be clean.


[[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.