[R] appending to a vector

2011-04-14 Thread dirknbr
Which one is more efficient? x2=c() for (i in 1:length(x)) { x2=c(x2,func(x[i])) } or x2=x for (i in 1:length(x)) { x2=func(x[i]) } where func is any function? Dirk -- View this message in context: http://r.789695.n4.nabble.com/appending-to-a-vector-tp3449109p3449109.html Sent from the R

Re: [R] iterative methods in R

2011-04-12 Thread dirknbr
Since R is built for statistics almost all is based on iterative methods converging towards something. -- View this message in context: http://r.789695.n4.nabble.com/iterative-methods-in-R-tp3443837p378.html Sent from the R help mailing list archive at Nabble.com. _

Re: [R] read in summarised data as table()

2011-04-11 Thread dirknbr
Ok it looks like this x yz a 12 12 34 b 34 34 35 c 56 78 0 where the numbers are counts of cases I can read it in, but how do I tell R it's a table? Dirk -- View this message in context: http://r.789695.n4.nabble.com/read-in-summarised-data-as-table-tp3442283p3443102.html Sent from t

Re: [R] Geographic distance between lat-long points in R?

2011-04-11 Thread dirknbr
I found something here http://www.biostat.umn.edu/~sudiptob/Software/distonearth.R #The following program computes the distance on the surface of the earth between two points point1 and point2. Both the points are of the form (Longitude, Latitude) geodetic.distance <- function(point1, point2) {

[R] read in summarised data as table()

2011-04-11 Thread dirknbr
I have some summarised data from a 2D pivot table which I want to visualise in R. How can I read in the data as a R table so I can use mosaicplot()? Dirk -- View this message in context: http://r.789695.n4.nabble.com/read-in-summarised-data-as-table-tp3442283p3442283.html Sent from the R help ma

[R] good examples of plot(table())

2011-04-11 Thread dirknbr
I am looking for good examples of visualising a tabulation using plot(table()) maybe with colour coding or indexing. Dirk -- View this message in context: http://r.789695.n4.nabble.com/good-examples-of-plot-table-tp3442131p3442131.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] glm with multiple vars

2011-04-11 Thread dirknbr
Sascha Thanks that works. Dirk -- View this message in context: http://r.789695.n4.nabble.com/glm-with-multiple-vars-tp3438095p3441476.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.eth

[R] glm with multiple vars

2011-04-09 Thread dirknbr
I am looping through various models with different combinations of independent variables which are stored as columns in x glm(y ~ ??, data=x) How can I pass the colnames of the selected columns of x into ?? seperating them with a + ie I want to generate glm(y ~ x1 + x2, data=x) glm(y ~ x2 + x3,

[R] glm predict on new data

2011-04-06 Thread dirknbr
I am aware this has been asked before but I could not find a resolution. I am doing a logit lg <- glm(y[1:200] ~ x[1:200,1],family=binomial) Then I want to predict a new set pred <- predict(lg,x[201:250,1],type="response") But I get varying error messages or warnings about the different number