Displaying 20 results from an estimated 7000 matches similar to: "how to update my own function"
2012 Mar 21
1
help matching observations for social network data
Greetings R folks,
I am stuck on a problem that I suspect can be solved somewhat easily.
I have social network data stored in dyads as below, where the numbers representing ego and alter are identifiers, so that number 1 as an ego is the same person as number 1 as an alter etc.
ego alter
1 1 2
2 1 3
3 2 1
4 2 4
5 3 1
6 3 2
7 3
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
2013 Dec 06
2
Using assign with mapply
I have a data frame whose first colum contains the names of the variables
and whose second colum contains the values to assign to them:
: kkk <- data.frame(vars=c("var1", "var2", "var3"),
vals=c(10, 20, 30), stringsAsFactors=F)
If I do
: assign(kkk$vars[1], kkk$vals[1])
it works
: var1
[1] 10
However, if I try with mapply
2003 Oct 14
3
mapply() gives seg fault
Hello everybody.
I've been experimenting with mapply(). Does anyone else have problems with:
R> mapply(rep,times=1:4, MoreArgs=42)
(I get a seg fault).
robin
R> R.version
_
platform powerpc-apple-darwin6.6
arch powerpc
os darwin6.6
system powerpc, darwin6.6
status beta
major 1
minor 8.0
year 2003
month 10
day 02
language R
>
2005 Nov 20
1
mapply() gives seg fault (PR#8332)
--KsGdsel6WgEHnImy
Content-Type: text/plain; charset=iso-8859-1; format=flowed
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
Hi, people. Wandering in R archives, and seeing the message attached
below, I noticed that:
mapply(rep,times=1:4, MoreArgs=42)
still segfaults on R 2.2.0, and thought I should be a good citizen and
report it, even if I do not have an actual problem
2006 Aug 31
2
Wish: keep names in mapply() result
Hello!
I have noticed that mapply() drops names in R 2.3.1 as well as in
r-devel. Here is a simple example:
l <- list(a=1, b=2)
k <- list(1)
mapply(FUN="+", l, k)
[1] 2 3
mapply(FUN="+", l, k, SIMPLIFY=FALSE)
[[1]]
[1] 2
[[2]]
[1] 3
Help page does not indicate that this should happen. Argument USE.NAMES
does not have any effect here as it used only in a bit special
2011 Sep 02
3
merge some columns
Dear all,
I would like to know how to merge columns like:
Input file:
V1 V2 V3 V4 V5 V6
1 G A G G G G
2 A A G A A G
Desired output file:
V1 V2 V3
1 G/A G/G G/G
2 A/A G/A A/G
So for every 2 consecutive columns merge their content into one.
Thanks in advance.
[[alternative HTML version deleted]]
2011 Feb 02
2
Help me apply mapply
Hello all I would like to ask your help use mapply.
I have a function called findCell that takes two arguments(x,sr)
where x is a vector of size two (e.g x<-c(2,3) and sr is a matrix.
I would like to call many times the findCell function (thus I need mapply) for different x inputs but always for the same sr.
as x is a vector of size two (two cells) I want to pass inside inside the following
2015 Aug 02
2
CentOS 7
Greetings all, just wondering if anyone knows if / when there will be
training materials for RHEL 7 (CEntOS7) available? The last book I was
able to purchase was the study guide for the RHSCA / RHCE exam, (by
Michal Jang!) Does anyone know if / when the next versions will be out?
I'd like to go through it all with the latest and not "last years model"
under my belt!
Thanks!
2008 Mar 07
3
merging environments
Despite the spirited arguments of various R-core folks
who feel that mle() doesn't need a "data" argument, and
that users would be better off learning to deal with function
closures, I am *still* trying to make such things work
in a reasonably smooth fashion ...
Is there a standard idiom for "merging" environments?
i.e., suppose a function has an environment that I want
2010 Nov 12
4
dnorm and qnorm
Hello all,
I have a question about basic statistics. Given a PDF value of 0.328161,
how can I find out the value of -0.625 in R? It is like reversing the dnorm
function but I do not know how to do it in R.
> pdf.xb <- dnorm(-0.625)
> pdf.xb
[1] 0.328161
> qnorm(pdf.xb)
[1] -0.444997
> pnorm(pdf.xb)
[1] 0.628605
Many thanks,
Edwin
--
View this message in context:
2011 Apr 09
3
New CentOS ToDo Page Required
Due to recent list traffic, it seems that we need to have a new todo
list! I propose the following
1) Nuke current todo page
2) Create new todo page
3) Clear out ancient todo items
a) Get rid of the items that are no longer relevant
b) Reword those that are
4) Update Wiki
a) Gasp as the magnitude at the job
b) Inject coffee, add ego - write mini todo and propose to list
c) Expand on b) till
2011 Apr 09
3
New CentOS ToDo Page Required
Due to recent list traffic, it seems that we need to have a new todo
list! I propose the following
1) Nuke current todo page
2) Create new todo page
3) Clear out ancient todo items
a) Get rid of the items that are no longer relevant
b) Reword those that are
4) Update Wiki
a) Gasp as the magnitude at the job
b) Inject coffee, add ego - write mini todo and propose to list
c) Expand on b) till
2013 May 02
3
I Know It's A Stupid Question......
........But I'm trying to give my son a "cool-yet-kind-of-geeky" 13th
Birthday Present......he hinted he liked the CentOS logo, but where
would I find things that are branded with it?....searching the web
doesn't really help me much, only because I'm not sure what I need to be
looking for...any help would be greatly appreciated! Thanks in advance!!
EGO II
2011 Feb 23
2
list multiplied by a factor / mapply
Dear list,
this works fine:
x <- split(iris, iris$Species)
x1 <- lapply(x, function(L) transform(L, g = L[,1:4] * 3))
but I would like to multiply each Species with another factor:
setosa by 2, versicolor by 3 and virginica by 4. I've tried mapply but
without success.
Any thoughts? Thanks for any idea!
Patrick
2006 Jul 20
2
Timing benefits of mapply() vs. for loop was: Wrap a loop inside a function
List:
Thank you for the replies to my post yesterday. Gabor and Phil also gave
useful replies on how to improve the function by relying on mapply
rather than the explicit for loop. In general, I try and use the family
of apply functions rather than the looping constructs such as for, while
etc as a matter of practice.
However, it seems the mapply function in this case is slower (in terms
of CPU
2012 Dec 11
1
Rprof causing R to crash
I'm trying to use Rprof() to identify bottlenecks and speed up a particullary
slow section of code which reads in a portion of a tif file and compares
each of the values to values of predictors used for model fitting. I've
written up an example that anyone can run. Generally temp would be a
section of a tif read into a data.frame and used later for other processing.
The first portion
2006 May 01
5
Adding elements in an array where I have missing data.
This is a simple question but I cannot seem to find
the answer.
I have two vectors but with missing data and I want to
add them together with
the NA's being ignored.
Clearly I need to get the NA ignored. na.action?
I have done some searching and cannot get na.action to
help.
This must be a common enough issue that the answer is
staring me in the face
but I just don't see it.
Simple
2007 Nov 08
2
mapply, coxph, and model formula
Hello -
I am wanting to create some Cox PH models with coxph (in package
survival) using different datasets.
The code below illustrates my current approach and problem with
completing this.
### BEGIN R SAMPLE CODE ##############################
library(survival)
#Define a function to make test data
makeTestDF <- function(n) {
times <- sample(1:200, n, replace = TRUE)
event
2009 Oct 14
1
using mapply to avoid loops
Hello, I would like to use mapply to avoid using a loop but for some reason, I can't seem to get it to work. I've included copies of my code below. The first set of code uses a loop (and it works fine), and the second set of code attempts to use mapply but I get a "subscript out of bounds" error. Any guidance would be greatly appreciated. Xj, Yj, and Wj are also lists, and s2,