aggregate-functions


R: transposing and aggregating columns


I have this dataframe with v1 as names of categories and v2 as items.
I need to aggregate v1 so fruit will appear only once, and all items in v2 will be transposed and placed in together in a single cell separated by comma.
Any assistance will be appreciated :)
You can easily do it using transpose in aggregate function.
dt<-aggregate(v2~v1,data=dt,fun=t)
However you will have some unwanted text in the rolled up string which you can easily removed using gsub function
dt$v2<-gsub("[c()]","",dt$v2))

Related Links

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?
marklogic need advise for approach to aggregate documents

Categories

HOME
asterisk
qlikview
azure-documentdb
stata
pyspark
mysqli
liquibase
azure-database-mysql
okhttp3
squeak
artifactory
perl6
browser-cache
yuv
collision-detection
rmarkdown
samsung-gear-s2
sahi
guidewire
hdf5
github-flavored-markdown
appsettings
game-engine
facebook-marketing-api
amazon-data-pipeline
react-jsx
datasource
monad-transformers
connection-pooling
gsuite
datastax-enterprise
inspec
windows-mobile
android-6.0-marshmallow
proof-general
angular-schema-form
dynamics-ax-2012-r3
pypy
edsdk
matlab-compiler
aweber
repeat
text-extraction
django-cors-headers
stream-socket-client
audio-fingerprinting
vertex
enet
seyren
dmalloc
totalview
iban
cedar-bdd
mac-app-store
scriptengine
hoare-logic
jde
dcast
fadein
google-finance-api
dynamics-nav
om
tinymce-plugins
valdr-bean-validation
ultraedit
random-access
clearcanvas
oxygenxml
atg-dynamo
xpand
farpoint-spread
mongoid4
db2-connect
node-amqp
mosix
symbian3
select2-rails
ncml
quit
correctness
derived-class
hypertable
aspmenu-control
django-admin-tools
pinchzoom
ruby-1.9
pex-and-moles
recess
zipstream
for-xml
uccapi
appointment
ihtmldocument2
authkit
office-2003

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