Displaying 20 results from an estimated 30000 matches similar to: "Bug in print for data frames?"
2023 Oct 26
1
Bug in print for data frames?
On 25/10/2023 2:18 a.m., Christian Asseburg wrote:
> Hi! I came across this unexpected behaviour in R. First I thought it was a bug in the assignment operator <- but now I think it's maybe a bug in the way data frames are being printed. What do you think?
>
> Using R 4.3.1:
>
>> x <- data.frame(A = 1, B = 2, C = 3)
>> y <- data.frame(A = 1)
>> x
>
2018 Mar 09
3
Contar categorías después de ciertos valores
Hola,
Estoy intentando averiguar cómo contar el número de categorías situadas después de ciertos valores. Por ejemplo, en el siguiente vector:
x <- c(3, "A", "B", 5, "A", 4, 5, "A", "A", 3)
el resultado que quisiera obtener es:
Valor -> Resultado
3 -> 1 A y 1 B
4 -> 0 A y 0 B
5 -> 3 A y 0 B
¿Alguien tiene alguna
2024 Sep 17
1
(no subject)
Hmmm... typos and thinkos ?
Maybe:
mean_narm<- function(x) {
m <- mean(x, na.rm = T)
if (is.nan (m)) NA else m
}
-- Bert
On Mon, Sep 16, 2024 at 4:40?PM CALUM POLWART <polc1410 at gmail.com> wrote:
>
> Rui's solution is good.
>
> Bert's suggestion is also good!
>
> For Berts suggestion you'd make the list bit
>
> list(mean = mean_narm)
>
2024 Dec 11
2
aggregate produces results in unexpected format
I am trying to use the aggregate function to run a function, catsbydat2, that produces the mean, minimum, maximum, and number of observations of the values in a dataframe, inJan2Test, by levels of the dataframe variable MyDay. The output should be in the form of a dataframe.
#my code:
# This function should process a data frame and return a data frame
# containing the mean, minimum, maximum, and
2018 Jun 08
4
Subsetting the "ROW"s of an object
> On Jun 8, 2018, at 11:52 AM, Hadley Wickham <h.wickham at gmail.com> wrote:
>
> On Fri, Jun 8, 2018 at 11:38 AM, Berry, Charles <ccberry at ucsd.edu> wrote:
>>
>>
>>> On Jun 8, 2018, at 10:37 AM, Herv? Pag?s <hpages at fredhutch.org> wrote:
>>>
>>> Also the TRUEs cause problems if some dimensions are 0:
>>>
2018 May 26
3
Grouping by 3 variable and renaming groups
ALCON
I'm trying to figure out how to rename groups in a data frame after groups
by selected variabels. I am using the dplyr library to group my data by 3
variables as follows
# group by lat (StoreX)/long (StoreY)
priceStore <- LapTopSales[,c(4,5,15,16)]
priceStore <- priceStore[complete.cases(priceStore), ] # keep only non NA
records
priceStore_Grps <- priceStore %>%
2023 Oct 17
1
transform a list of arrays to tibble
Arnaud,
Short answer may be that the tibble data structure will not be supporting row names and you may want to simply save those names in an additional column or externally.
My first thought was to simply save the names you need and then put them back on the tibble. In your code, something like this:
save.names <- names(my.ret.lst)
result.tib <- as_tibble_col(unlist(my.ret.lst),
2023 Oct 17
1
transform a list of arrays to tibble
I work with a list of crypto assets daily closing prices in a xts
class. Here is a limited example:
asset.xts.lst <- list(BTCUSDT = structure(c(26759.63, 26862, 26852.48, 27154.15,
27973.45), dim = c(5L, 1L), index = structure(c(1697068800, 1697155200,
1697241600, 1697328000, 1697414400), tzone = "UTC", tclass = "Date"),
class = c("xts",
"zoo")), ETHUSDT
2018 May 26
0
Grouping by 3 variable and renaming groups
Hello,
See if this is it:
priceStore_Grps$StoreID <- paste("Store",
seq_len(nrow(priceStore_Grps)), sep = "_")
Hope this helps,
Rui Barradas
On 5/26/2018 2:03 PM, Jeff Reichman wrote:
> ALCON
>
>
>
> I'm trying to figure out how to rename groups in a data frame after groups
> by selected variabels. I am using the dplyr library to group my
2024 Apr 16
1
read.csv
Hum...
This boils down to
> as.numeric("1.23e")
[1] 1.23
> as.numeric("1.23e-")
[1] 1.23
> as.numeric("1.23e+")
[1] 1.23
which in turn comes from this code in src/main/util.c (function R_strtod)
if (*p == 'e' || *p == 'E') {
int expsign = 1;
switch(*++p) {
case '-': expsign = -1;
case
2018 Jun 08
3
Subsetting the "ROW"s of an object
> On Jun 8, 2018, at 10:37 AM, Herv? Pag?s <hpages at fredhutch.org> wrote:
>
> Also the TRUEs cause problems if some dimensions are 0:
>
> > matrix(raw(0), nrow=5, ncol=0)[1:3 , TRUE]
> Error in matrix(raw(0), nrow = 5, ncol = 0)[1:3, TRUE] :
> (subscript) logical subscript too long
OK. But this is easy enough to handle.
>
> H.
>
> On
2008 Aug 13
2
mob(party) formula question
I try tu use mob() with my data.frame ('data.frame': 288 obs. of 81
variables; factors, numerics and ordered factors)
My response is a binary variable and I should use for modelling a logistic
regression (family=binomial).
I read in the "MOB" Vignette that I could use a formula like this if I would
like to have only partitioning variables apart from the response.
2023 Nov 02
4
Sum data according to date in sequence
Dear all,
I have this set of data. I would like to sum the EnergykWh according date
sequences.
> head(dt1,20) StationName date time EnergykWh
1 PALO ALTO CA / CAMBRIDGE #1 1/14/2016 12:09 4.680496
2 PALO ALTO CA / CAMBRIDGE #1 1/14/2016 19:50 6.272414
3 PALO ALTO CA / CAMBRIDGE #1 1/14/2016 20:22 1.032782
4 PALO ALTO CA / CAMBRIDGE #1 1/15/2016 8:25 11.004884
5
2017 Aug 14
2
tidyverse repeating error: "object 'rlang_mut_env_parent' not found"
Thanks for the feedback Jeff. Before I pursue a bug report, let me give a full example:
###### begin console output
R version 3.4.1 (2017-06-30) -- "Single Candle"
Copyright (C) 2017 The R Foundation for Statistical Computing
Platform: i386-w64-mingw32/i386 (32-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
2018 May 30
2
Filtering using multiple rows in dplyr
Hi Folks,
I have just started using dplyr and could use some help getting unstuck. It could well be that dplyr is not the package to be using, but let me just pose the question and seek your advice.
Here is my basic data frame.
head(h)
subject ageGrp ear hearingGrp sex freq L2 Ldp Phidp NF SNR
1 HALAF032 A L A F 2 0 -23.54459 55.56005 -43.08282
2007 Dec 16
2
question about the aggregate function with respect to order of levels of grouping elements
Hi,
I am using aggregate() to add up groups of data according to year and month.
It seems that the function aggregate() automatically sorts the levels of
factors of the grouping elements, even if the order of the levels of factors
is supplied. I am wondering if this is a bug, or if I missed something
important. Below is an example that shows what I mean. Does anyone know if
this is just the way
2017 Dec 29
3
Help with script
Hello there. Happy new year for everyone!
I need help with a table. This table contains 300 rows and 192 columns.
Being the first column the ID of my samples that can have several
observations.
I need to generate e NEW table that contains a single ID with the sum of
the observations by columns:
For example:
Example
ID?? A??? B? ? C? ? D? ? E? ? F? ? G.... 191 columns
a1?? 0??? 0??? 0? ? 1???
2017 Aug 14
0
tidyverse repeating error: "object 'rlang_mut_env_parent' not found"
> On Aug 14, 2017, at 8:37 AM, Szumiloski, John <John.Szumiloski at bms.com> wrote:
>
> Thanks for the feedback Jeff. Before I pursue a bug report, let me give a full example:
>
> ###### begin console output
>
> R version 3.4.1 (2017-06-30) -- "Single Candle"
> Copyright (C) 2017 The R Foundation for Statistical Computing
> Platform:
2017 Aug 14
0
tidyverse repeating error: "object 'rlang_mut_env_parent' not found"
This sounds an awful lot like a bug. Read the Posting Guide to know what to do about bugs. And delaying making the reprex is _always_ a bad idea.
--
Sent from my phone. Please excuse my brevity.
On August 14, 2017 7:26:32 AM PDT, "Szumiloski, John" <John.Szumiloski at bms.com> wrote:
>UseRs,
>
>When doing some data manipulations using the tidyverse, I am repeatedly
2018 May 26
1
Grouping by 3 variable and renaming groups
Hello,
Sorry, but I think my first answer is wrong.
You probably want something along the lines of
sp <- split(priceStore_Grps, priceStore_Grps$StorePC)
res <- lapply(seq_along(sp), function(i){
sp[[i]]$StoreID <- paste("Store", i, sep = "_")
sp[[i]]
})
res <- do.call(rbind, res)
row.names(res) <- NULL
Hope this helps,
Rui Barradas
On 5/26/2018