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...
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 <- ...
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...
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...
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...
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...
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...
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[...
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)...
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...
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...
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))...
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...
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...
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...
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 ...
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...
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.