similar to: Help: extrac the first entry for each component of a list

Displaying 20 results from an estimated 20000 matches similar to: "Help: extrac the first entry for each component of a list"

2011 Aug 24
1
Help: convert entry of a list into a matrix
Dear All, As always, I appreciate all your help. I would like to know the easiest way to convert each of the homogeneous elements of a numeric list into a matrix. Each element of this list is also a list such that when displayed, looks like a 2-by-3 matrix , I would like to convert each of them into a matrix, without changing the double index of each entry. Suppose: a<-
2011 Aug 24
2
Help: find the index of the minimum of entries
Dear All, I would like to ask a question on how to find the index of the minimum of entries of a numeric vector, without using loops or user defined functions. Suppose we have a vector: a <- c(3,1,2) then, min(a) = 1 and its index is 2. Target: how to get the index of this minimum? How to get the indices if multiple entries assume this same minimum? Thank you, Chee [[alternative HTML
2011 Aug 23
1
Help: Sort components of a vector with indices tracked in R
Dear All, I would like to know how to sort a vector of numeric values such that we know the original index of each ordered component. Say, we have c <- c(1,4,3,2) csort <- sort(c,descreasing=FALSE) With a few components of c, we can manually find out: csort[1] = 1 = c[1], ie, the original index of csort[1] is 1, csort[2] =2 =c[4], ie, the original index of csort[2] is 4. When length(c) is
2012 Jan 24
2
Help: read a proportion of high through-put data
Dear All, I have a text file, tab delimited, called "sample.txt",as follows: ID_REF 382 GC_Score Theta R B_Allele_Freq Log_R_Ratio 200003 BB 0.9101527 0.9734979 0.8788951 1 0 200006 AB 0.6003323 0.4385073 2.033364 0.4850979 0.01553433 I have explored various options of the command: read.table, with one as:
2011 Apr 29
3
How to define specially nested functions
Dear All, I would like to define a function: f(x,y,z) with three arguments x,y,z, such that: given values for x,y, f(x,y,z) is still a function of z and that I am still allowed to find the root in terms of z when x,y are given. For example: f(x,y,z) = x+y + (x^2-z), given x=1,y=3, f(1,3,z)= 1+3+1-z is a function of z, and then I can use R to find the root z=5. Thank you. -Chee [[alternative
2011 Apr 15
1
How to generate a correlation matrix with restrictions on its eigenvalues
Dear All, I would like to generate m positive real numbers c_i, I=1,...,m, such that (1) c_1 + c_2 + ... + c_m=m, (1) after being ordered into c_1 >= c_2 >= .... >=c_m>0, we have that c_m is of the same order of m^(-1/8), when m is sufficiently large. Thanks, -Chee [[alternative HTML version deleted]]
2011 May 01
2
Question on where samples are grouped in rmvnorm{mvtnorm}
Dear All, For function: rmvnorm{mvtnorm} in (library mvtnorm, not splus2R), if I generate 2 bivariate normal samples as follows: > rmvnorm(2,mean=rep(0,2),sigma=diag(2)) [,1] [,2] [1,] 2.0749459 1.4932752 [2,] -0.9886333 0.3832266 Where is the first sample, it is stored in the first row or the first column? Does this function store samples row-wise or column-wise? Thank
2012 Mar 10
1
Help on subgraphs in xyplot of lattice library
Dear All, I would like to ask a question on how to do overlay plots in each subgraph of xyplot. 1. I did simulations for m=1000, 2500, 5000, 10000, as the sample sizes. 2. for each sample size value m, 4 graphs are generated; each graph contains overlayed comparisons between 4 methods, 3. now I want put them into a 4-by-4 plot by xyplot, i.e., 4 sample size values, each of which has 4 plots.
2013 Feb 02
2
Question: write an R script with help information available to the user
Dear All, I would like to ask a question on how to incorporate into an R script help information for the user. I vaguely recall that I saw some instructions on an R manual, but am not able to figure them out. Hereunder is the basic setting: 1. I finished writing an R script, my_script.r, that is a function (the function is named "my_func") for a statistical procedure. This means that
2011 Apr 18
1
Extract indices after comparing two vectors
Dear All, I would like to ask a question about how to locate the indices after comparing two numeric vectors. Say, I have, A <- c(1,2,3,4) and A <- c(0,3,1,5) and we cmpare: > idx <- A<B So: > idx [1] FALSE TRUE FALSE TRUE Question 1: I would like to get a vector that stores the indices for entries of A such that this relationship is true. In this case, a vector idx1
2011 Apr 19
1
How to get the tuning parameter lamda in storey's qvalue package
Dear All, In Storey's estimator of the proportion of true nulls, the estimator depends on the tuning parameter lamda. Suppose now that an estimator of this proportion has been obtained by the qvalue package, what is the lamda that corresponds to the estimate? How to get this lamda? Thanks, -Chee [[alternative HTML version deleted]]
2011 Apr 22
1
How to generate normal mixture random variables with given covariance function
Dear All, Suppose Z_i, i=1,...,m are marginally identically distributed as a two normal mixture p0*N(0,1) + (1-p0) *N( miu_i, 1) where miu_i are identically distributed according to a mixture and I have generated Z_i one by one . Now suppose these m random variables are jointly m-dimensional normal with correlation matrix M= (m_ij). How to proceed next or how to start correctly ? Question:
2011 Nov 06
1
Request for Help: remove zero in fraction from tick labeling
Dear All, I would like to know how to do the following: 1. suppose I have x values from the ordered from 0, 0.5, 1, and would like to label these three points on the x-axis. 2. However, R labels them as 0.0, 0.5, 1.0. But I wan5 them to be 0, .5, 1, since the former way uses limited space of a multi-subgrap plot by adding extra zeros Thank you, Chee [[alternative HTML version deleted]]
2011 Nov 06
1
Request for Help: y-axis label overlapped by x-axis in subplots in big plot
Dear All, I would like to seek for help on this issue: 1. I set par(mfrow=c(2,2)), hoping to plot 4 subgraphs in a whole graph 2. Each subgraph has its own x,y axes and each has x-axis label and y-axis label 3. moreover, subgraphs in the left column of the whole graph are all 3D, and have z axes and labels for z axes 4. subgraphs in the right column of the whole graph are all 2D 5. In each
2004 Oct 28
1
Problem with "outer" function
Hello, I am having a problem with the "outer" function. I am using R 1.9.1 on Windows 2000. My problem may be described as follows: I have a function f of 3 variables and 3 vectors, aa, bb and cc. I would like to evaluate this function in a 3-dimensional grid of points corresponding to all combinations of the elements of the 3 vectors. For example, if aa<-c(1,2) bb<-c(3,4)
2011 Jan 12
1
navigating in lists
Dear list members, I am stuck with navigating in a rather complicated list object. In general I would need a solution to access all first (or other) elements of the different sublists in one list: test=list(a=list(1,2),b=list(3,4),c=list(5,6)) like: test[[1:3]][[1]] which should result in c(1,3,5) Is there any way to access lists in such a way? Using unlist would create quite
2004 Dec 01
3
core dump during make check when building 64-bit R on Solaris8/9
Hi, After reading some of the posting in this list, I came across this posting from: From: Peter Dalgaard <p.dalgaard_at_biostat.ku.dk> Date: Fri 29 Oct 2004 - 08:02:40 EST Replying to Re: [R] Errors during make check He described a problem similar to mine, that build 64-bit R (I am building R version 2.0.1) with sunperf library gives a core dump during make check. So I configured my
2011 Aug 25
1
Possible Error in generic function rzigp in ZIGP Package
Dear All, I would like to report a possible mistake in the generic function rzigp in ZIGP package, and seek for help. Yesterday I tried the "rzigp" function, in this way: 1. generate poisson means from a pareto distribuion, 2. generate dispersion for each poisson from gamma distribution 3. generate ratios between poisson means from uniform 4. generate dispersed poisson counts by
2003 Jun 09
1
Swat documentation broken
Just installed samba-3.0.0beta1 and trying to use swat. When clicked on help on a particular paramenter (any one), a new window pops up and supposingly it will load smb.conf.5.html and then jumps to the label of the parameter. But now it doesn't work. smb.conf.5.html is no longer complete. Checked under docs/docbook/smbdotconf and found that smb.conf.5.xml supposingly should include files
2011 Nov 08
4
Intervals in function cut
When I was studying the function cut I found this example: > x <- rep(0:8, tx0) > x [1] 0 0 0 0 0 0 0 0 0 1 1 1 1 2 2 2 2 2 2 3 3 3 3 3 4 4 4 5 5 5 5 5 5 5 5 5 5 6 [39] 6 6 6 6 7 7 7 8 8 8 8 8 > cut(x, b = 8) [1] (-0.008,0.994] (-0.008,0.994] (-0.008,0.994] (-0.008,0.994] (-0.008,0.994] [6] (-0.008,0.994] (-0.008,0.994] (-0.008,0.994] (-0.008,0.994] (0.994,2] [11] (0.994,2]