To speed up the tapply function in R or another function to convert data frame into a matrix

0 votes
I must turn a sizable dataset into a matrix. The below data "x" is liked by the data structure. Due to the large dataset's memory requirements, the function tapply that I used to accomplish it (see below) is unable to function. If there is a different approach, please let me know. I attempted to do it for the R package dplyr but was unable to. Any ideas on how to do that? Much appreciated.

data.frame(c1=c("A","B","C","A","B","C"), c2=1:6, c3=c("sp1","sp2","sp2","sp3","sp4")) returns the value x.
y = tapply(x$c2, list(x$c1, x$c3), sum).
Jun 24, 2022 in Data Science by Sohail
• 3,040 points
368 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Data Science

0 votes
0 answers

How to manually find the minors of a matrix in R programming?

I have to write a function that ...READ MORE

Jul 5, 2022 in Data Science by avinash
• 1,840 points
473 views
0 votes
0 answers

In R, how to get an object's name after it is sent to a function?

I'm trying to find the opposite of ...READ MORE

Jul 5, 2022 in Data Science by avinash
• 1,840 points
307 views
0 votes
1 answer

How to make loop for one-at-a time logistic regression in R?

You're probably looking for something similar to ...READ MORE

answered Jun 20, 2022 in Data Science by Sohail
• 3,040 points
1,066 views
0 votes
1 answer

How to implement Knn-algorithm without using k-nn function in r?

I created an example that demonstrates the ...READ MORE

answered Jun 24, 2022 in Data Science by Sohail
• 3,040 points
487 views
0 votes
1 answer

Using dcast to widen a data frame

> dcast(z, id ~ item, value.var="freq") ...READ MORE

answered Jun 24, 2022 in Data Science by Sohail
• 3,040 points
468 views
0 votes
1 answer

grepl in R to find matches to any of a list of character strings

Inside of a grepl regular expression, you ...READ MORE

answered Jun 24, 2022 in Data Science by Sohail
• 3,040 points
3,254 views
0 votes
2 answers

How to use group by for multiple columns in dplyr, using string vector input in R?

data = data.frame(   zzz11def = sample(LETTERS[1:3], 100, replace=TRUE),   zbc123qws1 ...READ MORE

answered Aug 6, 2019 in Data Analytics by anonymous
14,120 views
0 votes
1 answer

How to group all columns exculding a single column?

You can either use group_by or group_by_at Using ...READ MORE

answered Apr 12, 2018 in Data Analytics by Sahiti
• 6,370 points
3,570 views
0 votes
1 answer

How to limit output of a dataframe in R?

For randomly sampling a row/cell where a ...READ MORE

answered Apr 18, 2018 in Data Analytics by kappa3010
• 2,090 points
3,451 views
0 votes
1 answer

Using dplyr package to summarise multiple columns - R

'dplyr' package provides 'summarise_all()' function to apply ...READ MORE

answered Jun 6, 2018 in Data Analytics by Bharani
• 4,660 points
2,110 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP