This is great!
Many thanks to all for helping to further resolve the problem.
Best wishes
Ogbos
On Fri, Mar 29, 2024 at 6:39 AM Rui Barradas wrote:
> Às 01:43 de 29/03/2024, Ogbos Okike escreveu:
> > Dear Rui,
> > Thanks again for resolving this. I have already started using the version
> > that
Às 01:43 de 29/03/2024, Ogbos Okike escreveu:
Dear Rui,
Thanks again for resolving this. I have already started using the version
that works for me.
But to clarify the second part, please let me paste the what I did and the
error message:
set.seed(2024)
data <- data.frame(
+Date = sample(
I would guess your version of R is earlier than 4.1, when the built-in pipe was
introduced to the language
On March 28, 2024 6:43:05 PM PDT, Ogbos Okike wrote:
>Dear Rui,
>Thanks again for resolving this. I have already started using the version
>that works for me.
>
>But to clarify the second p
Dear Deepayan,
Thanks for your kind response.
Regards
Ogbos
On Thu, Mar 28, 2024 at 3:40 AM Deepayan Sarkar
wrote:
> For more complicated examples, the (relatively new) array2DF()
> function is also useful:
>
> > with(data, tapply(count, Date, mean)) |> array2DF()
> Var1Value
> 1 202
Dear Rui,
Thanks again for resolving this. I have already started using the version
that works for me.
But to clarify the second part, please let me paste the what I did and the
error message:
> set.seed(2024)
> data <- data.frame(
+Date = sample(seq(Sys.Date() - 5, Sys.Date(), by = "1 days")
Here are some pieces of working code. I assume you want the second one or the
third one that is functionally the same but all in one statement. I do not
understand why it is a factor, but I will assume that there is a current and
future reason for that. This means I cannot alter the string_data
On 28/03/2024 7:48 a.m., Stefano Sofia wrote:
as.factor(2024, 12, 1, 0, 0)
That doesn't work. You need to put the numbers in a single vector as
Fabio did, or you'll see this:
Error in as.factor(2024, 12, 1, 0, 0) : unused arguments (12, 1, 0, 0)
Duncan Murdoch
Sorry for my hurry.
The correct reproducible code is different from the initial one. The correct
example is
mydf <- data.frame(id_station = 1234, string_data = as.factor(2024, 12, 1, 0,
0), rainfall_value= 55)
In this case mydf$string_data is a factor, but of length 1 (and not 5 like in
the
Thank you Fabio.
So easy and straighforward!
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-mai
Hi Stefano,
maybe something like this can help you?
myfactor <- as.factor(c(2024, 2, 1, 0, 0))
# Convert factor values to integers
first_element <- as.integer(as.character(myfactor)[1])
second_element <- as.integer(as.character(myfactor)[2])
third_element <- as.integer(as.character(myfactor)[3])
Dear R-list users,
forgive me for this silly question, I did my best to find a solution with no
success.
Suppose I have a factor type like
myfactor <- as.factor(2024, 2, 1, 0, 0)
There are no characters (and therefore strsplit for eample does not work).
I need to store separately the 1st, 2
11 matches
Mail list logo