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

Create Expression in Report Builder 3.0 Report to sum a column
SAP Hana - STRING_AGG issue with ORDER BY CLAUSE
rrdtool does not keep max
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?

Categories

HOME
qlikview
pact
azure-active-directory
network-programming
postgresql-9.3
file-upload
c++builder
reference
skypedeveloper
itext7
squeak
browser-cache
segmentation-fault
ios-universal-links
angular-universal
aws-sdk-cpp
guidewire
saucelabs
opendaylight
console-application
openstack-horizon
ofbiz
md2
custom-component
ejb-3.1
coccinelle
knapsack-problem
symlink
dynamic-memory-allocation
login-required
slim-lang
jcr
oracle-nosql
snapkit
traitsui
abide
observer-pattern
glide-image-library
jvisualvm
peerjs
gridgain
ng-class
appcmd
aws-rds
node.js-client
iban
ownership
turbolinks
racket-student-languages
altova
bytearray
kik
chomsky-normal-form
nugetgallery
salesforce-service-cloud
askbot
bioconductor
tess4j
android-filterable
polarion
litedb
web-standards
minko
dockerpy
static-files
method-overloading
clearcanvas
twitter-finagle
email-headers
xml-validation
mandelbrot
usersettings
jython-2.5
panelgrid
google-checkout
gmail-imap
ntdll
django-tinymce
cron4j
netzke
webpage-screenshot
shapado
google-email-audit-api
winrt-async
socketasynceventargs
datasheet
discussion-board
pex-and-moles
object-tag
hwnd
rollover
system-analysis
dgml
appointment
djangoappengine
jettison

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