Displaying 20 results from an estimated 39 matches for "llply".
Did you mean:
ldply
2010 Sep 10
0
plyr: version 1.2
...---------------------------------
NEW FEATURES
* l*ply, d*ply, a*ply and m*ply all gain a .parallel argument that when TRUE,
applies functions in parallel using a parallel backend registered with the
foreach package:
x <- seq_len(20)
wait <- function(i) Sys.sleep(0.1)
system.time(llply(x, wait))
# user system elapsed
# 0.007 0.005 2.005
library(doMC)
registerDoMC(2)
system.time(llply(x, wait, .parallel = TRUE))
# user system elapsed
# 0.020 0.011 1.038
This work has been generously supported by BD (Becton Dickinson).
MINOR CHANGES
* a*ply and m*ply...
2010 Sep 10
0
plyr: version 1.2
...---------------------------------
NEW FEATURES
* l*ply, d*ply, a*ply and m*ply all gain a .parallel argument that when TRUE,
applies functions in parallel using a parallel backend registered with the
foreach package:
x <- seq_len(20)
wait <- function(i) Sys.sleep(0.1)
system.time(llply(x, wait))
# user system elapsed
# 0.007 0.005 2.005
library(doMC)
registerDoMC(2)
system.time(llply(x, wait, .parallel = TRUE))
# user system elapsed
# 0.020 0.011 1.038
This work has been generously supported by BD (Becton Dickinson).
MINOR CHANGES
* a*ply and m*ply...
2013 Apr 21
2
how to import several files every day
...ry day of the week from the same
folder.
Let say, on day 1, I have about 100 files in the folder.
By using this code, everything works perfectly (maybe there is a more
efficient way to do it):
filenames <-list.files(path="pathtofile", full.names=TRUE)
library(plyr)
import.list <- llply(filenames, read.table, header=TRUE, sep="",
na.strings="NA", dec=".", strip.white=TRUE)
#
#MERGE and RESHAPE some of the files have different columns
library(reshape)
data3 <- merge_recurse(import.list)
#
At the end of each day I will export the file as a cvs file i...
2009 Sep 25
2
summarize-plyr package
...(plyr)
> data(baseball)
> summarise(baseball,
+ duration = max(year) - min(year),
+ nteams = length(unique(team)))
Error: could not find function "summarise"
> ddply(baseball, "id", summarise,
+ duration = max(year) - min(year),
+ nteams = length(unique(team)))
Error in llply(.data = .data, .fun = .fun, ..., .progress = .progress) :
object "summarise" not found
--------------------------------------------
--
Professor of Family Medicine
Boston University
Tel: 617-414-6221, Fax:617-414-3345
emails: chettyvk@gmail.com,vchetty@bu.edu
[[alternative HTML vers...
2012 Dec 05
4
Import multiple data frames and combine them using "cbind"
Hi group,
I imported 16 data frames using the function "list.files"
temp <- list.files(path="...........")
myfiles = lapply(temp, read.table,sep = "")
Now I have 16 data set imported in R window.
I want to combine them by row and tried some thing like (Here I am
considering only 20 columns)
for(i in 1:16){
data<- cbind(myfiles[[i]][,1:20])
}
but it
2009 Mar 25
2
"[.data.frame" and lapply
...e following behaviour,
> d <- lapply(1:4, function(i) data.frame(x=rnorm(5), y=rnorm(5)))
> str(d)
>
> lapply(d, "[", i= c(1)) # fine, this extracts the first columns
> lapply(d, "[", j= c(1, 3)) # doesn't do nothing ?!
>
> library(plyr)
>
> llply(d, "[", j= c(1, 3)) # same
Am i misinterpreting the meaning of "j", which I thought was an
argument of the method "[.data.frame"?
> args(`[.data.frame`)
> function (x, i, j, drop = if (missing(i)) TRUE else length(cols) ==
> 1)
>
Many thanks,
bap...
2009 Mar 25
2
"[.data.frame" and lapply
...e following behaviour,
> d <- lapply(1:4, function(i) data.frame(x=rnorm(5), y=rnorm(5)))
> str(d)
>
> lapply(d, "[", i= c(1)) # fine, this extracts the first columns
> lapply(d, "[", j= c(1, 3)) # doesn't do nothing ?!
>
> library(plyr)
>
> llply(d, "[", j= c(1, 3)) # same
Am i misinterpreting the meaning of "j", which I thought was an
argument of the method "[.data.frame"?
> args(`[.data.frame`)
> function (x, i, j, drop = if (missing(i)) TRUE else length(cols) ==
> 1)
>
Many thanks,
bap...
2015 Apr 10
3
Loop sobre muchos data frames
...onde bNames es la lista de los df que tengo cargados "qBlog001"
"qBlog002"..."qBlog150"...
algo así es lo que tengo en mente:
for (i in bNames) {
for (j in c_names) {
j<- Corpus(VectorSource(i))
}
}
Pero no funciona, he probado con lapply, con sapply, con llply de la
librería (plyr) y no encuentro la manera de hacerlo..
Cualquier sugerencia sera bienvenida!
Muchas gracias por adelantado!
--
Oscar Benitez
[[alternative HTML version deleted]]
2008 Sep 30
0
New package: plyr
...put to data.frames, matrices and lists
* progress bars to keep track of long running operations
* built-in error recovery
* the choice of passing chunks as rows or as variables
plyr functions are named according to the type of object they input
(first letter) and output (second letter):
* llply = from a list to a list
* alply = from an array (or vector, or matrix) to a list
* ldply = from a list to a data.frame
* d_ply = from a data.frame, ignore output
* and so on for llply, laply, ldply, l_ply, alply, aaply, adply,
a_ply, dlply, daply, dply, d_ply
plyr also provides:
* m*ply...
2008 Sep 30
0
New package: plyr
...put to data.frames, matrices and lists
* progress bars to keep track of long running operations
* built-in error recovery
* the choice of passing chunks as rows or as variables
plyr functions are named according to the type of object they input
(first letter) and output (second letter):
* llply = from a list to a list
* alply = from an array (or vector, or matrix) to a list
* ldply = from a list to a data.frame
* d_ply = from a data.frame, ignore output
* and so on for llply, laply, ldply, l_ply, alply, aaply, adply,
a_ply, dlply, daply, dply, d_ply
plyr also provides:
* m*ply...
2013 Feb 01
0
R code parallelized using plyr and doMC: error message: Error in do.ply(i) : task 1 failed - “could not find function ”getClass“”
...he process of getting Rmpi running. For now, 32 cores should be
(more than) adequate for me. My script is of the sort:
|define a bunch of functions
load the data
call libraries
require(doMC)
require(plyr)
registerDoMC(32)
main.function <- function(data){
*thefunction*
}
results= llply(1:500, function(idx){out<-main.function(data)},.parallel=TRUE)
save(results,file="trestles_results")|
This runs fine on my own machine (setting it to run only a few times and
registering only a couple of cores). But when I run it on the cluster,
the output file shows that it ran e...
2010 May 31
1
Replacing NAs with 0 for a list of data frames
Hi,
I have a list of 100 data frames, each data frame has 50 obs of 377
variables.
I would like to replace all the NAs with 0 in all the dataframes.
Should I have a for loop for every data frame?
Below is an extract of how the data looks like.
List of 100
$ :'data.frame': 50 obs. of 377 variables:
..$ ACHRPO: int [1:50] NA NA NA NA NA NA NA NA NA NA ...
..$ ACTEEX: int [1:50] NA
2011 Jan 17
2
Summing data frame columns on identical data
Dear all,
I have 9 data frames, and I'm simply trying to sum the values of column 3 (on a row-by-row basis). However, there are a slightly different number of rows in each data frame, so I'm receiving the following error: "Error in Ops.data.frame(mrunoff_207101[3], mrunoff_207102[3]) :
? + only defined for equally-sized data frames".
Here is what I'm attempting to do:
2011 Sep 29
3
For loop for subset - repeating same over and over?
Hello, I am using the following script to run an anova for numerous species
in a table that I have:
SiteSpp <-
2011 Jun 27
2
Executing the same function on consecutive files
Hi all,
I have the next problem: I have a matrix with size 8,000,000x18. My personal
computer...blocks...so I have cut my original file into 100 different file.
I have written a function that should be run on each of this file.
So imagine
I need to read data from q1 to q100 file
data<-read.table("q1.txt",sep="")
and each time I read 1 file execute my personal function
2011 Jun 30
1
Italicized greek symbols in PDF plots
...unning Ubuntu 11.04, with R 2.12.1 and ESS+Emacs.
For journal formatting requirements, I need to italicize all the greek
letters in any plot. This is reasonably straight forward to do and I
accomplished this task like so:
library(ggplot2)
label_parseall <- function(variable, value) {
plyr::llply(value, function(x) parse(text = paste(x)))
}
dat <- data.frame(x = runif(270, 0, 125), z = rep(LETTERS[1:3], each = 3),
yy = 1:9, stringsAsFactors = TRUE)
#unicode italicized delta
dat$gltr =
factor(c("italic(\u03b4)^14*N","italic(\u03b4)^15*N","italic(\u03b4)^13*C&quo...
2011 Jan 21
2
Looping with incremented object name and increment function
Folks,
I am trying to get a loop to run which increments the object name as part of
the loop. Here "fit1" "fit2" "fit3" and "fit4" are linear regression models
that I have created.
> for (ii in c(1:4)){
+ SSE[ii]=rbind(anova(fit[ii])$"Sum Sq")
+ dfe[ii]=rbind(summary(fit[ii])$df)
+ }
Error in anova(fit[ii]) : object 'fit' not found
2015 Apr 10
5
Loop sobre muchos data frames
...2"..."qBlog150"...
>>
>> algo así es lo que tengo en mente:
>>
>> for (i in bNames) {
>> for (j in c_names) {
>> j<- Corpus(VectorSource(i))
>> }
>> }
>>
>> Pero no funciona, he probado con lapply, con sapply, con llply de la
>> librería (plyr) y no encuentro la manera de hacerlo..
>> Cualquier sugerencia sera bienvenida!
>> Muchas gracias por adelantado!
>>
>>
>> --
>> Oscar Benitez
>>
>> [[alternative HTML version deleted]]
>>
>> _________...
2011 Oct 14
3
Split a list
I have a list of dataframes i.e. each list element is a dataframe with three columns and differing number of rows. The third column takes on only two values. I wish to split the list into two sublists based on the value of the third column of the list element.
Second issue with lists as well. I would like to reduce each of the sublist based on the range of the second column, i.e. if the range of
2015 Apr 12
2
Loop sobre muchos data frames
...lo que tengo en mente:
>>>>
>>>> for (i in bNames) {
>>>> for (j in c_names) {
>>>> j<- Corpus(VectorSource(i))
>>>> }
>>>> }
>>>>
>>>> Pero no funciona, he probado con lapply, con sapply, con llply de la
>>>> librería (plyr) y no encuentro la manera de hacerlo..
>>>> Cualquier sugerencia sera bienvenida!
>>>> Muchas gracias por adelantado!
>>>>
>>>>
>>>> --
>>>> Oscar Benitez
>>>>
>>>>...