Skip to content

sd of one row comes out as zero through dplyr (instead of NA) #201

Closed

Description

@JohnMount

sd of one row comes out as zero through dplyr (instead of NA). Below is a short example (and long documentation of the environment).

library('dplyr')
 #  
 #  Attaching package: 'dplyr'
 #  The following objects are masked from 'package:stats':
 #  
 #      filter, lag
 #  The following objects are masked from 'package:base':
 #  
 #      intersect, setdiff, setequal, union
library('RSQLite')
packageVersion('dplyr')
 #  [1] '0.5.0'
packageVersion('RSQLite')
 #  [1] '1.1.2'

my_db <- dplyr::src_sqlite(":memory:", create = TRUE)
d <- data.frame(x=1)
dplyr::summarise_all(d, dplyr::funs(sd))
 #     x
 #  1 NA
dbData <- dplyr::copy_to(my_db, d, create=TRUE)
dplyr::summarise_all(dbData, dplyr::funs(sd))
 #  Source:   query [?? x 1]
 #  Database: sqlite 3.11.1 [:memory:]
 #  
 #        x
 #    <dbl>
 #  1     0
version
 #                 _                           
 #  platform       x86_64-apple-darwin13.4.0   
 #  arch           x86_64                      
 #  os             darwin13.4.0                
 #  system         x86_64, darwin13.4.0        
 #  status                                     
 #  major          3                           
 #  minor          3.2                         
 #  year           2016                        
 #  month          10                          
 #  day            31                          
 #  svn rev        71607                       
 #  language       R                           
 #  version.string R version 3.3.2 (2016-10-31)
 #  nickname       Sincere Pumpkin Patch

Activity

  1. krlmlr commented on Feb 23, 2017

    @krlmlr
    Member

    Thanks. This looks like an RSQLite problem to me. Would you mind resubmitting there?

    dbData <- dplyr::memdb_frame(x = 1, .name = "d")
    DBI::dbGetQuery(dbData$src$con, "SELECT stdev(x) FROM d")
    #>   stdev(x)
    #> 1        0
  2. reopened this on Feb 23, 2017
  3. krlmlr commented on Feb 23, 2017

    @krlmlr
    Member

    Wrong repo, I was confused by the reprex ;-)

  4. krlmlr commented on Feb 23, 2017

    @krlmlr
    Member

    This looks like a problem in extension-functions.c, line 1612 should be changed. Same for line 1625 for the variance.

  5. self-assigned this
    on Apr 3, 2017
  6. added a commit that references this issue on Apr 3, 2017
  7. added a commit that references this issue on Apr 3, 2017
  8. added a commit that references this issue on Jun 19, 2017
  9. github-actions commented on Dec 8, 2020

    @github-actions
    Contributor

    This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.

  10. locked and limited conversation to collaborators on Dec 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions