similar to: R Help-how to use sapply w/tapply

Displaying 20 results from an estimated 2000 matches similar to: "R Help-how to use sapply w/tapply"

2013 Feb 28
11
new question
Hi, directory<- "/home/arunksa111/data.new" #first function filelist<-function(directory,number,list1){ setwd(directory) filelist1<-dir(directory) direct<-dir(directory,pattern = paste("MSMS_",number,"PepInfo.txt",sep=""), full.names = FALSE, recursive = TRUE) list1<-lapply(direct, function(x) read.table(x,header=TRUE, sep =
2011 May 19
3
problem with optim()
Dear R-users, I would like to maximize the function g above which depends on 4 parameters (2 vectors, 1 real number, and 1 matrix) using optim() and BFGS method. Here is my code: # fonction to maximize g=function(x) { x1 = x[1:ncol(X)] x2 = x[(ncol(X)+1)] x3 = matrix(x[(ncol(X)+2):(ncol(X)+1+ncol(X)*ncol(Y))],nrow=ncol(X),ncol=ncol(Y)) x4 = x[(ncol(X)+1+ncol(X)*ncol(Y)+1):length(x)]
2010 Jul 20
1
p-values pvclust maximum distance measure
Hi, I am new to clustering and was wondering why pvclust using "maximum" as distance measure nearly always results in p-values above 95%. I wrote an example programme which demonstrates this effect. I uploaded a PDF showing the results Here is the code which produces the PDF file: ------------------------------------------------------------------------------------- s <-
2005 Jul 19
1
initial points for arms in package HI
Dear R-users I have a problem choosing initial points for the function arms() in the package HI I intend to implement a Gibbs sampler and one of my conditional distributions is nonstandard and not logconcave. Therefore I'd like to use arms. But there seem to be a strong influence of the initial point y.start. To show the effect I constructed a demonstration example. It is reproducible
2011 Feb 24
2
MCMCpack combining chains
Deal all, as MCMClogit does not allow for the specification of several chains, I have run my model 3 times with different random number seeds and differently dispersed multivariate normal priors. For example: res1 = MCMClogit(y~x,b0=0,B0=0.001,data=mydat, burnin=500, mcmc=5500, seed=1234, thin=5) res2 = MCMClogit(y~x,b0=1,B0=0.01,data=mydat, burnin=500, mcmc=5500, seed=5678, thin=5) res3 =
2012 Aug 06
1
cannot find function "simpleRDA2"
Hi, I am trying to run the command "forward.sel.par," however I receive the error message: "Error: could not find function 'simpleRDA2'." I have the vegan library loaded. The documentation on "varpart" has not helped me to understand why I cannot call this function. Maybe I am missing something obvious because I am still an 'R' novice. Below is a
2012 Jun 20
1
prcomp: where do sdev values come from?
In the manual page for prcomp(), it says that sdev is "the standard deviations of the principal components (i.e., the square roots of the eigenvalues of the covariance/correlation matrix, though the calculation is actually done with the singular values of the data matrix)." ?However, this is not what I'm finding. ?The values appear to be the standard deviations of a reprojection of
2006 Aug 10
1
How to speed up nested for loop computations
Dear all, here is the result of R.Version(): > R.Version() $platform [1] "powerpc-apple-darwin8.6.0" $arch [1] "powerpc" $os [1] "darwin8.6.0" $system [1] "powerpc, darwin8.6.0" $status [1] "" $major [1] "2" $minor [1] "3.1" $year [1] "2006" $month [1] "06" $day [1] "01" $`svn rev`
2009 Feb 02
1
Assigning colnames in loop
Dear R-listers, I am trying to assign colnames to a data frame within a loop, but I keep getting a "target of assignment expands to non-language object"-error. I need to split up a large dataset into about 20 smaller ones, and I would like to assign colnames within the loop, so I won't have to type the same thing 20 times over. I have concocted this really goofy example which
2009 Jul 31
1
[PATCH] [memdisk] Additional EDD Device Parameter Table fields
Some additional fields from the EDD-4 spec. draft for the Device Parameter Table have been added into the structure in setup.c and memdisk.inc. These were added in the hopes of resolving a FreeDOS MEMDISK bug on IBM ThinkPads. --- memdisk/memdisk.inc | 11 +++++++++++ memdisk/setup.c | 10 ++++++++++ 2 files changed, 21 insertions(+), 0 deletions(-) diff --git a/memdisk/memdisk.inc
2013 Jun 10
4
Combining CSV data
Hello R community, I am trying to combine two CSV files that look like this: File A Row_ID_CR, Data1, Data2, Data3 1, aa, bb, cc 2, dd, ee, ff File B Row_ID_N, Src_Row_ID, DataN1 1a, 1, This is comment 1 2a, 1, This is comment 2 3a,
2013 Mar 10
0
max row
HI, Using c11<- 0.01 c12<- 0.01 c1<- 0.10 c2<- 0.10 One possible problem is that: dim(res5) #[1] 513? 20 res6<-aggregate(.~m1+n1+m+n,data=res5[,c(1:6,9:12,21:24)] ,max) #Error in `[.data.frame`(res5, , c(1:6, 9:12, 21:24)) : ?# undefined columns selected A.K. ________________________________ From: Joanna Zhang <zjoanna2013 at gmail.com> To: arun <smartpink111 at
2013 Feb 17
6
histogram
HI Elisa, You could use ?cut() vec1<-c(33,18,13,47,30,10,6,21,39,25,40,29,14,16,44,1,41,4,15,20,46,32,38,5,31,12,48,27,36,24,34,2,35,11,42,9,8,7,26,22,43,17,19,28,23,3,49,37,50,45) label1<-unlist(lapply(mapply(c,lapply(seq(0,45,5),function(x) x),lapply(seq(5,50,5),function(x) x),SIMPLIFY=FALSE),function(i) paste(i[1],"<x<=",i[2],sep="")))
2013 Jul 02
2
Recoding variables based on reference values in data frame
I'm new to R (previously used SAS primarily) and I have a genetics data frame consisting of genotypes for each of 300+ subjects (ID1, ID2, ID3, ...) at 3000+ genetic locations (SNP1, SNP2, SNP3...). A small subset of the data is shown below: SNP_ID SNP1 SNP2 SNP3 SNP4 Maj_Allele C G C A Min_Allele T A T G ID1 CC GG CT AA ID2 CC GG CC AA ID3 CC GG nc AA
2010 Oct 17
0
Help on choosing the appropriate analysis method
Dear R-help, I'd like ask for your opinion on choosing the "right" strategy for a particular dataset. We conducted 24-hour electric field measurements on 90 subjects. They are grouped by job (2 categories) and location (3 categories). There are four exposure metrics assigned to each subject. An excerpt from the data: n job location M OA UE all 0 job1 dist_200 0.297 0.072 0.171
2013 Feb 15
10
reading data
Hi, #working directory data1 #changed name data to data1.? Added some files in each of sub directories a1, a2, etc. ?indx1<- indx[indx!=""] lapply(indx1,function(x) list.files(x)) #[[1]] #[1] "a1.txt"??????? "mmmmm11kk.txt" #[[2]] #[1] "a2.txt"??????? "mmmmm11kk.txt" #[[3]] #[1] "a3.txt"??????? "mmmmm11kk.txt" #[[4]] #[1]
2013 Feb 01
29
cumulative sum by group and under some criteria
Thank you very much for your reply. Your code work well with this example. I modified a little to fit my real data, I got an error massage. Error in split.default(x = seq_len(nrow(x)), f = f, drop = drop, ...) : Group length is 0 but data length > 0 On Thu, Jan 31, 2013 at 12:21 PM, arun kirshna [via R] < ml-node+s789695n4657196h87@n4.nabble.com> wrote: > Hi, > Try this: >
2012 Jun 11
3
Simple Binning of Values
Hello I am very new to R.  I have an R task to complete that I have not been able to find a straightforward answer to as of yet.  I have a list of values. I would like to count the number of values that are in one bin, the number that fall in the next bin, etc. For example My input file is:  123 48 342 442 43 232 32 129 191 147 I would like the output to be similar to:  0-100 3 100-200 4
2013 Aug 26
4
transform variables
Dear all! I have a data frame composed by 13 columns (year, and 12 months). I want to transform this data base in another like this year month values 1901 1 1901 2 1901 3 ..... 1901 12 1902 1 1902 2 .... 1902 12 Is there a possibility to succeed that in R? Thank you! best regards! CR -- --- Catalin-Constantin ROIBU Lecturer PhD, Forestry engineer Forestry Faculty of Suceava Str.
2002 May 24
0
problem with R-mathlib standalone
Hi, I'm trying to use pgamma() within my C application but I'm getting strange results. I have a Debian system with r-mathlib 1.4.1-1 and gcc 2:2.95.4-9. Here are 3 example pgamma() calls executed by R: $ R -q --vanilla < gamma.R > pgamma(98, 100, 1) [1] 0.4333105 > pgamma(21, 100, 5) [1] 0.7002453 > pgamma(2, 100, 69) [1] 0.9997046 > and here is what the small C