Back

Explore Courses Blog Tutorials Interview Questions
0 votes
3 views
in Data Science by (50.2k points)

I'm running into difficulties reshaping a large dataframe. And I've been relatively fortunate in avoiding reshaping problems in the past, which also means I'm terrible at it.

My current dataframe looks something like this:

My current dataframe looks something like this:

image

And I'd like:

image

I've looked into the reshape package, but I'm not sure how I can convert the treatment factors into individual column names.

Thanks!

Edit: I tried running this on my local machine (4GB dual-core iMac 3.06Ghz) and it keeps failing with:

> d.tmp.2 <- cast(d.tmp, `SEQ_ID` + `GENE_INFO` ~ treatments)

Aggregation requires fun.aggregate: length used as default

R(5751) malloc: *** mmap(size=647168) failed (error code=12)

*** error: can't allocate region

*** set a breakpoint in malloc_error_break to debug

I'll try running this on one of our bigger machines when I get a chance.

1 Answer

0 votes
by (108k points)

Although many significant data processing methods exist in R, they have been a bit convoluted to date and have lacked uniform coding and the ability to easily flow together. This points to difficult-to-read nested functions and/or choppy code. R Studio is encouraging a lot of new packages to collate data management tasks and better integrate them with other analysis activities. You can refer the following link for more information regarding the same:

https://www.statmethods.net/management/reshape.html

Browse Categories

...