Displaying 20 results from an estimated 300 matches similar to: "why this function does not run correctly?"
2013 Mar 16
1
different size of nodes
hi All,
There is a distributed cluster with 5 bricks:
gl0
Filesystem Size Used Avail Use% Mounted on
/dev/sda4 5.5T 4.1T 1.5T 75% /mnt/brick1
gl1
Filesystem Size Used Avail Use% Mounted on
/dev/sda4 5.5T 4.3T 1.3T 78% /mnt/brick1
gl2
Filesystem Size Used Avail Use% Mounted on
/dev/sda4 5.5T 4.1T 1.4T 76% /mnt/brick1
gl3
Filesystem Size Used
2023 Aug 10
2
orphaned snapshots
I?ve never had such situation and I don?t recall someone sharing something similar.
Most probably it?s easier to remove the node from the TSP and re-add it.Of course , test the case in VMs just to validate that it?s possible to add a mode to a cluster with snapshots.
I have a vague feeling that you will need to delete all snapshots.
Best Regards,Strahil Nikolov?
On Thursday, August 10, 2023, 4:36
2011 Apr 11
1
proposal for adapting code of function gl()
Based on a discussion on SO I ran some tests and found that converting
to a factor is best done early in the process. Hence, I propose to
rewrite the gl() function as :
gl2 <- function(n, k, length = n * k, labels = 1:n, ordered = FALSE){
rep(
rep(
factor(1:n,levels=1:n,labels=labels, ordered=ordered),rep.int(k,n)
),length.out=length
)
}
Some test results :
>
2017 Nov 22
6
assign NA to rows by test on multiple columns of a data frame
Given this data frame (a simplified, essential reproducible example)
A<-c(8,7,10,1,5)
A_flag<-c(10,0,1,0,2)
B<-c(5,6,2,1,0)
B_flag<-c(12,9,0,5,0)
mydf<-data.frame(A, A_flag, B, B_flag)
# this is my initial df
mydf
I want to get to this final situation
i<-which(mydf$A_flag==0)
mydf$A[i]<-NA
ii<-which(mydf$B_flag==0)
mydf$B[ii]<-NA
2017 Nov 09
0
weighted average grouped by variables
Hello
an update about my question: I worked out the following solution (with the package "dplyr")
library(dplyr)
mydf%>%
mutate(speed_vehicles=n_vehicles*mydf$speed) %>%
group_by(date_time,type) %>%
summarise(
sum_n_times_speed=sum(speed_vehicles),
n_vehicles=sum(n_vehicles),
vel=sum(speed_vehicles)/sum(n_vehicles)
)
In fact I was hoping to manage everything in a
2017 Nov 09
4
weighted average grouped by variables
hi all
I have this dataframe (created as a reproducible example)
mydf<-structure(list(date_time = structure(c(1508238000, 1508238000, 1508238000, 1508238000, 1508238000, 1508238000, 1508238000), class = c("POSIXct", "POSIXt"), tzone = ""),
direction = structure(c(1L, 1L, 1L, 1L, 2L, 2L, 2L), .Label = c("A", "B"), class =
2011 Mar 22
3
Urgent query about R!
Hi there,
I am currently working on a R programming project and got stuck.
I am supposed to generate a set of possibilities of 1296 different
combinations of 4 numbers, ie. 1111, 1234, 2361, (only contain 1 to 6) in a
matrix form
here is what I got which has not been working as it keeps coming out with
the same number on the row..
The code:
gl1<- gl(1296,1,length=1296, labels=1:1296,
2017 Nov 23
1
assign NA to rows by test on multiple columns of a data frame
yes, it works, even if I do not really get how and why it's working the combination of logical results (could you provide some insights for that?)
moreover, and most of all, I was hoping for a compact solution because I need to deal with MANY columns (more than 40) in data frame with the same basic structure as the simplified example I posted
thanks
m
----- Messaggio originale -----
Da:
2017 Nov 22
0
assign NA to rows by test on multiple columns of a data frame
Hello,
Try the following.
icol <- which(grepl("flag", names(mydf)))
mydf[icol] <- lapply(mydf[icol], function(x){
is.na(x) <- x == 0
x
})
mydf
# A A_flag B B_flag
#1 8 10 5 12
#2 7 NA 6 9
#3 10 1 2 NA
#4 1 NA 1 5
#5 5 2 0 NA
Hope this helps,
Rui Barradas
On 11/22/2017 10:34 AM, Massimo Bressan
2017 Nov 22
1
assign NA to rows by test on multiple columns of a data frame
...well, I don't think this is exactly the expected result (see my post)
to be noted that the columns affected should be "A" and "B"
thanks for the help
max
----- Messaggio originale -----
Da: "Rui Barradas" <ruipbarradas at sapo.pt>
A: "Massimo Bressan" <massimo.bressan at arpa.veneto.it>, "r-help" <r-help at
2017 Nov 09
1
weighted average grouped by variables
Dear Massimo,
It seems straightforward to use weighted.mean() in a dplyr context
library(dplyr)
mydf %>%
group_by(date_time, type) %>%
summarise(vel = weighted.mean(speed, n_vehicles))
Best regards,
ir. Thierry Onkelinx
Statisticus / Statistician
Vlaamse Overheid / Government of Flanders
INSTITUUT VOOR NATUUR- EN BOSONDERZOEK / RESEARCH INSTITUTE FOR NATURE AND
FOREST
Team
2017 Nov 22
0
assign NA to rows by test on multiple columns of a data frame
Do you mean like this:
mydf <- within(mydf, {
is.na(A)<- !A_flag
is.na(B)<- !B_flag
}
)
> mydf
A A_flag B B_flag
1 8 10 5 12
2 NA 0 6 9
3 10 1 NA 0
4 NA 0 1 5
5 5 2 NA 0
Cheers,
Bert
Bert Gunter
"The trouble with having an open mind is that people keep coming along and
sticking things into
2011 Nov 11
6
need help
hello all R experts,
how do I calculate the reliability between the two groups
using the ICCs?
I'll appreciate your reply,
Thanks
Sincerely,
Supreet kaur,
Biomedical research engineer,
Nationwide Childrens Hospital,
Columbus, OH
(614)355-3509
[[alternative HTML version deleted]]
2017 Nov 09
2
weighted average grouped by variables
Hi
Thanks for working example.
you could use split/ lapply approach, however it is probably not much better than dplyr method.
sapply(split(mydf, mydf$type), function(speed, n_vehicles) sum(mydf$speed*mydf$n_vehicles)/sum(mydf$n_vehicles))
gives you averages
aggregate(mydf$n_vehicles, list(mydf$type), sum)$x
gives you sums
Cheers
Petr
> -----Original Message-----
> From: R-help
2008 May 02
1
Error in downViewport.vpPath(vpPathDirect(name)
Hi,
I am having trouble plotting a series of dendrograms using lattice and grid
code as found in Paul Murrells book R Graphics.
This is the error message I recieve:
Error in downViewport.vpPath(vpPathDirect(name), strict, recording =
recording) :
Viewport 'plot1.panel.1.1.off.vp' was not found
I have attached the code and also my data file. Should anyone have any
suggestions then
2017 Nov 09
1
weighted average grouped by variables
Hello,
Using base R only, the following seems to do what you want.
with(mydf, ave(speed, date_time, type, FUN = weighted.mean, w = n_vehicles))
Hope this helps,
Rui Barradas
Em 09-11-2017 13:16, Massimo Bressan escreveu:
> Hello
>
> an update about my question: I worked out the following solution (with the package "dplyr")
>
> library(dplyr)
>
> mydf%>%
>
2017 Jul 17
1
Gluster set brick online and start sync.
Hello everybody,
Please, help to fix me a problem.
I have a distributed-replicated volume between two servers. On each
server I have 2 RAID-10 arrays, that replicated between servers.
Brick gl1:/mnt/brick1/gm0 49153 0 Y
13910
Brick gl0:/mnt/brick0/gm0 N/A N/A N
N/A
Brick gl0:/mnt/brick1/gm0 N/A
2017 Nov 11
0
weighted average grouped by variables
> On 9 Nov 2017, at 14:58, PIKAL Petr <petr.pikal at precheza.cz> wrote:
>
> Hi
>
> Thanks for working example.
>
> you could use split/ lapply approach, however it is probably not much better than dplyr method.
>
> sapply(split(mydf, mydf$type), function(speed, n_vehicles) sum(mydf$speed*mydf$n_vehicles)/sum(mydf$n_vehicles))
> gives you averages
>
The
2017 Nov 22
0
assign NA to rows by test on multiple columns of a data frame
Hi *Massimo,*
*Try this.*
*a <- mydf==0mydf[a] <- NAHTHEK*
On Wed, Nov 22, 2017 at 5:34 AM, Massimo Bressan <
massimo.bressan at arpa.veneto.it> wrote:
>
>
> Given this data frame (a simplified, essential reproducible example)
>
>
>
>
> A<-c(8,7,10,1,5)
>
> A_flag<-c(10,0,1,0,2)
>
> B<-c(5,6,2,1,0)
>
> B_flag<-c(12,9,0,5,0)
>
2017 Aug 09
1
Gluster performance with VM's
Hi, community
Please, help me with my trouble.
I have 2 Gluster nodes, with 2 bricks on each.
Configuration:
Node1 brick1 replicated on Node0 brick0
Node0 brick1 replicated on Node1 brick0
Volume Name: gm0
Type: Distributed-Replicate
Volume ID: 5e55f511-8a50-46e4-aa2f-5d4f73c859cf
Status: Started
Snapshot Count: 0
Number of Bricks: 2 x 2 = 4
Transport-type: tcp
Bricks:
Brick1: