similar to: Programing and writing function help

Displaying 20 results from an estimated 30000 matches similar to: "Programing and writing function help"

2008 Feb 22
3
Mixed model Nested ANOVA
hello R help I am trying to analyze a data set that has been collected from a hierarchical sampling design. The model should be a mixed model nested ANOVA. The purpose of my study is to analyze the variability at each spatial scale in my design (random factors, variance components), and say something about the variability between regions (fixed factor, contrast of means). The data is as
2008 Apr 12
4
HOW TO AVOID LOOPS
> Looking for a simple, effective a minimum execution time solution. > > For a vector as: > > c(0,0,1,0,1,1,1,0,0,1,1,0,1,0,1,1,1,1,1,1) > To transform it to the following vector without using any loops: > (0,0,1,0,1,2,3,0,0,1,2,0,1,0,1,2,3,4,5,6) > Appreciate any suggetions. [[alternative HTML version deleted]]
2012 Apr 19
1
combining large list of data.frames
It's normal for me to create a list of data.frames and then use do.call('rbind', list(...)) to create a single data.frame. However, I've noticed as the size of the list grows large, it is perhaps better to do this in chunks. As an example here's a list of 20,000 similar data.frames. # create list of data.frames dat <- vector("list", 20000) for(i in
2005 Mar 29
1
improved pairs.formula?
Dear all, I would like to suggest changing the pairs.formula command such that a command like pairs(GNP ~ . - Year - GNP.deflator, longley) would behave in a similar fashion as lm(GNP ~ . - Year - GNP.deflator, longley) i.e., make a pairwise scatterplot of GNP and all other variables in the (longley) dataframe except for Year and GNP.deflator. The above command, with the
2008 May 08
2
speeding up a special product of three arrays
I am struggling with R code optimization, a recurrent topic on this list. I have three arrays, say A, B and C, all having the same number of columns. I need to compute an array D whose generic element is D[i, j, k] <- sum_n A[i, n]*B[j, n]*C[k, n] Cycling over the three indices and subsetting the columns won't do. Is there any way to implement this efficiently in R or should I resign to
2008 Apr 26
1
nested anova and multiple comparisons
Hello R List: My problem is with a nested anova. I have read the r-help and it has answered some of my questions but i still need some help on this one. I have also posted for help on this data set before, so i apologize in advance for any repetition. My design is as follows: response: Quadrat Counts (individuals per quadrat) Explanatory: Region (3 regions) Locations (4
2008 Jul 27
4
product of successive rows
Hi everyone, I want to perform an operation on a matrx that outputs the product of successive pairs of rows. For example: calculating the product between rows 1 & 2; 3 & 4; 5 & 6...etc. Does anyone know of any readily available functions that can do this? Thanks, rcoder -- View this message in context: http://www.nabble.com/product-of-successive-rows-tp18681259p18681259.html
2012 Mar 08
4
Correlation between 2 matrices but with subset of variables
Dear All, I have two matrices A (40 x 732) and B (40 x 1230) and would like to calculate correlation between them.  I can use: cor(A,B, method="pearson") to calculate correlation between all possible pairs. But the issue is that there is one-many specific mappings between A and B and I just need to calculate correlations for those pairs (not all). Some variables in A (proteins, say p1)
2009 Jun 17
2
Re gression by groups questions
I have a large dataset grouped by a factor and I want to perform a regression on each data subset based on this factor. There are many ways to do this, posted here and elsewhere. I have tried several. However I found one method posted on the R wiki which works exactly as I want, and I like the elegance and simplicity of the solution, but I don't understand how it works. Its all in the formula
2009 Jul 15
4
Extract pairs (rowname, columname) from a matrix where value is 0
Dear sir, I have a matrix like a<-matrix(c(0,2,0,4,0,6,5,8,0),nrow=3) colnames(a)<-c("F1","F2","F3") rownames(a)<-c("A1","A2","A3") a F1 F2 F3 A1 0 4 5 A2 2 0 8 A3 0 6 0 I want to extract all pairs (rownames, columnames) from which the value in the matrix is 0 The result should be something like this A1, F1 A2,
2011 Nov 16
1
calculating time interval distributions
Dear List, I have data on a approximately 100 individuals visiting a a central logging station over a 1000 times. I would like to be able to calculate the distribution of inter-visit time intervals for all possible pairs am stuck on how to code for this. Single pairs are not a problem but extending it has been difficult for me. So for the toy data below I'd like to calculate for each
2009 Nov 16
1
No Visible Binding for global variable
While building a package, I see the following: * checking R code for possible problems ... NOTE cheat.fit: no visible binding for global variable 'Zobs' plot.jml: no visible binding for global variable 'Var1' I see the issue has come up before, but I'm having a hard time discerning how solutions applied elsewhere would apply here. The entire code for both functions is below,
2008 Dec 10
1
subset point data set by distance ranges
Greetings I'm using R 2.8 with recent (last month) versions of the packages I need to use at present. I'm interested in examining hierarchical spatio-temporal patterns in a data set. The data consist of 94 points (X, Y, UTM coordinates) at which catch rates for a fish were recorded and there are also estimates of prey available for these fish at the same locations.
2011 Mar 18
1
points() rendering points outside of input
As a followup to pi-day, I attempted to make a .gif of a simulation based estimation of pi by plotting points inside a single quadrant of a circle (a la?http://www.drewconway.com/zia/?p=2667 ). ?When rendering the individual x,y pairs with points() I intermittently see points crop up around (2,0.5) but the input values for x and y are bounded between 0 and 1. square<-structure(c(0, 0, 1, 1, 0,
2005 Aug 18
2
matrix indexing
Dear R-users, I was wondering for the following: Let 'x' be a matrix and 'ind' and indicator matrix, i.e., x <- array(1:20, dim = c(4, 5)) ind <- array(c(1:3, 3:1), dim = c(3, 2)) I'd like to get (as a vector) the elements of 'x' which are not indexed by 'ind'. Since negative indices are not allowed in index matrices I thought of using something like:
2015 Mar 02
1
Re: [virt-tools-list] libvirt/virt-manager source integration with xen
Thanks Cole, unfortunately I'm a n00b in this area so your response just raised many more questions for me :/ * what are the config file names for libxl, libvirt and virt-manager * where are they located in the respective source trees * are the build flags defined in those config files? * libxl is part of xen 4.5.0 distro (xen/tools/libxl after untarring). But no config file is in
2012 Sep 26
1
Write table with data in other .csv template
Hi, I have a table with data, as below: dput(table): structure(list(Adrian.Cole = c(0L, 0L, 0L, 0L, 0L, 0L), Alison.Wong = c(0L, 0L, 0L, 0L, 0L, 0L), Andrei.Savu = c(0L, 0L, 0L, 0L, 0L, 0L), Bruno.Dumon = c(0L, 0L, 0L, 0L, 0L, 0L), Edward.J..Yoon = c(0L, 0L, 0L, 0L, 0L, 0L), Eugene.Koontz = c(0L, 0L, 0L, 0L, 0L, 0L), Jakob.Homan = c(0L, 0L, 0L, 0L, 0L, 0L), Kelvin.Kakugawa = c(0L, 0L,
2015 Mar 02
2
Re: [virt-tools-list] libvirt/virt-manager source integration with xen
On 03/02/2015 10:55 AM, Wayne Mills wrote: > Hi, > > I built and installed Xen 4.5.0 from source, on top of Ubuntu 14.04.2, using > "make world" and "make install" targets. I then installed latest virt-manager > from pre-built packages. After bringing up virt-manager I attempt to connect > to Xen hypervisor and got: > > unable to connect to
2015 Mar 03
3
Re: [virt-tools-list] libvirt/virt-manager source integration with xen
I downloaded and untarred the deb package and grepped for 'configure', but none of the hits were configure commands. Is there a better way to find it? Wayne On Mon, Mar 2, 2015 at 3:08 PM, Cole Robinson <crobinso@redhat.com> wrote: > On 03/02/2015 01:39 PM, Wayne Mills wrote: > > Thanks Cole, unfortunately I'm a n00b in this area so your response just > >
2009 Oct 27
2
column names of a correlation matrix
Hi! All, I am working on a correlation matrix of 4217x4217 named 'cor_expN'. I wish to obtain pairs with highest correlation values. So, I did this > b=matrix(data=NA,nrow=4217,ncol=1) > rownames(b)=rownames(cor_expN) > for(i in 1:4217){b[i,]=max(cor_expN[i,])} > head(b) [,1] aaeA_b3241_14 0.7181912 aaeB_b3240_15 0.7513084 aaeR_b3243_15 0.7681684