Displaying 20 results from an estimated 2000 matches similar to: "factor manipulation: edgelist to a matrix?"
2007 Jun 18
3
String manipulation, insert delim
Hello All,
I've been using R for two years now and I am happy to say this is the
first time I could not find the answer to my problem in the R-help
archives. Here is the pending problem:
I want to be able to insert delimiters, say commas, into a string of
characters at uneven intervals such that:
foo<-c("haveaniceday")#my string of character
bar<-c(4,1,4,3) # my vector of
2008 Dec 16
8
sliding window over a large vector
Hi all,
I have a very large binary vector, I wish to calculate the number of
1's over sliding windows.
this is my very slow function
slide<-function(seq,window){
n<-length(seq)-window
tot<-c()
tot[1]<-sum(seq[1:window])
for (i in 2:n) {
tot[i]<- tot[i-1]-seq[i-1]+seq[i]
}
return(tot)
}
this works well for for reasonably sized vectors. Does
2008 Dec 24
2
Using 'cat' on data frame
Dear all,
I have the following data frame:
> raw.count
Var1
Freq
1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 707
2 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAC 14
3 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAT 3
But why when printint it using 'cat', it doesn't print
the desired string "AAA" ?
> cat(raw.count$Var1,
2008 Dec 24
1
selecting a subset of a matrix based on a value occurring in 5 records
Hello,
>I am hoping for some advice as to how I might create a subset of a
>matrix. The matrix is 176 x 3530. The rows are individual records
>and the columns words. I want to create a new matrix that only
>consists of words which occur in at least 5 records. For example,
>if column 7 is "charges" and this only appears in 4 records/rows
>this variable would not
2008 Apr 03
2
iterative loop with user input?
Hello R-Users,
I would like to use an iterative loop to collect user input from within a
function. I'm sure that this would be some combination of "for","break",
and "next" but have not been able to get the syntax down.
I would like to print some text to the screen at each step in the loop,
ask the user for input which is saved in an object, and then advance the
2011 Apr 09
3
Converting edgelist to symmetric matrix
Hi,
I have network data in the form of a couple of edgelists containing weights in
the format "x,y,weight" whereby x represents row header and y represents column
header. All edgelists are based on links among 634 nodes and I need to convert
them into a 634*634 weighted matrix.
I searched for online help using possible keywords I know, but I could not find
a clue how to do this in
2007 Aug 24
1
uneven list to matrix
Hello,
I am sure I am not the only person with this problem.
I have a list with n elements, each consisting of a single column matrix
with different row lengths. Each row has a name ranging from A to E. Here
is an example:
alph[[1]]
A 1
B 2
C 3
D 4
alph[[2]]
A 1
C 3
D 4
alph[[3]]
A 1
D 4
E 5
I would like to create a matrix from the elements in the list with n
columns such that the row names
2005 Apr 22
1
density estimation
hello
sorry for my english
I would like estimate density for multivariate variable,( f(x,y) , f(x,y
,z) for example) ; for calculate mutual information
how is posible with R?
thanks
Bernard
Bernard Palagos
Unité Mixte de Recherche Cemagref - Agro.M - CIRAD
Information et Technologie pour les Agro-Procédés
Cemagref - BP 5095
34033 MONTPELLIER Cedex 1
France
2011 Jul 06
1
superimposing network graphs
Dear all,
I have a undirected network (g), representing all the sexual relationships that ever existed in a model community.
I also have a directed edgelist (e) which is a subset of the edgelist of g. e represents the transmission pathway of HIV.
Now I would like to superimpose the picture of the sexual relationships with arrows in a different colour, to indicate where in the network HIV was
2011 Jan 05
1
unique limited to 536870912
Hi
I am using R with igraph to analyze an edgelist that is greater than the said amount. Does anyone know a way around this?
Thanks
Inder
2011 May 18
1
data network format and grouping analysis
Hi everyone,
I have a dataset of friendship with this format:
ego alter
4746 1 2
9742 1 3
14738 1 NA
4747 2 NA
9743 2 3
14739 2 1
4748 3 13
9744 3 5
14740 3 14
4749 4 NA
9745 4 NA
14741 4 NA
4750 5 NA
9746 5 13
14742 5 10
4751 6 12
9747 6 7
...
NA means that individuals don't select any
2008 Apr 17
1
Moving from Splus to R: irregular and regular time series
Dear R developpers,
I am a user of Splus since many years and I have developped lots of
functions to plot graph of data and model results of irregular or
regular times series.
In Splus regular times series are created using the rts function and
irregular time series using the its functions. In both cases, times is
given as a numeric vector.
There is no problem in plotting a regular and an
2008 Dec 26
2
question about SNA in R, thanks!
Dear colleagues,
I'm trying to have a look at the Assortative and Disassortative (
http://en.wikipedia.org/wiki/Assortative_mixing) of the network I have.
But it seems that the igraph hasn't mentioned that yet.
I have to get the in/out degree of the vertices of each edge and calculate
the Pearson's Correlation coefficient which seems to be quite a huge task
for me. :(
So I wonder if
2008 Mar 26
2
Latentnet Data Import
Hello everone,
I am a computer science researcher in the UK - and have a quick question regarding importing data into R and more specifically latentnet.
I am trying to import data such as a text file containing: (This is based on the Sampson data set)
-----------
Network attributes:
vertices = 3
directed = TRUE
hyper = FALSE
loops = FALSE
multiple = FALSE
total edges=
2005 Jan 26
3
Still avoiding loops
Dear all,
I have a matrix X with 47 lines and say 500 columns - values are in {0,1}.
I'd like to compare lines.
For that, I first did:
for (i in 1:(dim(X)[1]-1))
for (j in (i+1):dim(X)[1]) {
Y <- X[i,]+Y[j,]
etc.
but, since it takes a long time, I would prefer avoding loops;
for that, my first idea was to add this matrix:
X1=X[,rep(1:46,46:1)]
to this one:
res=NULL
for (i in
2003 Apr 22
1
Social Network Analysis and R
I'm interested in computing densities of a number of small ego-centred or local
networks. I've installed both the R program and the sna package. My next task
is importing the data into R.
Our data was entered into Spss in an edgelist format in which each case
specifies the link between an alter and an ego. For example:
10101 10102 1
10101 10103 3
10102 10104 2
10201 10203
2007 Feb 27
1
interactions and GAM
Dear R-users,
I have 1 remark and 1 question on the inclusion of interactions in the gam function from the gam package.
I need to fit quantitative predictors in interactions with factors. You can see an example of what I need in fig 9.13 p265 from Hastie and Tibshirani book (1990).
It's clearly stated that in ?gam "Interactions with nonparametric smooth terms are not fully
2012 Apr 23
1
Add attributes to igraph vector by name, not index
Hi,
So I've been figuring out how to use igraph in R and like it for it's speed
and simplicity. Now I have a graph built from an edgelist where vectors have
a $name attribute. I have another dataframe with attributes tied to a
vector ID, which is the same as the $name attribute of vectors represented
in the graph.
How can I iterate over the graph by V(g)$name and do
2009 Dec 04
1
R igraph clusters component
Hi R-users,
I'm using igraph for an undirected graph.
i used clusters() igraph function to know the component size(subgraphs) as shown bellow:
c <-clusters(g)
# component sizes
size <- sort(c$csize, decreasing=TRUE)
cat("Top 20 cluster of the graph","\n")
for (i in 1:20)
{
cat(i," size:",size[i] ,"\n")
}
Can anyone help how to extract the
2004 Jul 21
3
How to sort TWO columns ?
Dear ALL,
I fear my question has already been answered many times before, but I
haven't fund that in archives...
I am working on spatial datasets and, in most arrays I'm handling, there are
two columns dedicated to (x,y)-coords.
For different reasons - notably to draw image() plots, I need to have these
two columns sorted in increasing order.
But sort() and order() seem to apply to