similar to: for loop help

Displaying 20 results from an estimated 10000 matches similar to: "for loop help"

2008 Feb 13
2
apply on large arrays
I have a big contingency table, approximately of size 60*2*500*500, and I need to count the number of cells containing a count of 1 for each of the factors values defining the first dimension. Here is my attempt: tab1<-with(pisa1,table(CNT,GENDER,ISCOF,ISCOM)) tab2<-apply(tab1,1:4,function(x)ifelse(sum(x)==1,1,0)) tab3<-apply(tab2,1,sum) Computing tab2 is very slow. Is there a faster
2008 Feb 01
6
Accessing the elements of a list
Hi R, I wanted to know how do we access the elements of a list. In particular, v=list(c(1,2,3,4,5),c(1,2,33,4,5),c(1,2,333,4,5),c(1,2,3333,4,5)) I want to access all the thirds items of the elements of the list. i.e., I want to access the elements, 3,33,333,3333. This can be done through sapply as: sapply(v,function(x) x[3]) But I need to access this without using
2007 Jul 03
1
termplot - changes in defaults
While termplot is under discussion, here's another proposal. I'd like to change the default for partial.resid to TRUE, and for smooth to panel.smooth. I'd be surprised if those changes were to break existing code. John Maindonald email: john.maindonald at anu.edu.au phone : +61 2 (6125)3473 fax : +61 2(6125)5549 Centre for Mathematics & Its Applications, Room
2008 Apr 13
4
R equivalent of erfcinv in matlab
I am converting some matlab code into R that use inverse of the complementary error function, erfcinv and did not find an equivalent in R, is there such a function in some contributed modules? Thanks.
2007 Nov 15
3
generate combination set
I have a set data={A,B,C,D,E,F,G} I want to choose 2 letter from 8 letters, i.e. generate the combination set for choose 2 letters from 8 letters. I want to get the liking: combination set={AB,AC,AD,....} Does anyone konw how to do in R. thanks, Aimin
2008 Mar 04
6
vector manipulations
Un texte encapsul? et encod? dans un jeu de caract?res inconnu a ?t? nettoy?... Nom : non disponible Url : https://stat.ethz.ch/pipermail/r-help/attachments/20080304/9de37092/attachment.pl
2007 Jul 02
2
termplot with uniform y-limits
Does anyone have, or has anyone ever considered making, a version of 'termplot' that allows the user to specify that all plots should have the same y-limits? This seems a natural thing to ask for, as the plots share a y-scale. If you don't have the same y-axes you can easily misread the comparative contributions of the different components. Notes: the current version of termplot
2007 Jul 02
2
termplot with uniform y-limits
Does anyone have, or has anyone ever considered making, a version of 'termplot' that allows the user to specify that all plots should have the same y-limits? This seems a natural thing to ask for, as the plots share a y-scale. If you don't have the same y-axes you can easily misread the comparative contributions of the different components. Notes: the current version of termplot
2008 Mar 07
5
Puzzling coefficients for linear fitting to polynom
Hi, I can not comprehend the linear fitting results of polynoms. For example, given the following data (representing y = x^2): > x <- 1:3 > y <- c(1, 4, 9) performing a linear fit > f <- lm(y ~ poly(x, 2)) gives weird coefficients: > coefficients(f) (Intercept) poly(x, 2)1 poly(x, 2)2 4.6666667 5.6568542 0.8164966 However the fitted() result makes sense: >
2005 Dec 21
3
NextMethod causes R 2.2.0 to crash (PR#8416)
I found writing the following default method the for the generic function "julian" causes R to crash. julian.default <- function(x, ...) { x <- as.Date(x) NextMethod("julian", x, ...) } Here is a test example > m <- as.Date("1972-09-27") + 0:10 > m [1] "1972-09-27" "1972-09-28" "1972-09-29"
2007 Nov 08
2
a newbie question about "data"
hi, I am reading Modern Applied Statistics with S 4th ed$B!#(B page4 have these two lines: > library(MASS) > data(chem) # needed in R only but I find withou the line " data(chem)" I can still access chem, isn't it? is it unnecessary or something i missed here? thanks for the replay in advance.
2008 Feb 26
1
The meaning of 'z value' and 'Pr(>|z|)' in the result of glm
Hi all, I used the function 'glm' to perform logistic regression, and then use 'summary' to display the fitting result. There are 'z value' and 'Pr(>|z|)' Do they simpily represent the result of 'z test' ? as I perform the 'z test' for a particular variable following the definition, it yields a different result. Stephen Lau
2008 Mar 13
1
(no subject)
Hi there, Am try to find tree diameter increment in a hierarchical data with tree diameter measurements, date of measurements, in plots that are located in different region. How do I do it? am very new to R. Thanks for you help. Maina Kariuki Level 3, 8 Nicholson Street East Melbourne VIC 3002 Ph: (03) 9637 9809 Email: maina.kariuki@dse.vic.gov.au Notice: This email and any
2008 Mar 14
2
How to turn a string into a variable name ?
Hi, For example, natural_nums <- 1:10 even_nums <- seq(2,10, by = 2) types <- c("natural_nums", "even_nums") What functions can be performed on types[1] to turn it into a variable name and not a string ? [[alternative HTML version deleted]]
2008 Mar 19
1
Anova of a nls object
Um texto embutido e sem conjunto de caracteres especificado associado... Nome: n?o dispon?vel Url: https://stat.ethz.ch/pipermail/r-help/attachments/20080319/ee1ca0fe/attachment.pl
2008 Mar 25
1
peak finding
Hi all Is there a function that can find the start and end position of peaks in a set of numbers. eg. x=c(14,15,12,11,12,13,14,15,16,15,14,13,12,11,14,12) y=somefunction(x) y 4 14 Thanks John [[alternative HTML version deleted]]
2008 Mar 26
1
avoiding loops
Hi, I need to compute an array from a matrix and an array: A <- array(1:20,c(2,2,5)) B <- matrix(1:10,5) And I would like the result to be an array consisting of the following: rbind(A[1,,1]*B[1,], A[2,,1]*B[1,]) rbind(A[1,,2]*B[2,], A[2,,2]*B[2,]) rbind(A[1,,3]*B[2,], A[2,,3]*B[2,]) etc. Hence the result should have the same dimension as A, ie a series of 2 by 2 matrices. Short of
2008 Mar 31
1
Find the index for min of a matrix
Hi, My example is as the following, W<-matrix(c(2,4,2,8,1,3),ncol=3) which(W==min(W)) I would like to find the index for min of the matrix W, i.e. (1, 3) instead of 5 as the output. What command could I use? Thanks, Kate [[alternative HTML version deleted]]
2008 Apr 30
2
boxplots
Dear R user group, I am working with boxplots and cannot solve the following problem: > data<-c(0,15,0,60,0,0,0,0,0,60,60,0,60,0,30,0) > data [1] 0 15 0 60 0 0 0 0 0 60 60 0 60 0 30 0 > boxplot(data) The boxplot has the first hinge and the mean-bar both at 0... Why is this the mean is clearly >0! Thanking you and wishing you an excellent day, Georg.
2008 May 17
1
R to exe
hi, is there a way to compile r script , so that it can be run without the R platform, both on unix and windows something to create exe file. thnx -- View this message in context: http://www.nabble.com/R-to-exe-tp17291121p17291121.html Sent from the R help mailing list archive at Nabble.com.