aggregate-functions


incomplete results with aggregate (R)


I have a dataframe with 150 observations per week (consistently indexed) over a full year (52 x 150 rows) and 30 variables.
Values: 0, 1 or NA.
There is also one grouping variable "CW".
Example:
V1 V2 V3 .... V30 CW
NA NA 1 .... 0 1601
NA 1 0 .... NA 1601
NA 1 1 .... 1 1601
...
I try to calculate the mean per week and variable using the aggregate function as follows:
aggregate(dataset, FUN="mean", by=list(dataset$CW))
For some variables that works fine. But for otheres there is no mean calculated even values in the variable and week exists. I played with the na.rm option, but got also no results.
For example: I got a result for V2 in week 1601 (mean=1), but a "NA" for V30 (even I would expect 0.5).
Any guess what I'm doing wrong?
cheers
chris

Related Links

Tableau Aggregate Percentage
use aggregates (min, max, avg) in CONSTRUCT query [duplicate]
R: transposing and aggregating columns
SQL Query Aggregate Error
Usage of aggregate functions in MarkLogic
Querying customDimensions in Google Bigquery
NHibernate - QueryOver criteria appearing in Where instead in Having clause, error
Howto aggregate on full data set in Spring Batch jobs?
Creating an aggregate function fails
Necessity of declaration of function in c and cpp
Calculate window average in tableau
Complexity asymptotic relation (theta, Big O, little o, Big Omega, little omega) between functions
What are TOP_COUNT and TOP_MAXCOUNT in BigQuery?
marklogic need advise for approach to aggregate documents
multiply(num) aggregate function in postgresql
Binding the Result of an Aggregate Function to a Projected Variable

Categories

HOME
algolia
marie
typo3
ssh
grpc
abc
apache-storm
nagios
postsharp
glympse
ethereum
adroitlogic
solidity
xmlhttprequest
jinja2
samba
glibc
turn.js
dev-c++
google-drive-android-api
pumping-lemma
functional-dependencies
android-wear-2.0
priority-queue
sasl
hierarchical-data
resx
restangular
deferred
opencsv
loopback
jcr
luhn
epub
webclient
mootools
wunderground
stochastic-process
client-server
mongoid5
armadillo
pyexcel
uitextview
pexpect
smooth-streaming
nshttpurlresponse
grails-2.0
gradlew
stream-socket-client
google-cloud-shell
opticalflow
dmalloc
overhead
computed-properties
optional-parameters
particle-system
git-cherry-pick
vitamio
transaction-isolation
usps
mod
periodic-processing
hana-sql-script
ooad
apache2-module
instabug
google-finance-api
clear
kramdown
log4cxx
azure-mobile-app
vensim
p4python
tokudb
glog
opennebula
wingdb
crtdbg.h
fiware-health
quickfixn
os.walk
famous-engine
dirname
redmine-plugins
parallel-port
xps
git-subtree
starling-framework
kuka-krl
vbaccelerator
node-amqp
google-mirror-api
randomaccessfile
pechkin
listpicker
record-locking
typography
latex-suite
http-compression
ntdll
rbm
gpl
netbiscuits
states
flatten
diazo
project-files
copyfile
zend-validate
mismatch
method-call
versions
newspeak
helios
data-formats
hotfix

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App