plyr Questions
3
Solved
I like to write a function using ddply that outputs the summary statistics based on the name of two columns of data.frame mat.
mat is a big data.frame with the name of columns "metric", "length"...
2
Solved
I am trying to write some code which identifies the greatest two values for each row and provides their column number and value.
df = data.frame( car = c (2,1,1,1,0), bus = c (0,2,0,1,0),
walk = ...
6
I am using the mtcars dataset. I want to find the number of records for a particular combination of data. Something very similar to the count(*) group by clause in SQL. ddply() from plyr is working...
6
Solved
I have a simulation that has a huge aggregate and combine step right in the middle. I prototyped this process using plyr's ddply() function which works great for a huge percentage of my needs. But ...
Decrepitude asked 10/9, 2010 at 14:39
4
Solved
I'm looking for something similar to bedtools subtract but with dataframes.
For example, say I have the range as a dataframe here:
Start End Value
0 100 P
And I have another dataframe, which is so...
5
Solved
I wonder whether there is a more straighforward way to calculate a certain type of variables than the approach i normally take....
The example below probably explains it best. I have a dataframe ...
4
Solved
I have a data frame (datadf) with 3 columns, 'x', 'y, and z. Several 'x' values are missing (NA). 'y' and 'z' are non measured variables.
x y z
153 a 1
163 b 1
NA d 1
123 a 2
145 e 2
NA c 2
NA b...
4
Solved
I do know about the basics of combining a list of data frames into one as has been answered before. However, I am interested in smart ways to maintain row names. Suppose I have a list of data frame...
Abbe asked 30/6, 2015 at 13:47
9
Solved
Please consider the following:
I recently 'discovered' the awesome plyr and dplyr packages and use those for analysing patient data that is available to me in a data frame. Such a data frame could...
5
Solved
This question is about a generic mechanism for converting any collection of non-cyclical homogeneous or heterogeneous data structures into a dataframe. This can be particularly useful when dealing ...
Clydeclydebank asked 19/7, 2012 at 3:39
3
Solved
for tidyverse users, dplyr is the new way to work with data.
For users trying to avoid older package plyr, what is the equivalent function to rbind.fill in dplyr?
7
Solved
5
Solved
I have a large data frame in which I am multiplying two columns together to get another column. At first I was running a for-loop, like so:
for(i in 1:nrow(df)){
df$new_column[i] <- df$column1...
8
Solved
I'm going through Machine Learning for Hackers, and I am stuck at this line:
from.weight <- ddply(priority.train, .(From.EMail), summarise, Freq = length(Subject))
Which generates the followi...
3
Solved
I need to use group by in levels with ddply or aggregate if that's easier. I am not really sure how to do this as I need to use cumsum as my aggregate function. This is what my data looks like:
le...
8
Solved
When working with plyr I often found it useful to use adply for scalar functions that I have to apply to each and every row.
e.g.
data(iris)
library(plyr)
head(
adply(iris, 1, transform , Max.Le...
6
Solved
I am having trouble figuring out the most elegant and flexible way to switch data from long format to wide format when I have more than one measure variable I want to bring along.
For example, her...
3
Solved
I have a data frame that looks like this:
Store Temperature Unemployment Sum_Sales
1 1 42.31 8.106 1643691
2 1 38.51 8.106 1641957
3 1 39.93 8.106 1611968
4 1 46.63 8.106 1409728
5 1 46.50 8.106 1...
5
Solved
I'm a fan of the revalue function is plyr for substituting strings. It's simple and easy to remember.
However, I've migrated new code to dplyr which doesn't appear to have a revalue function. What...
3
Solved
I have several R script files, such as f1.R, f2.R, f3.R.
I have another function called AddSignal(signal), which adds a signal vector to a list. Functions in f1.R, f2.R, etc. may call this AddSign...
3
Solved
I have a data frame, say payroll, like:
payroll <- read.table(text="
AgencyName Rate PayBasis Status NumRate
HousingAuthority $26,843.00 Annual Full-Time 26843.00
HousingAuthority $14,970.00 Pr...
4
Solved
I have a dataframe consisting of an ID, that is the same for each element in a group, two datetimes and the time interval between these two. One of the datetime objects is my relevant time marker. ...
2
Solved
Given a list of dataframes l as follows:
l <- list(a = data.frame(a_1 = c(11, 12),
a_2 = c(13, 14)),
b = data.frame(b_1 = c(21, 22),
b_2 = c(23, 24)),
c = data.frame(c_1 = c(31, 32),
...
3
Solved
plyr::mapvalues can be used like this:
mapvalues(mtcars$cyl, c(4, 6, 8), c("a", "b", "c"))
But this doesn't work:
mtcars %>%
dplyr::select(cyl) %>%
mapvalues(c(4, 6, 8), c("a", "b", "c"))...
3
I am trying to figure out why I am getting an error message when using ddply.
Example data:
data<-data.frame(area=rep(c("VA","OC","ES"),each=4),
sex=rep(c("Male","Female"),each=2,times=3),
...
1 Next >
© 2022 - 2024 — McMap. All rights reserved.