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

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
gulp
javafx
stata
process
abc
okhttp3
xss
comments
install
jquery-select2
genexus
vsixmanifest
wowza
github-flavored-markdown
hapijs
scotty
git-branch
mattermost
uipath
jira-zephyr
android-6.0-marshmallow
typeorm
angular-schema-form
directions
ports
repeat
campaign-monitor
android-databinding
kepserverex
ngrok
aura-framework
google-cloud-powershell
evaluation
visio-2010
activesupport
critical-section
cardview
lattice
timefield
key-value-store
qtruby
laterjs
pyshark
web-performance
opendolphin
transbase
random-sample
vanilla-forums
xml-simple
android-networking
mergecursor
chrome-mobile
mri
mathics
xcode5
yosemite
dirname
selenium-grid2
yandex-api
enquire.js
pidgin
class-library
node-mongodb-native
logo-lang
mysql-error-1146
grunt-wiredep
code-complete
raddatepicker
grape-api
ia-32
angularjs-select2
usersettings
google-checkout
qmainwindow
microsoft-speech-platform
urlfetch
nsregularexpression
linear-interpolation
shapado
winrt-async
erlide
sipdroid
xhtmlrenderer
webdb
tracd

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