plyr Questions

2

Solved

I'm trying to calculate the time difference between two timestamps in two adjacent rows using the dplyr package. Here's the code: tidy_ex <- function () { library(dplyr) #construct example...
Lethargic asked 11/9, 2014 at 13:28

1

I have a data frame with different IDs and I want to make a subgroup in which: for each ID I will only obtain one row with the closest value to 0.5 in variable Y. This is my data frame: df <- ...
Afraid asked 5/1, 2017 at 23:4

2

Solved

Recently, I have created an object factor=1 in my workspace, not knowing that there is a function factor in the base package. What I intended to do was to use the variable factor within a parallel...
Natica asked 24/7, 2013 at 16:48

4

Solved

I am trying to get the top 'n' companies from a data frame.Here is my code below. data("Forbes2000", package = "HSAUR") sort(Forbes2000$profits,decreasing=TRUE) Now I would like to get the top 5...
Remanence asked 29/8, 2012 at 23:27

2

Solved

Can somebody explain to me why the two following instructions have different outputs: library(plyr) library(dplyr) ll <- list(a = mtcars, b = mtcars) # using '.' as a function parameter llply(l...
Felten asked 24/10, 2016 at 11:38

2

Solved

I have a datatable with many rows and I would like to conditionally group two columns, namely Begin and End. These columns stand for a certain month in which the associated person was doing somethi...
Romilda asked 21/9, 2016 at 21:21

1

I would like to speed up this code in R. The input is an array 3x3x3 containing integer number and based on the neighbors, if they are zero, replace them for the respective number. The output is ...
Yankeeism asked 23/6, 2016 at 20:15

3

Solved

I'm trying to aggregate two data frames (df1 and df2). The first contains 3 variables: ID, Date1 and Date2. df1 ID Date1 Date2 1 2016-03-01 2016-04-01 1 2016-04-01 2016-05-01 2 2016-03-14 201...
Reek asked 29/3, 2016 at 12:22

7

Solved

My data frame has two columns that are used as a grouping key, 17 columns that need to be summed in each group, and one column that should be averaged instead. Let me illustrate this on a different...
Kangaroo asked 13/11, 2015 at 22:0

2

Solved

I am having trouble with my workflow because I am sourcing multiple scripts in rmarkdown, some of which require the package dplyr and some of which use plyr. The problem is that the rename functi...
Prague asked 6/6, 2016 at 23:57

2

Solved

I use ddply quite a bit but I do not consider myself an expert. I have a data frame (df) with grouping variable "Group" which has values of "A", "B" and "C" and the variable to summarize, "Var" has...
Ichthyosis asked 29/1, 2014 at 2:43

1

I am trying to apply the dplyr package and calculate the number of entries for each card number in a dataset with the following function: freq<- function(data){ data <- complete.dupremoved[...
Symploce asked 23/12, 2015 at 20:42

5

I am unable to install ggplot2 in R 3.0.2 on Ubuntu. When I run install.packages('ggplot2',dependencies = TRUE) I get the following error. > install.packages('ggplot2',dependencies = TRUE)...
Paleontology asked 4/6, 2015 at 6:39

1

Solved

When I'm using plyr and dplyr to analyze a big dataset that is grouped by an id, I sometimes get an error in my function. I can use browser() or debugger() to explore what's going on, but one issue...
Hawkbill asked 13/1, 2016 at 16:59

3

Solved

I know that there are many answers provided in this forum on how to get summary statistics (e.g. mean, se, N) for multiple groups using options like aggregate , ddply or data.table. I'm not sure, h...
Impressment asked 11/1, 2016 at 14:6

1

Solved

I updated to the newest version of ggplot2 and run into problems by printing subsets in a layer. library(ggplot2) library(plyr) df <- data.frame(x=runif(100), y=runif(100)) ggplot(df, aes(x,y))...
Auric asked 4/1, 2016 at 9:40

2

Solved

How can I add text to points rendered with geom_jittered to label them? geom_text will not work because I don't know the coordinates of the jittered dots. Could you capture the position of the jitt...
Core asked 1/7, 2011 at 17:16

2

Solved

Given this data.frame: set.seed(4) df <- data.frame(x = rep(1:5, each = 2), y = sample(50:100, 10, T)) # x y # 1 1 78 # 2 1 53 # 3 2 93 # 4 2 96 # 5 3 61 # 6 3 82 # 7 4 53 # 8 4 76 # 9 5 91 # 1...
Wilfredowilfrid asked 24/11, 2015 at 13:57

3

Solved

I've been using plyr-based function summarySE and ddply for several months without any problem. Today when I ran my extremely basic routine in R some error message showed up and made R crash. Here...
Griffis asked 10/3, 2015 at 14:47

3

Solved

How can I get a data frame's name from a list? Sure, get() gets the object itself, but I want to have its name for use within another function. Here's the use case, in case you would rather suggest...
Godden asked 25/1, 2012 at 11:50

3

Solved

I have a sample dataframe that I am working with ID <- c("A","A","A","A","A","A","A","A","A","A","A","A","B","B","B","B","B","B","B","B","B","B") TARG_AVG <- c(2.1,2.1,2.1,2.1,2.1,2.1,2.3,2...
Sheila asked 7/10, 2015 at 23:8

3

Solved

I'd like to be able to send in a column name to a call that I am making to ddply. An example ddply call: ddply(myData, .(MyGrouping), summarise, count=sum(myColumnName)) If I have ddply wrapped ...
Peluso asked 16/4, 2012 at 16:43

4

Solved

I would like to split my data frame using a couple of columns and call let's say fivenum on each group. aggregate(Petal.Width ~ Species, iris, function(x) summary(fivenum(x))) The returned value...
Auric asked 7/2, 2013 at 18:42

2

Solved

I have a dataset whose headers look like so: PID Time Site Rep Count I want sum the Count by Rep for each PID x Time x Site combo on the resulting data.frame, I want to get the mean value of Co...
Forgave asked 11/10, 2011 at 7:9

4

Solved

I have the following, somewhat large dataset: > dim(dset) [1] 422105 25 > class(dset) [1] "data.frame" > Without doing anything, the R process seems to take about 1GB of RAM. I ...
Fancyfree asked 10/12, 2011 at 2:47

© 2022 - 2024 — McMap. All rights reserved.