Re: [R] Re ading Excel 5.0 files with RODBC?

2009-04-07 Thread Yuri Volchik
>If you have a version of Excel that will do all those things, then you >should be able to write a very short VBA macro that will do it. >Undoubtedly simpler than the route you are proposing. Thanks for reply David, i was thinking about going this route, the problem is i will have to do it o

Re: [R] how to adjust titles on sub-plots in levelplot / contour plot?

2009-04-07 Thread Dieter Menne
Mike Williamson gmail.com> writes: > I have a (relatively long) function script that generates a levelplot. > I don't want to include all of the code, so I have attached in file > "miniDataSet.csv" an example for the data set "miniDataSet" that is called > below. Thanks for providing a full

Re: [R] Newton method again

2009-04-07 Thread Rolf Turner
On 8/04/2009, at 2:31 PM, Roslina Zakaria wrote: Hi Rolf, I would like to extend the problem that I asked you before regarding the newton method using 4 functions with 4 parameters. My functions involve the modified bessel function of the first kind which I can type them without any pr

[R] "Too many elements specified" error when mob command is used

2009-04-07 Thread Bodea, Tudor D
Dear R users: I try to model-based recursive partition a dataset (~3,500 records) using the mob function from the party package (many thanks to Achim Zeileis, Torsten Hothorn, Kurt Hornik and all other contributors for this wonderful tool). In this dataset, I have two related categorical varia

Re: [R] newbie query: simple crosstabs

2009-04-07 Thread Donald Braman
Thanks for the help everyone! I'm new to vectors, and don't quite get it. This works for me: binary.vars <- c("q1", "q2", "q3", ...) apply(mydata[binary.vars], 2, tapply, mydata["male"], mean) but this doesn't: other.vars <- c("male", "race", "religion") apply(mydata[other.binary.vars], 2, ta

Re: [R] Newton method again

2009-04-07 Thread Ravi Varadhan
Hi, I do not know what your problem is, but it seems like you want to solve a system of non-linear equations. Look at the function dfsane() in the package "BB". It doesn't require you to specify jacobians. require(BB) ?dfsane Ravi. ___

[R] Newton method again

2009-04-07 Thread Roslina Zakaria
Hi Rolf, I would like to extend the problem that I asked you before regarding the newton method using 4 functions with 4 parameters.  My functions involve the modified bessel function of the first kind which I can type them without any problem. The big problem is the Jacobian matrix. I use Mapl

Re: [R] Re ading Excel 5.0 files with RODBC?

2009-04-07 Thread David Scott
On Tue, 7 Apr 2009, Yuri Volchik wrote: Hi, i'm trying to read some data from excel files but it seems that neither xlsReadWrite nor sqlFetch (RODBC) doesn't like the format (Excel 5.0). When i open the file in Excel and save it in a new format Excel 97 -2003 everything works fine. Is it possi

Re: [R] R segfaulting with glmnet on some data, not other

2009-04-07 Thread Gad Abraham
Kamalic Dan wrote: Hello R-help list, I have a piece of code written by a grad student here at BU which will segfault when using one data set, but complete just fine using another. Both sets are just text files full of real numbers. It seems like a bug within R. It could be a bug within he

[R] binary version of R 2.8.x

2009-04-07 Thread tomkur2006-takehome
Hello, Is there any binary version of R 2.8.x available for x86 Solaris 10? I need it so that I can use some R library files. I actually tried to compile the source myself, but it failed. I don't know much about how to compile source files on Solaris, and it will be great if there is a bin

Re: [R] Simulate binary data for a logistic regression Monte Carlo

2009-04-07 Thread Rolf Turner
On 8/04/2009, at 1:27 PM, Ben Bolker wrote: I agree that that the individual-level random effect is probably the issue. I played with this some today but didn't manage to resolve it -- tried JAGS/R2jags and glmer from lme4 but didn't manage to get an estimate of epsilon that matched

Re: [R] Simulate binary data for a logistic regression Monte Carlo

2009-04-07 Thread Ben Bolker
Rolf Turner-3 wrote: > > > On 8/04/2009, at 1:26 AM, jjh21 wrote: > >> >> Hello, >> >> I am trying to simulate binary outcome data for a logistic >> regression Monte >> Carlo study. I need to eventually be able to manipulate the >> structure of the >> error term to give groups of observat

[R] how to load an svm model from file

2009-04-07 Thread J Biel
Hi R-experts, I'm using the svm implentation available in the library 'e1071', to train a classifier using cross validation (...) obj = tune.svm(truth ~ ., data=examples,cost=2^(grid.cost),gamma=2^(grid.gamma),cross=k) and to save the best model into a file as ?write.svm suggests: write.svm

[R] Constrained, multiple response statistics

2009-04-07 Thread Jonathan Greenberg
R'ers: I was hoping I could get some direction on this. I have a dataset of the form: Y1,Y2,...,YM = f(X1,X2,...,XN), where N is >>> M The response data (Y1,Y2,...,YM) is frequency data, such that the sum of all Yi = 1.0. Both Xj and Yi are continuous variables. I'm trying to figure o

[R] Converting a whole dataframe (including attributes) from latin1 to UTF-8

2009-04-07 Thread Hans Ekbrand
Hi list! Short version: How do I convert a whole data.frame from latin1 encoding to utf8? I get SPSS files with latin1 encoding. My OS is GNU/Linux and the locale sv_SE.utf8, and I normally interface R with Emacs/ESS. I have used the following hack to convert a data.frame in latin1 to utf8: > Sy

Re: [R] Sequences

2009-04-07 Thread Bernardo Rangel Tura
On Tue, 2009-04-07 at 05:16 -0700, Melissa2k9 wrote: > Hi, > > I am trying to make a sequence and am using a for loop for this. I want to > start off with an initial value ie S[0]=0 then use the loop to create other > values. This is what I have so far but I just keep getting error messages. > >

Re: [R] get optim results into a model object

2009-04-07 Thread Ravi Varadhan
Gene, I agree that by using "nls" you are able to also enforce box-constraints on the betas. There is one more issue. My trick doesn't really force the sum to be 1. It is very close, but not exactly so. You can use "weights" to achieve this. Here you go: # analysis without "weights" ans2 <-

Re: [R] newbie query: simple crosstabs

2009-04-07 Thread hadley wickham
On Tue, Apr 7, 2009 at 4:41 PM, Jorge Ivan Velez wrote: > Hi Eik, > You're absolutely right. My bad. > > Here is the correction of the code I sent: > > apply(mydata[,-1], 2, tapply, mydata[,1], function(x) sum(x)/length(x)) Or more simply: apply(mydata[,-1], 2, tapply, mydata[,1], mean) Hadley

Re: [R] matrix filtering and reordering

2009-04-07 Thread Peter Alspach
Kia ora Juan ?merge HTH Peter Alspach > -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Juan Pablo Fededa > Sent: Wednesday, 8 April 2009 8:55 a.m. > To: r-help@r-project.org > Subject: [R] matrix filtering and reorderi

Re: [R] Minimum Spanning Tree

2009-04-07 Thread Gábor Csárdi
Josh, I would recommend to use a package that supports networks, e.g. igraph, but there are others as well. You can read in the data using 'read.csv()', transform it to a matrix with 'as.matrix()', and then create an igraph object from it with 'graph.adjacency()'. Then call 'minimum.spanning.tree

Re: [R] Minimum Spanning Tree

2009-04-07 Thread jpearl01
There was an error in the file... an extraneous comma. That's taken care of. however, my tree prints out an image that doesn't seem like a mst. Attached is the csv file I used... http://www.nabble.com/file/p22938299/sp_matrix.csv sp_matrix.csv I'd like it to look something like the image fil

[R] matrix filtering and reordering

2009-04-07 Thread Juan Pablo Fededa
I have two matrixes, red: a 123 c 200 d 400 e 650 g 127 f 100 and blue: a 10 b 20 c 30 d 40 e 50 f 60 g 70 is there any easy way to get the next matrix: a 10 123 b 20 0 c 30 200 d 40 400 e 50 650 f 60 100 g 70 127 i.e. to add in the third column of blue the [,2] values of red corresponding t

Re: [R] Using as.formula() with the reshape package cast

2009-04-07 Thread ryan . sheftel
Apologies, it was as.formula(), I have since found out that if you pass to cast() the formula as a character string "days ~ variable" it works. Gavin Simpson 04/07/09 03:40 PM Please respond to gavin.simp...@ucl.ac.uk To ryan.shef...@malbecpartners.com cc r-help@r-project.org Subject Re:

Re: [R] newbie query: simple crosstabs

2009-04-07 Thread Jorge Ivan Velez
Hi Eik, You're absolutely right. My bad. Here is the correction of the code I sent: apply(mydata[,-1], 2, tapply, mydata[,1], function(x) sum(x)/length(x)) Thanks for pointed this out. Best regards, Jorge On Tue, Apr 7, 2009 at 5:29 PM, Eik Vettorazzi < e.vettora...@uke.uni-hamburg.de> wro

Re: [R] get optim results into a model object

2009-04-07 Thread Gene Leynes
Very nice trick!!! Thank you! When you combine your trick with the "nls" function, you get the whole thing: #(I have also simplified the model since the first post) ### #Original Method: uses optim, but doesn't create "model": ###

Re: [R] Frequency table to histogram

2009-04-07 Thread William Dunlap
You could use rep() to turn your frequency table into a raw data vector and then call hist, which retabulates the raw data and plots the table with barplot. That is useful if you want a histogram on a courser scale than your original table. (S+'s hist() function has a freq= argument so that hist(

[R] Offset Variable in Statistical Models - Query

2009-04-07 Thread Lars Bishop
Hi, I’d appreciate your thoughts regarding the following. I’m working with an insurance data set with the objective of predicting a binary outcome (claim or not). Policyholders in the sample are not observed for equivalent time periods. I have an exposure variable that reflects the amount of tim

Re: [R] newbie query: simple crosstabs

2009-04-07 Thread Eik Vettorazzi
Hi Jorge, > apply(mydata[,-1], 2, tapply, mydata[,1], function(x) sum(x)/nrow(mydata)) will calculate the total percentages of "yes" for each sex relative to the total size, not within sex. with your data construction, the following should work #count "yes" for each sex and question cnts<-agg

Re: [R] Running an R script from Delphi 7

2009-04-07 Thread Tom Backer Johnsen
Arghh! How stupid can you (I) be. It is R.exe that is called and not RCMD.exe. Hence the program is waiting for a response to the question about saving the workspace. Tom Tom Backer Johnsen wrote: Gentlepersons: A long time ago I used to be able to start R (version 2.6.1) from a Delphi 7

Re: [R] Bonpower Crashes Trying Sparse Matrix (Igraph)

2009-04-07 Thread Gábor Csárdi
On Tue, Apr 7, 2009 at 10:46 PM, Surendar Swaminathan wrote: > Hello Gabor, > >  Thank you very much for the reply.With respect to  the cross post.I > replied to the thread that was created I must have made a mistake. And replied alternately to r-help and igraph-help. > I tried > working on the

[R] xyplot - label one line

2009-04-07 Thread alienz747
Hi All, I have a panel xyplot with 2 lines in each panel. I'd like to label one line only but don't know how to do this. The code below labels both lines. Any ideas how I could change it to show the y-values of only one of the lines? Many thanks! xyplot(apples + bananas ~ year | category, data=fr

Re: [R] Simulate binary data for a logistic regression Monte Carlo

2009-04-07 Thread Rolf Turner
On 8/04/2009, at 1:26 AM, jjh21 wrote: Hello, I am trying to simulate binary outcome data for a logistic regression Monte Carlo study. I need to eventually be able to manipulate the structure of the error term to give groups of observations a random effect. Right now I am just doing a v

Re: [R] calculate weeks for 2005 and aggregate them

2009-04-07 Thread Eik Vettorazzi
sorry, typo (diff.w<-(as.numeric(dates-st.date)+1)%/%7) should have been (diff.w<-as.numeric(dates-st.date)%/%7) Marco Helbich schrieb: Hello Eik, sorry that I contact you again, but I have still a problem with my dates. I need a numeric starting point begining at 01-08-2005 (DDMM) f

Re: [R] newbie query: simple crosstabs

2009-04-07 Thread Jorge Ivan Velez
Dear Donald, Assuming that your data is called "mydata", the first column represents the gender and the questions are the columns left, something like the following should do the job: # Some data set.seed(1) mydata <- matrix(rbinom(1000,1,p=0.5),ncol=10) colnames(mydata)<-c('sex',paste('q',1:9,sep

Re: [R] calculate weeks for 2005 and aggregate them

2009-04-07 Thread Eik Vettorazzi
ok, here we go #starting date st.date<-as.Date("01-08-2005","%d-%m-%Y") #your dates converted into Date data type dates<-as.Date(date,"%d-%m-%Y") #diff from st.date in days (diff.d<-dates-st.date) #diff in weeks (diff.w<-(as.numeric(dates-st.date)+1)%/%7) #or use explicitly built in function dif

Re: [R] Bonpower Crashes Trying Sparse Matrix (Igraph)

2009-04-07 Thread Surendar Swaminathan
Hello Gabor, Thank you very much for the reply.With respect to the cross post.I replied to the thread that was created I must have made a mistake.I tried working on the code. I have total of 5 different graphs and Bonpow function in Igraph works for 2 graphs and for the other it goes out of mem

Re: [R] Bonpower Crashes Trying Sparse Matrix (Igraph)

2009-04-07 Thread Gábor Csárdi
Nathan, please do not crosspost, it is actually lowers your chances to get a reply. Thanks. On Tue, Apr 7, 2009 at 10:20 PM, Surendar Swaminathan wrote: > Hello Gabor, > >  Thank you very much for the reply.I tried working on the code. I have > total of 5 different graphs and Bonpow function in

Re: [R] extract argument names

2009-04-07 Thread Stavros Macrakis
a1 <- "qss(x1,lambda=100)" > parse(text=a1)[[1]][[2]] x1 This will not work for length(a) != 1, so you have to explicitly map over your list, e.g. a <- paste("qss(",paste("x",1:6,sep = "") ,", lambda =100)", sep = "") > dput( lapply(a,function(x)parse(text=x)[[1]][[2]]) ) list(x1, x2, x3, x4, x5,

Re: [R] Sequences

2009-04-07 Thread Stavros Macrakis
I don't think I'm mixing up [[ and [. Perhaps my explanation wasn't perfect, but I was in fact trying to show the same differences you are showing. -s On Tue, Apr 7, 2009 at 2:01 PM, Bert Gunter wrote: > Aren't you mixing up [[ and [ ? > >> x <- 1:3 >> x[0] > integer(0) >> x[[0]]

[R] newbie query: simple crosstabs

2009-04-07 Thread Donald Braman
I've been playing around with various table tools, trying to construct a fairly simple cross-tab. It shouldn't be hard, but for some reason it turning out to be (for me). If I want to see how many men and how many women agree with a agree/disagree question (coded 1,0), I can do this: >attach(myd

[R] Minimum Spanning Tree

2009-04-07 Thread jpearl01
Hi all, I'm very new to R and read a few tutorials, however I'm having difficulty trying to figure out how to plot a minimum spanning tree. I have a csv file that contains an n-by-n matrix of distances between strains of bacteria called matrix.csv. Looks like: id,strain1, strain2,strain3 strain1

Re: [R] group by-like statement for 2-row matrix

2009-04-07 Thread Jorge Ivan Velez
Dear Hans, Try also: x <- structure(c(2, 1, 2, 1, 3, 2, 4, 1, 4, 3, 4, 3, 5, 2, 5, 1, 6, 1), .Dim = c(2L, 9L)) tapply(x[2,],x[1,],sum) #2 3 4 5 6 #2 2 7 3 1 HTH, Jorge On Tue, Apr 7, 2009 at 11:06 AM, Hans-Henning Gabriel < hanshenning.gabr...@gmail.com> wrote: > Hi, > > my problem is as foll

Re: [R] Minimum Spanning Tree

2009-04-07 Thread Gábor Csárdi
Josh, please stay on the list. Thanks. Answers below. On Tue, Apr 7, 2009 at 10:15 PM, Josh Earl wrote: > > > Gabor, > > Thanks so much for your quick reply!  I think this will do exactly what I'm > after.  I'm getting a couple errors though, one is (if I do) > D<-D[,-1] > I get the error: > Erro

Re: [R] Bonpower Crashes Trying Sparse Matrix (Igraph)

2009-04-07 Thread Surendar Swaminathan
Hello Gabor, Thank you very much for the reply.I tried working on the code. I have total of 5 different graphs and Bonpow function in Igraph works for 2 graphs and for the other it goes out of memory.It is the same case using sparse matrix. The graphs that did not work for Bonpow function in Igr

[R] Pulling data into a model

2009-04-07 Thread Crosby, Jacy R
I'm creating an ANOVA model. Is there a way to pull in consecutive columns of variables for the test? Example: aov1<-aov(y~x1+x2+REG[,2:num], data=REG) I'm not looking for interaction effects, I just want to create a model for the first few columns of variables (exact number and names will var

Re: [R] use the value of variable to quote certain elements in matrix

2009-04-07 Thread Luc Villandre
Hi Weicheng, Did you forget to add " " to index your elements? The following example works perfectly fine. test.matrix = matrix(1:4,nrow=2) ; rownames(test.matrix)=c("hi1","hi2") ; colnames(test.matrix)=c("bye1","bye2") ; test.matrix bye1 bye2 hi113 hi224 test.matrix["hi1"

Re: [R] Puzzled by an error with apply()

2009-04-07 Thread Tony Plate
One simple explanation for the error message you received is that you have a typo: 'lapply' instead of 'apply': x <- matrix(1:6, 2) apply(x, 1, sum) [1] 9 12 lapply(x, 1, sum) Error in match.fun(FUN) : '1' is not a function, character or symbol However, it's difficult to diagnose withou

Re: [R] Using as.formula() with the reshape package cast

2009-04-07 Thread Gavin Simpson
On Tue, 2009-04-07 at 09:47 -0400, ryan.shef...@malbecpartners.com wrote: > I am trying to use the "cast" function from the reshape package, where the > formula is not passed in directly, but as the result of the as.formula() > function. > > Using reshape v. 0.7.2 > > I am able to properly me

Re: [R] extract argument names

2009-04-07 Thread Dimitris Rizopoulos
one way seems to be the following: a <- paste("qss(",paste("x",1:6,sep = "") ,", lambda =100)", sep = "") all.vars(parse(text = a)) I hope it helps. Best, Dimitris roger koenker wrote: I have a vector of character strings that look like R expressions: > a <- paste("qss(",paste("x",1:6,sep

Re: [R] extract argument names

2009-04-07 Thread Patrick Burns
unlist(lapply(parse(text=a), function(x) deparse(x[[2]]))) seems to do the job. Patrick Burns patr...@burns-stat.com +44 (0)20 8525 0696 http://www.burns-stat.com (home of "The R Inferno" and "A Guide for the Unwilling S User") roger koenker wrote: I have a vector of character strings that lo

[R] use the value of variable to quote certain elements in matrix

2009-04-07 Thread weicheng wang
Hi, I want to use the value of variable to quote elements in matrix. For example, I have a matrix like:               y1   y2m1         1      2m2         3      4 where y1,y2,m1,m2 are column and row names.  I have two random character variable, say x,  that could be either  y1 or y2  and  y that

[R] extract argument names

2009-04-07 Thread roger koenker
I have a vector of character strings that look like R expressions: > a <- paste("qss(",paste("x",1:6,sep = "") ,", lambda =100)", sep = "") > a [1] "qss(x1, lambda =100)" "qss(x2, lambda =100)" "qss(x3, lambda =100)" [4] "qss(x4, lambda =100)" "qss(x5, lambda =100)" "qss(x6, lambda =100)" Tha

[R] xyplot - label one line

2009-04-07 Thread taz9
Hi All, I have a panel xyplot with 2 lines in each panel. I'd like to label one line only but don't know how to do this. The code below labels both lines. Any ideas on how I could change it to show the y-values of only one of the lines? Many thanks! xyplot(apples + bananas ~ year | category, dat

[R] problem with creating a netcdf file under script sh

2009-04-07 Thread tuatu
Hi everyone, I try to make a netcdf file which disposes a difference between 2 variables of 2netcdf files same dimension When I programmed under R, everything is ok but when I put the code under EOF of a sh script, an error occurs: "Error, passed variable has a dim that is NOT of class dim.ncdf!".

[R] HELP: Use predict for Tobit Model. How to predict values in Tobit Model???

2009-04-07 Thread newly
Hello, I am working on a Tobit Model for a consumer good, left censored with zero. Relation: Sales of product depend on price, promotion (dummy), Season(dummy) and store (dummy) Used standard Tobitmodel with package(AER) vor a 48 week period: tobitmodel<-tobit(SALE~Price+Promotion+Season+Stor

Re: [R] Sequences

2009-04-07 Thread Bert Gunter
Aren't you mixing up [[ and [ ? > x <- 1:3 > x[0] integer(0) > x[[0]] Error in x[[0]] : attempt to select less than one element > x[4] [1] NA > x[[4]] Error in x[[4]] : subscript out of bounds The docs say: "The default methods work somewhat differently for atomic vectors, matrices/arrays and f

[R] xyplot - label one line

2009-04-07 Thread alienz747
Hi All, I have a panel xyplot with 2 lines in each panel. I'd like to label one line only but don't know how to do this. The code below labels both lines. Any ideas how I could change it to show the y-values of only one of the lines? Many thanks! xyplot(apples + bananas ~ year | category, data=fr

Re: [R] group by-like statement for 2-row matrix

2009-04-07 Thread rmailbox
Another possibility is to transpose and use functions that assume the grouping is by rows, such as summaryBy in the doBy library. If you can easily work with your data this way, the code might be more clear. > library ( doBy ) > databyrows <- rbind ( c ( 2, 2, 3, 4, 4, 4, 5, 5, 6), c(1, 1, 2

Re: [R] Running an R script from Delphi 7

2009-04-07 Thread Tom Backer Johnsen
After some headscratching I found the solution. Perhaps the options for calling R has been changed. Place " CMD BATCH --no-save --silent " between the call on R and the naming of the files for input and output. Tom Tom Backer Johnsen wrote: Gentlepersons: A long time ago I used to be able

Re: [R] problem with lattice tiff or bitmap: character size and color

2009-04-07 Thread Einar Árnason
Thank you Professor Brian Ripley for very helpful comments. Using type="tiff24nc" in bitmap mostly solved my problems. However, some complicated figures still come out in greyscale with bitmap even when using type="tiff24nc". The tiff function preserves the color but reduces the character size as

Re: [R] get optim results into a model object

2009-04-07 Thread Ravi Varadhan
Hi Gene, Try the following approach using lm(): set.seed(121) x1=.04 for (i in 1:14) x1[i+1]=x1[i]*(1+rnorm(1)*.008)+.00025 x2=.08 for (i in 1:14) x2[i+1]=x2[i]*(1+rnorm(1)*.03)-.0018 x3=.01 for (i in 1:14) x3[i+1]=x3[i]*(1+rnorm(1)*.15)-.0008 b=matrix(c(0.6,0.0,0.4)) # why don't you assume a v

Re: [R] Need help in calculating studentized residuals/leve rage values of non-linear model [nls()]

2009-04-07 Thread Dieter Menne
Giam Xingli nus.edu.sg> writes: > I need the studentized residuals. In linear models, they can be computed by using rstudent( ) function, but > there seems to be no such function for nls( ) output. I darkly remember having read this message before. Homework still not done? http://markmail.org/m

Re: [R] change default output size when using Sweave

2009-04-07 Thread Dieter Menne
Mark Heckmann gmx.de> writes: > I am trying to create a graphic output in Sweave but I do not want it to be > standard size. I want the whole graphic to be 80mm of height only, just like > the viewport below. > > <>= >pushViewport(viewport(height = unit(80, "mm"))) >grid.rect() >

Re: [R] change default output size when using Sweave

2009-04-07 Thread Duncan Murdoch
On 4/7/2009 10:39 AM, Mark Heckmann wrote: I am trying to create a graphic output in Sweave but I do not want it to be standard size. I want the whole graphic to be 80mm of height only, just like the viewport below. <>= pushViewport(viewport(height = unit(80, "mm"))) grid.rect() gr

[R] survival time ties and memory issue with aalen{timereg}.

2009-04-07 Thread zoe zhang
Dear R-helpers: I am trying to use aalen{timereg} to run a model and found that it generates the following message. the data set I used is > dim(indf) [1] 1374310 #R code: fit_aalen <- aalen(Surv(durdxdeathp, die) ~ 1+factor(gender), indf) #start of error message below Non unique survival tim

[R] Comparing Sample / Population Geographic Distributions

2009-04-07 Thread Raghu Naik
I am trying to confirm that the sample is not different from the population with respect to geographical respresentation for the following data: region population sample n_total s_total 1 north 124423290771032 2 south 4333

Re: [R] strange (?) behavoir of expand.grid()

2009-04-07 Thread stefan.d...@gmail.com
Hi ya'll, thanks for pointing out the obvious ;-) I didn't think of that (and I showed it to a fellow colleague who didn't spot it either, I am going to blame her for that). Best, Stefan On Tue, Apr 7, 2009 at 4:52 PM, Karl Ove Hufthammer wrote: > stefan.d...@gmail.com: > >> I came across a

Re: [R] heatmap.2 no reordering of the columns and rows

2009-04-07 Thread Tanuja Bompada
Thanks James. That worked. Tanuja --- On Tue, 4/7/09, James W. MacDonald wrote: From: James W. MacDonald Subject: Re: [R] heatmap.2 no reordering of the columns and rows To: "Tanuja Bompada" Cc: r-help@r-project.org Date: Tuesday, April 7, 2009, 8:02 AM Hi Tanuja, Tanuja Bompada wrote: > Hi

Re: [R] Sequences

2009-04-07 Thread Gene Leynes
Not sure what you're trying to accomplish, but I think the index values are off. the first element of s is 1, not 0 Here's something that works: s<-rep(0,207) s<-as.vector(s) s[0]<-0 lambs=rep(rnorm(207)*1000) for (i in 1:(length(lambs)-1)){ s[i]<-s[i+1]-mean(lambs) } On Tue, Apr 7, 20

[R] axis values on lattice log-scale plot

2009-04-07 Thread Don McKenzie
I'm plotting the following (stripped of inessentials) xyplot(sd ~ distance | wshed,data=sdvar.df,scales=list(x=list (log=TRUE),y=list(log=TRUE))) sdvar.df is a data frame, sd and distance are numeric, wshed is an ordered factor trying to replicate the action of log="xy" in plot() The pl

[R] get optim results into a model object

2009-04-07 Thread Gene Leynes
Hello all, I have an optimization routine that is giving me good results, but the results are not in the nice "model" format like "lm". How can I get optim results into a model so that I can use the clever 'fitted', 'residuals', and 'summary' functions? Using optim is the only way that I was able

Re: [R] Sequences

2009-04-07 Thread Stavros Macrakis
On Tue, Apr 7, 2009 at 8:13 AM, Melissa2k9 wrote: > > I am trying to make a sequence and am using a for loop for this. I want to > start off with an initial value ie S[0]=0 then use the loop to create other > values. This is what I have so far but I just keep getting error messages. > R only all

[R] summary.plm error

2009-04-07 Thread Ulrich Morawetz
Dear plm Package users, I use the plm package a lot but I have not updated it for some times. Now I realized the following difficulty with the summary.plm function (demonstrated with the example from the ?plm documentation). library(plm) data("Produc", package="Ecdat") estimation_meth

[R] R segfaulting with glmnet on some data, not other

2009-04-07 Thread Kamalic Dan
Hello R-help list, I have a piece of code written by a grad student here at BU which will segfault when using one data set, but complete just fine using another. Both sets are just text files full of real numbers. It seems like a bug within R. It could be a bug within her data, but again, he

Re: [R] Sequences

2009-04-07 Thread Eik Vettorazzi
Hi Melissa, first of all in R indexes of vectors starts with 1 not with 0. So s[0]<-0 doesn't make sense here (minor second point R is also case sensitive, so S[] is not the same as s[]). Secondly rep() returns already a vector, so as.vector(s) is not necessary. Thirdly, loops are "bad" under p

[R] Europe zip code shapefiles

2009-04-07 Thread Alina Sheyman
Hi all, I'm looking for zip code shapefiles for Italy and France.Does anyone know where I might be able to find these? thank you! [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo

Re: [R] group by-like statement for 2-row matrix

2009-04-07 Thread Eik Vettorazzi
see ?aggregate m<-rbind(sample(2:6,9,replace=T),sample(1:3,9,replace=T)) aggregate(m[2,],by=list(m[1,]),sum) Hans-Henning Gabriel schrieb: Hi, my problem is as follows: I have a matrix of two rows like this: 2 2 3 4 4 4 5 5 6 1 1 2 1 3 3 2 1 1 Can I apply something like "group by" in sql? W

Re: [R] Sequences

2009-04-07 Thread David Winsemius
Think about what i-1 would be the first time though the loop. R doesn't like 0 as an index. You are going to need to decide what you consider to the the "previous value" for the first element in your vector. If you want cumulative sums, then look at the function cumsum ?cumsum On Apr 7, 2

Re: [R] Annotation rgl plot

2009-04-07 Thread Duncan Murdoch
On 4/7/2009 10:31 AM, Yuri Volchik wrote: Hi, i was wondering if there is a way to annotate rgl plot, after searching i haven't found anything suitable. I saw function text3d but was thinking more about text on the margin, so not interactive. rgl currently only sets up one coordinate system, s

Re: [R] group by-like statement for 2-row matrix

2009-04-07 Thread Luc Villandre
Hi Henning, Although there might be a better way to do this, I'd suggest (with my.matrix being the matrix you provided): complete.vector = rep(my.matrix[1,],my.matrix[2,]) ; table(complete.vector) ; Is this what you're looking for? Cheers, Luc Hans-Henning Gabriel wrote: Hi, my problem i

Re: [R] R and .net/C#

2009-04-07 Thread fayssal
It would indeed be cool to have R be able to call .NET code given all the functionality one can use with the latest version of the .NET framework. I actually make use of the MATLAB/.NET interface, and I find it quite good. Thanks for the replay. Regards, Fayssal El Moufatich Richard Cotton wrot

[R] Running an R script from Delphi 7

2009-04-07 Thread Tom Backer Johnsen
Gentlepersons: A long time ago I used to be able to start R (version 2.6.1) from a Delphi 7 program and run a script by using a procedure like the following: function StartRAndWait (CommandLine : string) : Boolean; var Proc_info: TProcessInformation; Startinfo: TStartupInfo; ExitCode:

Re: [R] Re ading Excel 5.0 files with RODBC?

2009-04-07 Thread David Winsemius
On Apr 7, 2009, at 10:04 AM, Yuri Volchik wrote: Hi, i'm trying to read some data from excel files but it seems that neither xlsReadWrite nor sqlFetch (RODBC) doesn't like the format (Excel 5.0). When i open the file in Excel and save it in a new format Excel 97 -2003 everything works f

[R] Repeated SANN values.

2009-04-07 Thread rkevinburton
I tried optim using the SANN algoithm. To start things out I tried the example of solving the "traveling salesman" problem as given in the documentation. The example works just fine. But if I comment out the line: set.seed(123) # chosen to get a good soln relatively quickly More often than not

[R] Using as.formula() with the reshape package cast

2009-04-07 Thread ryan . sheftel
I am trying to use the "cast" function from the reshape package, where the formula is not passed in directly, but as the result of the as.formula() function. Using reshape v. 0.7.2 I am able to properly melt() by data with: > molten <- melt(x, id=1:2) then I can properly cast with this:

[R] Simulate binary data for a logistic regression Monte Carlo

2009-04-07 Thread jjh21
Hello, I am trying to simulate binary outcome data for a logistic regression Monte Carlo study. I need to eventually be able to manipulate the structure of the error term to give groups of observations a random effect. Right now I am just doing a very basic set up to make sure I can recover the p

[R] change default output size when using Sweave

2009-04-07 Thread Mark Heckmann
I am trying to create a graphic output in Sweave but I do not want it to be standard size. I want the whole graphic to be 80mm of height only, just like the viewport below. <>= pushViewport(viewport(height = unit(80, "mm"))) grid.rect() grid.text("I want this viewport to be the whole

Re: [R] Using as.formula() with the reshape package cast

2009-04-07 Thread ryan . sheftel
You are correct, passing in a text string works. Thanks for a great package hadley wickham Sent by: manipul...@googlegroups.com 04/07/09 10:32 AM Please respond to manipul...@googlegroups.com To ryan.shef...@malbecpartners.com cc manipul...@googlegroups.com, r-help@r-project.org Subject Re

[R] Sequences

2009-04-07 Thread Melissa2k9
Hi, I am trying to make a sequence and am using a for loop for this. I want to start off with an initial value ie S[0]=0 then use the loop to create other values. This is what I have so far but I just keep getting error messages. #To calculate the culmulative sums: s<-rep(0,207)

Re: [R] SUM,COUNT,AVG

2009-04-07 Thread Jun Shen
Hi Karl, I mainly have data frames. summarize() does not seem to work with multiple columns from a data frame. Any suggestion? Thanks. Jun On Tue, Apr 7, 2009 at 4:49 AM, Karl Ove Hufthammer < karl.huftham...@math.uib.no> wrote: > Jun Shen: > > > summarize() can apply multiple functions to one

[R] Lattice Groups

2009-04-07 Thread Richard Weeks
Hi all, I'm trying to achieve a few things using the lattice package but am failing miserably. I am plotting side by side box plots and using a grouping variable, e.g. cols <- c("Sepal.Width", "Petal.Length", "Petal.Width") stackedData <- stack(iris[, cols]) df <- data.frame(y = stackedD

[R] group by-like statement for 2-row matrix

2009-04-07 Thread Hans-Henning Gabriel
Hi, my problem is as follows: I have a matrix of two rows like this: 2 2 3 4 4 4 5 5 6 1 1 2 1 3 3 2 1 1 Can I apply something like "group by" in sql? What I want to achieve is the some of second row for each unique entry of first row: 2 -> 2 (=1+1) 3 -> 2 4 -> 7 (=1+3+3) 5 -> 3 (=2+1) 6 -

Re: [R] R and .net/C#

2009-04-07 Thread Richard . Cotton
> There seems to be a way for calling R from .net. However, is there anyway > for calling .net/C# code from R? Something similar to the RJava package for > .net? To the best of my knowledge, there isn't at the moment. The latest release of MATLAB does though, so in the spirit of

Re: [R] political maps world maps in R, wrld_simpl

2009-04-07 Thread Roger Bivand
On Tue, 7 Apr 2009, Patrizio Frederic wrote: Roger, many thanks for your very useful suggestions. I've just produced some plot using xlim/ylim. I noticed I can only zoom in a square box. Is there any way to produce rectangular ones? What happens is that you are seeing the default square dimens

Re: [R] strange (?) behavoir of expand.grid()

2009-04-07 Thread baptiste auguie
Hi, I think it's a FAQ (== vs all.equal to test for equality), and not related to expand.grid. See ?all.equal and ?"==" You don't need which, gridd[gridd[,2]=="0.6" , ] would work fine, or more elegantly (imho), gridd <- expand.grid(x=x,y=y ) subset(gridd, factor(x) == "0.6") Hope

Re: [R] strange (?) behavoir of expand.grid()

2009-04-07 Thread Karl Ove Hufthammer
stefan.d...@gmail.com: > I came across a strange behavior of expand.grid (or at least strange to > me). > > For certain values of one of my input variables - created by seq() - I > have to use strings (e.g ==".6") to select a row of the object > created by expand.grid(), for other values numerica

Re: [R] strange (?) behavoir of expand.grid()

2009-04-07 Thread David Winsemius
http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f -- David Winsemius On Apr 7, 2009, at 10:35 AM, stefan.d...@gmail.com wrote: Hello, I came across a strange behavior of expand.grid (or at least strange to me). For certain values of one o

[R] gbm for multi-class problems

2009-04-07 Thread LWF
Dear List, I´m working on a classification problem. My response has 60 levels. I`m very interested in boosted trees like AdaBoost or gradient boosting machine as implemented in the package "gbm". Unfortunately gbm is only applicable for 2-class problems. Is anybody out there who can help m

Re: [R] SUM,COUNT,AVG

2009-04-07 Thread Karl Ove Hufthammer
Jun Shen: > I mainly have data frames. summarize() does not seem to work with multiple > columns from a data frame. Any suggestion? Thanks. summarize() *does* work with multiple columns from data frames, but the function you use must be able to do column-wise calculations. Example: with(iris, s

Re: [R] Using as.formula() with the reshape package cast

2009-04-07 Thread hadley wickham
On Tue, Apr 7, 2009 at 8:44 AM, wrote: > > I am trying to use the "cast" function from the reshape package, where the > formula is not passed in directly, but as the result of the as.formula() > function. > > Using reshape v. 0.7.2 > > I am able to properly melt() by data with: > >> molten <- mel

  1   2   >