Displaying 20 results from an estimated 1000 matches similar to: "assigning vector or matrix sparsely (for use with mclapply)"
2024 Nov 27
1
R Processing dataframe by group - equivalent to SAS by group processing with a first. and retain statments
On 11/27/24 08:30, Sorkin, John wrote:
> I am an old, long time SAS programmer. I need to produce R code that processes a dataframe in a manner that is equivalent to that produced by using a by statement in SAS and an if first.day statement and a retain statement:
>
> I want to take data (olddata) that looks like this
> ID Day
> 1 1
> 1 1
> 1 2
> 1 2
> 1 3
> 1 3
>
2012 Apr 29
1
CForest Error Logical Subscript Too Long
Hi,
This is my code (my data is attached):
library(languageR)
library(rms)
library(party)
OLDDATA <- read.csv("/Users/Abigail/Documents/OldData250412.csv")
OLDDATA$YD <- factor(OLDDATA$YD, label=c("Yes", "No"))?
OLDDATA$ND <- factor(OLDDATA$ND, label=c("Yes", "No"))?
attach(OLDDATA)
defaults <- cbind(YD, ND)
set.seed(47)
data.controls
2024 Nov 27
1
R Processing dataframe by group - equivalent to SAS by group processing with a first. and retain statments
?s 16:30 de 27/11/2024, Sorkin, John escreveu:
> I am an old, long time SAS programmer. I need to produce R code that processes a dataframe in a manner that is equivalent to that produced by using a by statement in SAS and an if first.day statement and a retain statement:
>
> I want to take data (olddata) that looks like this
> ID Day
> 1 1
> 1 1
> 1 2
> 1 2
> 1 3
>
2024 Dec 01
2
Identify first row of each ID within a data frame, create a variable first =1 for the first row and first=0 of all other rows
Rui:
"f these two, diff is faster. But of all the solutions posted so far,
Ben Bolker's is the fastest."
But the explicit version of diff is still considerably faster:
> D <- c(rep(1,10),rep(2,6),rep(3,2))
> microbenchmark(c(1L,diff(D)), times = 1000L)
Unit: microseconds
expr min lq mean median uq max neval
c(1L, diff(D)) 3.075 3.198 3.34396
2024 Nov 27
1
R Processing dataframe by group - equivalent to SAS by group processing with a first. and retain statments
Was wondering when this would be suggested. But the question was about getting the final dataframe...
newdta <- olddta
newdta$FirstDay <- ave(newdata$date, newdata$ID, FUN = \(x) x[1L])
On November 27, 2024 11:13:49 AM PST, Rui Barradas <ruipbarradas at sapo.pt> wrote:
>?s 16:30 de 27/11/2024, Sorkin, John escreveu:
>> I am an old, long time SAS programmer. I need to
2024 Dec 01
6
Identify first row of each ID within a data frame, create a variable first =1 for the first row and first=0 of all other rows
Dear R help folks,
First my apologizes for sending several related questions to the list server. I am trying to learn how to manipulate data in R . . . and am having difficulty getting my program to work. I greatly appreciate the help and support list member give!
I am trying to write a program that will run through a data frame organized by ID and for the first line of each new group of data
2024 Nov 27
7
R Processing dataframe by group - equivalent to SAS by group processing with a first. and retain statments
I am an old, long time SAS programmer. I need to produce R code that processes a dataframe in a manner that is equivalent to that produced by using a by statement in SAS and an if first.day statement and a retain statement:
I want to take data (olddata) that looks like this
ID Day
1 1
1 1
1 2
1 2
1 3
1 3
1 4
1 4
1 5
1 5
2 5
2 5
2 5
2 6
2 6
2 6
3 10
3 10
and make it look like this:
(withing each
2024 Nov 27
4
R Processing dataframe by group - equivalent to SAS by group processing with a first. and retain statments
Check out the dplyr package, specifically the mutate function.
# Create new column based on existing column value
df <- df %>% mutate(FirstDay = if(ID = 2, 5))
df
Repeat as needed to capture all of the day/firstday combinations you want to account for.
Like everything else in R, there are probably at least a dozen other ways to do this, between base R and all of the library packages
2017 Jun 09
2
Extremely slow du
Hi
I have just moved our 400 TB HPC storage from lustre to gluster. It is part
of a research institute and users have very small files to big files ( few
KB to 20GB) . Our setup consists of 5 servers, each with 96TB RAID 6 disks.
All servers are connected through 10G ethernet but not all clients.
Gluster volumes are distributed without any replication. There are
approximately 80 million files in
2001 Dec 07
2
question
Isn't anything in a data frame that is not explicitly numeric a *factor*?
-Greg
> -----Original Message-----
> From: Peter Dalgaard BSA [mailto:p.dalgaard@biostat.ku.dk]
> Sent: Friday, December 07, 2001 5:32 PM
> To: Erich Neuwirth
> Cc: r-devel@stat.math.ethz.ch
> Subject: Re: [Rd] question
>
>
> Erich Neuwirth
2017 Jun 09
0
Extremely slow du
Can you please provide more details about your volume configuration and the
version of gluster that you are using?
Regards,
Vijay
On Fri, Jun 9, 2017 at 5:35 PM, mohammad kashif <kashif.alig at gmail.com>
wrote:
> Hi
>
> I have just moved our 400 TB HPC storage from lustre to gluster. It is
> part of a research institute and users have very small files to big files
> ( few
2017 Jun 09
2
Extremely slow du
Hi Vijay
Thanks for your quick response. I am using gluster 3.8.11 on Centos 7
servers
glusterfs-3.8.11-1.el7.x86_64
clients are centos 6 but I tested with a centos 7 client as well and
results didn't change
gluster volume info Volume Name: atlasglust
Type: Distribute
Volume ID: fbf0ebb8-deab-4388-9d8a-f722618a624b
Status: Started
Snapshot Count: 0
Number of Bricks: 5
Transport-type: tcp
2007 Oct 16
1
underdetermined system
Hi, sorry, I'm an idiot.. and I know I'm missing something stupid..
I thought if we solve an underdetermine system with QR, my soln is:
min ||x|| (L2 sense) such that Ax = b
then say i have:
> w <- matrix(c(1, 5), ncol=2)
> sw = 2
> qrW = qr(t(w) %*% w)
> qr.coef(qrW, t(w) %*% sw)
[,1]
[1,] 2
[2,] NA
but we also have soln (0, 2/5) which obviously has a
2014 Aug 13
1
adjust SOA record
Hi,
We have outdated SOA information in our samba DNS. We used to have a
DC1, and it is no more, however it's listed in our SOA records on both
remaining DC's. I think this is not correct.
I am under the impression that in order to get full failover support,
all DC's need to have listed themselves as SOA. This is also what google
tells me:
2017 Jun 12
2
Extremely slow du
Hi Vijay
I have enabled client profiling and used this script
https://github.com/bengland2/gluster-profile-analysis/blob/master/gvp-client.sh
to extract data. I am attaching output files. I don't have any reference
data to compare with my output. Hopefully you can make some sense out of
it.
On Sat, Jun 10, 2017 at 10:47 AM, Vijay Bellur <vbellur at redhat.com> wrote:
> Would it be
2012 Dec 11
1
Bug in mclapply?
I've been using mclapply and have encountered situations where it gives
errors or returns incorrect results. Here's a minimal example, which gives
the error on R 2.15.2 on Mac and Linux:
library(parallel)
f <- function(x) NULL
mclapply(1, f, mc.preschedule = FALSE, mc.cores = 1)
# Error in sum(sapply(res, inherits, "try-error")) :
# invalid 'type' (list) of argument
2011 Nov 11
0
mc.cores and computer settings on osx and linux
for the googleable r-help archives, I thought I would post what I
wrote into my .Rprofile to automatically set some system information.
the most relevant aspect is the determination of mc.cores. this is
useful when users want to use the parallel package
options(uname= system("uname", intern=TRUE))
options(os= if (getOption("uname")=="Darwin") "osx"
2017 Jun 10
0
Extremely slow du
Would it be possible for you to turn on client profiling and then run du?
Instructions for turning on client profiling can be found at [1]. Providing
the client profile information can help us figure out where the latency
could be stemming from.
Regards,
Vijay
[1]
https://gluster.readthedocs.io/en/latest/Administrator%20Guide/Performance%20Testing/#client-side-profiling
On Fri, Jun 9, 2017 at
2011 Oct 22
0
simplified multicore by() function
dear R readers---I thought I would post the following snippet of R
code that makes by() like operations easier and faster on multicore
machines for R novices and amateurs. I hope it helps some. YMMV.
feel free to ignore.
PS: I wish R had a POD-like documentation system for end users that
are not writing full libraries. because it does not, I did not
provide documentation ala '?mc.by'.
2023 May 16
1
mclapply enters into an infinite loop....
Dear members,
I am using arfima in an mclapply construction (from the parallel package):
Browse[2]> LYG <- mclapply(LYGH, FUN = arfima, mc.cores = detectCores())
^C
Browse[2]> LYG <- mclapply(LYGH[1:10], FUN = arfima, mc.cores = detectCores())
^C
Browse[2]> LYG <- mclapply(LYGH[1:2], FUN = arfima, mc.cores = detectCores())
^C
You can see that I am