similar to: how to initial a list to store data result?

Displaying 20 results from an estimated 30000 matches similar to: "how to initial a list to store data result?"

2010 Apr 28
1
how to remove the names in the list result
hi,everybody: I get a list as following. For each element of the list, it has names such as "Var1" and "Freq". May I ask how to remove them? And, may I ask how to make them form a matrix such as like concatinating them? Thank you! The list I got: [[1]] Var1 Freq 1 -5.20726501684368 19 2 1.89099344331540 31 [[2]] Var1
2010 May 03
3
how to rewrite this for loops in matrix form without loop
x0=rnorm(100) y0=rpois(100,3)+1 ind=as.data.frame(table(y0)) ind1=ind[,1] ind2=ind[,2] phi=NULL for (i in 1:length(ind2)){ phi[i]=sum(x0[y0==ind1[i]])/ind2[i] } [[alternative HTML version deleted]]
2010 Jun 17
3
ask a question about data sets element
for example, I have a1=c(1,3,5) a2=c(2,4,6) a3=c(7,8) a4=c(9,10) now if I have i=5, so i in a1, then I get a feedback tag[5]=1 i=8, so i in a3, then can get tag[8]=3 in there any function to do this to check the element belongs to which group? thank you!!! [[alternative HTML version deleted]]
2018 Jun 01
3
values of list of variable names
Hi, I have searched the documentations of eval, substitute, expression, and I cannot make work something like the values of a list of variable names: lis <- ls(pattern="pr") # all variables with names containing 'pr' What is the mantra giving me the _values_ of the variables whose names are contained in 'lis'. eval(parse(ls(pattern="pr"))) will not do
2012 Aug 29
5
Extracting the name of a function (inverse of match.fun("myFun"))
Hi all, is there a way to extract the name of a function, i.e. do the reverse of match.fun applied to a character string? I would like to print out the name of a function supplied to another function as an argument. For example: myFunc = function(x) { x+1 } applyFunc = function(fnc, x) { fnc = match.fun(fnc) fnc(x) } Is there a way to obtain "myFunc" from the argument fnc in
2010 Sep 29
1
how to to if a calculation is out range?
for example, when I am calculating a posterior density, I need to calculate gamma(75*3+5)=gamma(220) which is out of the bound of gamma function. what shall I do for this condition> Thank you [[alternative HTML version deleted]]
2012 Mar 29
3
scalar assignment within a vector within function
Hello, I'm trying to create a vector of r^2 values for using a function which I will run in a "for" loop. Example: per<-rnorm(100,.5,.2)^2 x<-rnorm(100,10,5) y<-rnorm(100,20,5) fr<-data.frame(x,y,per) test<-rep(0,9) plotter<-function(i){ temp.i<-fr[fr$per <=(i*.10),] with(temp.i, plot(x, y, main=(i*.10),)) mod<-lm(y~x-1,data=temp.i)
2006 Mar 10
2
lapply and list attributes
Hi I have a list that has attributes: attributes(lis[2]) $names [1] "150096_at" I want to use those attributes in a function and then use lapply to apply that function to every element of the list, eg for simplicity's sake: my.fun <- function(x) { attributes(x) } Then l2 <- lapply(lis, my.fun) It seems that "attributes(x)" within the function is not the
2008 Jul 01
5
trivial list question
Dear experts, For the makeGenotype function I need a list as in the example. However, since my list needs to be 184 long there must be an easy way to make it. >list(1:2,3:4,5:6,7:8) [[1]] [1] 1 2 [[2]] [1] 3 4 [[3]] [1] 5 6 [[4]] [1] 7 8 I have tried lis<-1:184 dim(lis)=c(92,2,1) as.list(lis) and several other options. Any suggestions? many thanks Marco [[alternative
2005 Mar 16
8
Summing up matrices in a list
Dear all, I think that my question is very simple but I failed to solve it. I have a list which elements are matrices like this: >mylist [[1]] [,1] [,2] [,3] [1,] 1 3 5 [2,] 2 4 6 [[2]] [,1] [,2] [,3] [1,] 7 9 11 [2,] 8 10 12 I'd like to create a matrix M<-mylist[[1]]+mylist[[2]] [,1] [,2] [,3] [1,] 8 12 16 [2,] 10 14 18
2007 Feb 22
3
List filtration
Hello R-ologists, Imagine you have a list "list" like so: >list [[1]] [1] "IPI00776145.1" "IPI00776187.1" [[2]] [1] "Something" "IPI00807764.1" "IPI00807887.1" [[3]] [1] "IPI00807764.1" [[4]] [1] "Somethingelse" What I need to achieve is a filtered list "list2" like so: >list2 [[1]] [1]
2003 Aug 11
4
subscripts in lists
I am tying myself in knots over subscripts when applied to lists I have a list along the lines of: lis<-list(c("a","b","next","want1","c"),c("d", "next", "want2", "a")) >From which I want to extract the values following "next" in each member of the list, i.e. something along the lines of
2018 Apr 17
5
Hacked
No, I do not use gmail, still got dirty spam email twice. -----Original Message----- From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Fowler, Mark Sent: Tuesday, April 17, 2018 12:32 PM To: Luis Puerto; Peter Langfelder Cc: R-Help ML R-Project; Neotropical bat risk assessments Subject: Re: [R] Hacked [Attention: This email came from an external source. Do not open attachments
2018 Apr 17
2
Hacked
I've been receiving nasty e-mails too. No g-mail, but official/work e-mail address. -----Original Message----- From: R-help <r-help-bounces at r-project.org> On Behalf Of Rui Barradas Sent: Tuesday, April 17, 2018 5:09 PM To: Ding, Yuan Chun <ycding at coh.org>; Fowler, Mark <Mark.Fowler at dfo-mpo.gc.ca>; Luis Puerto <luiss.puerto at gmail.com>; Peter Langfelder
2018 Apr 18
3
Hacked
Hi All: I lately get a lot more spam-porn type emails lately also but I don't know if they are due to me being on the R-list. On Tue, Apr 17, 2018 at 5:09 PM, Rui Barradas <ruipbarradas at sapo.pt> wrote: > Hello, > > Nor do I, no gmail, also got spam. > > Rui Barradas > > On 4/17/2018 8:34 PM, Ding, Yuan Chun wrote: > >> No, I do not use gmail, still
2005 May 10
4
summary statistics for lists of matrices or dataframes
Is there a simple way to calculate summary statistics for all the matrices or dataframes in a list? For example: > z <- list(matrix(c(2,2,2,2), ncol = 2), matrix(c(4,4,4,4), ncol = 2)) > z [[1]] [,1] [,2] [1,] 2 2 [2,] 2 2 [[2]] [,1] [,2] [1,] 4 4 [2,] 4 4 > I would like to calculate, for example, the mean value for each cell. I can do that the hard
2018 Apr 17
0
Hacked
Hello, Nor do I, no gmail, also got spam. Rui Barradas On 4/17/2018 8:34 PM, Ding, Yuan Chun wrote: > No, I do not use gmail, still got dirty spam email twice. > > -----Original Message----- > From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Fowler, Mark > Sent: Tuesday, April 17, 2018 12:32 PM > To: Luis Puerto; Peter Langfelder > Cc: R-Help ML
2018 Apr 12
1
WGCNA package installation segmentation fault
Hi all, a user contacted me about a segfault when installing WGCNA package dowloaded from CRAN. I also see a segfault like that on certain installs of R. The package passes all CRAN checks, so presumably this has something to do with the R installation or environment. The R versions here are not the newest but I would guess that this is not an R version issue. I'm attaching two
2019 May 08
3
openblas
On Wed, 8 May 2019 at 04:52, Peter Langfelder <peter.langfelder at gmail.com> wrote: > > (CCing the R-devel list, maybe someone will have a better answer.) > > To be honest, I don't know how to. I wasn't able to configure R to use > OpenBLAS using the configure script and options on my Linux Fedora system. > I configure it without external BLAS, then replace the
2007 Apr 03
5
converting a list to a data.frame
Hello, I have a list with n numerical components of different length (3, 4 or 5 values in each component of the list); I need to export this as a text file where each component of the list will be a row and where missing values should fill in the blanks due to the different lengths of the components of the list. I think that as a first step I should convert my list to a data frame, but this is