Displaying 20 results from an estimated 300 matches similar to: "Barplot for degree distribution"
2011 Mar 03
2
Plotting Mean in plotting degree distribution
Hi,
I am plotting degree distribution of a graph using the function,
library(igraph)
dd1 = degree.distribution(G)
plot(dd1, xlab = "degree", ylab="frequency")
I would like to plot the mean of the distribution as a vertical line in the
attached plot.
Please let me know how to do this.
Thanks,
Kumar http://r.789695.n4.nabble.com/file/n3334375/cdata3_dd.png
cdata3_dd.png
--
2011 Nov 15
5
Convert back to lower triangular matrix
Given a vector;> ab = seq(0.5,1, by=0.1)> ab[1] 0.5 0.6 0.7 0.8 0.9 1.0
The euclidean distance between the vector elements is given by the lower triangular matrix > dd1 = dist(ab,"euclidean")> dd1 1 2 3 4 52 0.1 3 0.2 0.1 4 0.3 0.2 0.1 5 0.4 0.3 0.2 0.1 6 0.5 0.4 0.3 0.2 0.1
Convert the lower triangular matrix to a full
2013 Jan 18
1
Object created within a function disappears after the function is run
Dear R-helpers,
I have run the code below which I expected to make an object called dd1,
but that object does not exist.
So, in summary, my problem is that my function is meant to make an object
(dd1), and it does indeed make that object (I know that the last line of
the function prints it out) but then, after the function has run, the
object has disappeared.
It's late on a Friday so I may
2014 Jul 21
2
Inserción de condicionales en pequeño código
Buenas tardes,
He construido la función “myfun” al objeto de considerar aquellas
persones que a partir de una determinada fecha de Apertura tienen como mínimo 65 años. Se tiene su fecha de
nacimiento, su fecha de inicio en la institución y su fecha de salida de la
misma. Doy vueltas al script y no acabo se saber cómo poder aplicar de un modo
eficiente las instrucciones “if” ó bien “ifelse”, y me
2012 Aug 06
1
more efficient way to parallel
Dear All,
Suppose I have a program as below: Outside is a loop for simulation (with
random generated data), inside there are several sapply()'s (10~100) over
the data and something else, but these sapply's have to be sequential. And
each sapply do not involve very intensive calculation (a few seconds only).
So the outside loop takes minutes to finish one iteration.
I guess the better way
2003 Dec 04
4
bug in as.POSIXct ?
I think that there is a bug in the as.POSIXct function on Windows.
Here is what I get on Win2000, Pentium III machine in R 1.8.1.
> dd1 <- ISOdatetime(2003, 10, 26, 0, 59, 59)
> dd2 <- ISOdatetime(2003, 10, 26, 1, 0, 0)
> dd2 - dd1
Time difference of 1.000278 hours
Now, the 26th of October was the day that change to the standard time
occurred, so I suspect that this has
2010 Aug 16
1
data frame handling
Dear all,
I have an xts object , t.xts with 4 columns: "v1" "DD1" "v2" "DD2" and
created a data frame :
t <- as.data.frame(t.xts)
I would like to extract data and create a new data frame for when the values
in column DD1 falls between 0 and 30 and extract the corresponding v1 value.
How can I do this?
Thanks.
--
View this message in context:
2008 Apr 14
3
Doing the right amount of copy for large data frames.
Hi there,
Problem ::
When one tries to change one or some of the columns of a data.frame, R makes
a copy of the whole data.frame using the '*tmp*' mechanism (this does not
happen for components of a list, tracemem( ) on R-2.6.2 says so).
Suggested solution ::
Store the columns of the data.frame as a list inside of an environment slot
of an S4 class, and define the '[',
2011 Nov 15
1
Convert full matrix back to lower triangular matrix
Given a vector;> ab = seq(0.5,1, by=0.1)> ab[1] 0.5 0.6 0.7 0.8 0.9 1.0
The euclidean distance between the vector elements is given by the lower triangular matrix > dd1 =
dist(ab,"euclidean")> dd1 1 2 3 4 52 0.1 3 0.2 0.1 4 0.3 0.2 0.1 5 0.4 0.3 0.2 0.1 6 0.5 0.4 0.3 0.2 0.1
Convert the lower triangular matrix to a full
2007 Jun 28
3
Function call within a function.
I am trying to call a funtion within another function
and I clearly am misunderstanding what I should do.
Below is a simple example.
I know lstfun works on its own but I cannot seem to
figure out how to get it to work within ukn. Basically
I need to create the variable "nts". I have probably
missed something simple in the Intro or FAQ.
Any help would be much appreciated.
EXAMPLE
2012 Jul 07
11
Splitting a character vector.
I am lousy at simple regex and I have not found a solution to a simple problem.
I have a vector with some character values that I want to split.
Sample data
dd1 <- c( "XXY (mat harry)","XXY (jim bob)", "CAMP (joe blow)", "ALP (max jack)")
Desired result
dd2 <- data.frame( xx = c("XXY", "XXY", "CAMP",
2011 Mar 22
1
Characteristic Path length calculation
Hi,
I wish to calculate the characteristic path length of a graph.
Is average.path.length(g) in 'igraph' the same as calculating the
characteristic path length of the graph?
Thanks,
Kumar
--
View this message in context: http://r.789695.n4.nabble.com/Characteristic-Path-length-calculation-tp3398048p3398048.html
Sent from the R help mailing list archive at Nabble.com.
2011 Jan 28
1
Please help -- Converting a 2D matrix to 3 columns for graphical representation
Hi,
I am trying to convert a 2D correlation matrix to 3 columns for graphical
representation:
rdata = replicate(100, rnorm(15)) #construct a 2D matrix
c1 = cor(rdata) #outputs a correlation matrix
Now I want to convert the 2D c1 to
(row#, col#, correlation)
1 1 cor1
1 2 cor2
1 3 cor3
...
2 1 cor..
Is there a way to do this?
The main reason I am doing this is to find a correlation based graph
2011 Feb 14
1
Selecting particular rows in a table
Hi,
I have a huge table with 134,000 entries. I want to choose only rows 60,000
to 90,000.
Please help me on how to do this.
V1 V2 V3 V4
1 31.10267 168.3204 41 0.4
2 31.19941 168.1488 41 0.4
3 31.29580 167.9764 41 0.4
4 31.39183 167.8034 41 0.4
5 31.48750 167.6297 41 0.4
6 31.58280 167.4553 41 0.4
7 31.67774 167.2803 41 0.4
8 31.77229 167.1045 41 0.4
9 31.86648 166.9281
2011 Apr 11
1
plot - kamada.kawai layout without arrows
Hi,
I am plotting a graph with kamada.kawai layout.
But I am getting direction arrows in the graphs.
Please let me know how to avoid this.
g <- watts.strogatz.game(1, 2000, 5, 0.4)
comps <- clusters(g)$membership
colbar <- rainbow(max(comps)+1)
V(g)$color <- colbar[comps+1]
png(filename)
plot(g, layout=layout.kamada.kawai, vertex.size=2, vertex.label=NA)
dev.off()
Please find
2023 Jul 08
1
Getting an error calling MASS::boxcox in a function
No, I'm afraid I'm wrong. Something went wrong with my R session and gave
me incorrect answers. After restarting, I continued to get the same error
as you did with my supposed "fix." So just ignore what I said and sorry for
the noise.
-- Bert
On Sat, Jul 8, 2023 at 8:28?AM Bert Gunter <bgunter.4567 at gmail.com> wrote:
> Try this for your function:
>
>
2018 Oct 05
2
Seg fault stats::runmed
Dear all,
I just found this issue:
dd1 = c(rep(NaN,82), rep(-1, 144), rep(1, 74))
xx = runmed(dd1, 21)
-> R crashes reproducibly in R 3.4.3, R3.4.4 (Ubuntu 14.04/Ubuntu 16.04)
With GDB:
Program received signal SIGSEGV, Segmentation fault.
swap (l=53, r=86, window=window at entry=0xc59308,
outlist=outlist at entry=0x12ea2e8, nrlist=nrlist at entry=0x114fdd8,
print_level=print_level at
2006 Aug 24
1
Using a 'for' loop : there should be a better way in R
I need to apply a yearly inflation factor to some
wages and supply some simple sums by work category. I
have gone at it with a brute force "for" loop approach
which seems okay as it is a small dataset. It looks
a bit inelegant and given all the warnings in the
Intro to R, etc, about using loops I wondered if
anyone could suggest something a bit simpler or more
efficent?
Example:
2023 Jul 08
1
Getting an error calling MASS::boxcox in a function
Dear Ron and Bert,
First (and without considering why one would want to do this, e.g.,
adding a start of 1 to the data), the following works for me:
------ snip ------
> library(MASS)
> BoxCoxLambda <- function(z){
+ b <- boxcox(z + 1 ~ 1,
+ lambda = seq(-5, 5, length.out = 101),
+ plotit = FALSE)
+ b$x[which.max(b$y)]
+ }
> mrow <- 500
2023 Jul 08
1
Getting an error calling MASS::boxcox in a function
Hi,
Firstly, apologies as I have posted this on community.rstudio.com too.
I want to optimise a Box-Cox transformation on columns of a matrix (ie, a unique lambda for each column). So I wrote a function that includes the call to MASS::boxcox in order that it can be applied to each column easily. Except that I'm getting an error when calling the function. If I just extract a column of the