Re: [R] read columns of quoted numbers as factors

2010-10-05 Thread Peter Dalgaard
On 10/06/2010 02:41 AM, james hirschorn wrote: > Yes, your solution of setting quote="" would read the multi-word strings > incorrectly. A more complicated version of your solution should work: First > check which columns are identified as strings, and then apply your solution > to > the remain

Re: [R] Using as.polynomial() over a matrix

2010-10-05 Thread Bill.Venables
PS ... actually, now I think about it... > as.polylist(apply(m, 1, polynom)) List of polynomials: [[1]] 1 + 5*x + 9*x^2 + 13*x^3 [[2]] 2 + 6*x + 10*x^2 + 14*x^3 [[3]] 3 + 7*x + 11*x^2 + 15*x^3 [[4]] 4 + 8*x + 12*x^2 + 16*x^3 This works with the PolynomF package because in that case the ob

Re: [R] Using as.polynomial() over a matrix

2010-10-05 Thread Bill.Venables
I was unaware of this discussion till now, so I'm not up with what's been said already. Here is how I would go about the problem I think you are trying to solve. > m <- matrix(1:16, 4, 4) > require(PolynomF) > (lop <- as.polylist(lapply(1:nrow(m), function(i) polynom(m[i,] List of polynomia

Re: [R] Question about assigning values in a matrix, conditional on column first row; how to do the loop.

2010-10-05 Thread jthetzel
Paula, Just for fun, another way: ## Create 10 by 10 example matrix set.seed(100) a <- matrix(sample(c(0,1,2),100, replace=T), nrow=10, ncol=10) a[1,] <- sample(c(0.25,0.5,0.75),ncol(a), replace=T) ## Use apply to substitiute matrix values by row b <- apply(a, 1, function(x) { row <- x row[

Re: [R] R-help

2010-10-05 Thread G. Jay Kerns
Dear Lemarian, I was going to reply to say this is how I would do (almost) the same thing with the prob package: library(prob) S <- rolldie(2, makespace = TRUE) tmp <- sim(S, ntrials = 1) with(tmp, mean(X1 == X2)) but then it occurred to me that Greg's "dice" was much faster than "sim" (plus

Re: [R] Linear Integration

2010-10-05 Thread Michael Bedward
Hi Alex, I remember that you had the discussion recently about identifying grid cells that were crossed by a line... http://tolstoy.newcastle.edu.au/R/e11/help/10/09/8431.html So, following on from those posts, for any cell crossed by a line you will know the coordinates of the cell corners and

Re: [R] Using as.polynomial() over a matrix

2010-10-05 Thread MacQueen, Don
The key is in the help page for apply. It says (in part): In all cases the result is coerced by Œas.vector¹ to one of the basic vector types before the dimensions are set, so that (for example) factor results will be coerced to a character array. So although as.polynomial() returns

Re: [R] read columns of quoted numbers as factors

2010-10-05 Thread Gabor Grothendieck
On Mon, Oct 4, 2010 at 12:39 PM, james hirschorn wrote: > Suppose I have a data file (possibly with a huge number of columns), where the > columns with factors are coded as "1", "2", "3", etc ... The default behavior > of > read.table is to convert these columns to integer vectors. > > Is there a

Re: [R] maximum matrix size if it runs with 64-bit R

2010-10-05 Thread Carrie Li
Thank you, Henrik! That makes more sense now. You mentioned that every double value needs 8 bytes. So, in R, how many decimal point, or any number smaller than, say 10^4 are considered as double value ? (Sorry I don't have any C or Java language background, and couldn't find it for R. ) I apprecia

[R] dlm package: how to specify state space model?

2010-10-05 Thread Christian Schoder
Dear r-users! I have another question regarding the dlm package and I would be very happy if someone could give me a hint! I am using the dlm package to get estimates for an endogenous rate of capacity utilization over time. The general form of a state space model is (1) b_t = G * b_t-1 + w_t

Re: [R] read columns of quoted numbers as factors

2010-10-05 Thread David Winsemius
On Oct 5, 2010, at 8:41 PM, james hirschorn wrote: Yes, your solution of setting quote="" would read the multi-word strings incorrectly. A more complicated version of your solution should work: First check which columns are identified as strings, and then apply your solution to the remain

[R] Mahalanobis distance with mixed data

2010-10-05 Thread R_help Help
Hi, I can see that there is a function for mahalanobis distance in stat package. But I'm wondering if there is any implementation that can take in a mix of ordinal data and numerical values together? If no, would you mind pointing me to some reference for a methodology to do this? Thank you in adv

Re: [R] read columns of quoted numbers as factors

2010-10-05 Thread james hirschorn
Yes, your solution of setting quote="" would read the multi-word strings incorrectly. A more complicated version of your solution should work: First check which columns are identified as strings, and then apply your solution to the remaining columns. I'm a newbie at R, but it seems to me that t

Re: [R] maximum matrix size if it runs with 64-bit R

2010-10-05 Thread Henrik Bengtsson
On Tue, Oct 5, 2010 at 5:21 PM, Carrie Li wrote: > I am sorry that it has been couple days. > I've read the website you provided below, but still don't quite know if this > is doable. > The maximum vector length is 2^31-1, so here is what I tired, and it > returned errors as below. > > > P=2 >

Re: [R] maximum matrix size if it runs with 64-bit R

2010-10-05 Thread Carrie Li
I am sorry that it has been couple days. I've read the website you provided below, but still don't quite know if this is doable. The maximum vector length is 2^31-1, so here is what I tired, and it returned errors as below. P=2 D=matrix(rep(0, P*P), nrow=P) Error: cannot allocate vector of s

Re: [R] reorder always returns "ordered"

2010-10-05 Thread Darin A. England
Yes Hmisc was loaded. Thanks for the insight. I usually pay attention to which objects get "masked" ... but reorder was not in that list. Anyway thanks. Darin On Tue, Oct 05, 2010 at 03:50:35PM -0700, Phil Spector wrote: > Is it possible that the original poster had the Hmisc package loaded? > >>

Re: [R] reorder always returns "ordered"

2010-10-05 Thread Phil Spector
Is it possible that the original poster had the Hmisc package loaded? Hmisc::reorder.factor function (x, v, FUN = mean, ...) ordered(x, levels(x)[order(tapply(v, x, FUN, ...))]) Without that package, reorder.default gets called: getAnywhere('reorder.default') A single object matching ‘reo

Re: [R] reorder always returns "ordered"

2010-10-05 Thread Joshua Wiley
> sessionInfo() R version 2.11.1 (2010-05-31) i486-pc-linux-gnu > x <- factor(1:5) > x.ro <- reorder(x, rnorm(5)) > is.ordered(x.ro) [1] FALSE > x.ro <- reorder(x, rnorm(5), ordered=FALSE) > is.ordered(x.ro) [1] FALSE On Tue, Oct 5, 2010 at 3:14 PM, Darin A. England wrote: > > Or at least is se

Re: [R] reorder always returns "ordered"

2010-10-05 Thread David Winsemius
On Oct 5, 2010, at 6:14 PM, Darin A. England wrote: Or at least is seems that way to me. It's not a big problem, but the behavior doesn't match the documentation. (I think r-help is the place to report this. ) x <- factor(1:5) is.ordered(x.ro) # should be FALSE according to ?reorder [1] TRU

Re: [R] reorder always returns "ordered"

2010-10-05 Thread Bill.Venables
R-bugs is the appropriate place to report this. It may be particular to your system. Here's what happens on mine (Windows XP, R 2.11.1) > f <- factor(1:5) > g <- reorder(f, rnorm(5)) > is.ordered(g) [1] FALSE > g [1] 1 2 3 4 5 attr(,"scores") 1 2 3 4

Re: [R] binary tree construction in R

2010-10-05 Thread Mike Marchywka
Is there a trick to posting links here or is wikipedia blocked? I see in my sent folder that I included this wikipedia link on threaded b-trees but it didn't show up in the mail i got back from the list? Sorry, I'm new to this list :) http:// en.wikipedia.org /wiki/Threaded_binary_tree ---

Re: [R] Plotting x-axis labels perpendicular to the axis

2010-10-05 Thread Bill.Venables
?par lood at the 'las' parameter. -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of ANJAN PURKAYASTHA Sent: Wednesday, 6 October 2010 8:13 AM To: r-help@r-project.org Subject: [R] Plotting x-axis labels perpendicular to the axis Hi

Re: [R] Plotting x-axis labels perpendicular to the axis

2010-10-05 Thread David Winsemius
On Oct 5, 2010, at 6:13 PM, ANJAN PURKAYASTHA wrote: Hi, The following command: axis(1, at= 1:50, labels= sampleNames(data)) produces an X-axis with 50 ticks and labels drawn from the sampleNames namespace. Problem is the labels at each tick are printed parallel to the x- axis and thus run

[R] reorder always returns "ordered"

2010-10-05 Thread Darin A. England
Or at least is seems that way to me. It's not a big problem, but the behavior doesn't match the documentation. (I think r-help is the place to report this. ) > x <- factor(1:5) > x.ro <- reorder(x, rnorm(5)) > is.ordered(x.ro) # should be FALSE according to ?reorder [1] TRUE > > x.ro <- reorder(

[R] Plotting x-axis labels perpendicular to the axis

2010-10-05 Thread ANJAN PURKAYASTHA
Hi, The following command: axis(1, at= 1:50, labels= sampleNames(data)) produces an X-axis with 50 ticks and labels drawn from the sampleNames namespace. Problem is the labels at each tick are printed parallel to the x-axis and thus run into each other. How do I specify for the labels to be printed

Re: [R] binary tree construction in R

2010-10-05 Thread Mike Marchywka
> Date: Tue, 5 Oct 2010 14:57:40 -0700 > From: matl...@cs.ucdavis.edu > To: r-help@r-project.org > Subject: Re: [R] binary tree construction in R > > MK wrote: > > > Hi all, > > > > I'm very new to R and I'm trying to construct a threaded binary tree

Re: [R] binary tree construction in R

2010-10-05 Thread Norm Matloff
MK wrote: > Hi all, > > I'm very new to R and I'm trying to construct a threaded binary tree using > recursive functions. > > I'm very confused was wondering if anyone had any R sample code they would > share. I've come across a lot of C++ code(nothing in R) and this is not > helping. > > best,

Re: [R] loess with missing data points

2010-10-05 Thread Gavin Simpson
On Tue, 2010-10-05 at 13:56 -0700, 1Rnwb wrote: > Hello List, > I have a longitudinal samples on multiple individuals, for initial analysis, > i am doing some plots to see how the variable changes with the age. In some > of the individuals one or two data points are missing, >IL1Ra

Re: [R] Subset POSIXlt Field

2010-10-05 Thread Ryan Garner
This should work: > test <-subset(wild,ID=="2830" & Date==as.POSIXlt("2010-08-17")) If not, here's another solution: > dates <- c("2010-05-28","2010-08-17") > dates <- as.POSIXlt(dates) > id <- c("2830","2830") > data <- data.frame(id,dates) > test <- data[data$id == "2830" & data$dates == as.POS

Re: [R] problems installing R (Matteo)

2010-10-05 Thread Phil Spector
If you are refering to the file GRASS_0.3-9.tar.gz which you may have downloaded from a CRAN archive, then you normally do not need to decompress and untar it. Type R CMD INSTALL GRASS_0.3-9.tar.gz at the command line (with the working directory set to where you've downloaded the file.) Even b

[R] loess with missing data points

2010-10-05 Thread 1Rnwb
Hello List, I have a longitudinal samples on multiple individuals, for initial analysis, i am doing some plots to see how the variable changes with the age. In some of the individuals one or two data points are missing, IL1Ra Age.at.Sample.Collection Subject.ID 6.575

[R] problems installing R (Matteo)

2010-10-05 Thread ciccp...@libero.it
Hi everybody, I'm quite new to ubuntu and tar.gz packages, anyway following these instructions https://help.ubuntu.com/community/CompilingEasyHowTo I tried to install the R Grass package. Everything worked nice until I did: $ ./configure checking for gcc... gcc -std=gnu99 checking for C comp

Re: [R] input matrix for leaps algorithm

2010-10-05 Thread CZ
The regsubsets does work. I also notice the bestglm, will see how it work too. Thank you. -- View this message in context: http://r.789695.n4.nabble.com/input-matrix-for-leaps-algorithm-tp2954453p2956866.html Sent from the R help mailing list archive at Nabble.com.

[R] Fw: Re: R editor in ubuntu!

2010-10-05 Thread Mehdi Zarrei
Hello friends, I would like to thank you all for your advices. Rcmdr is gread. All the best, Mehdi * Mehdi Zarrei, PhDPostdoctoral fellowUniversity of Toronto Dept. of Ecology & Evolutionary Biology Royal Ontario Museum Department of Natural Histo

Re: [R] Non-Parametric Adventures in R

2010-10-05 Thread Jamesp
Thanks for the feedback, this is really helpful. 4) Your solution works like a charm. I opted for reference by column number since I had so many. ynFields = c(12:22,58:229) ynLabel = c("No","Yes") X[ynFields] <- lapply(X[ynFields], factor, levels=0:1, labels=ynLabel) whenFields = c(24:56) when

Re: [R] Subset POSIXlt Field

2010-10-05 Thread Phil Spector
Jared - The value "2010-08-17" is a character value, and your dates are stored as POSIXlt values. So you'd need to use Date == as.POSIXlt("2010-08-17") in your subset statement. - Phil Spector Statistic

[R] Subset POSIXlt Field

2010-10-05 Thread Jared Stabach
Hello All I, for the life of me, can't figure out to subset my dataframe by my Date field. The field has been formatted as POSIXlt. str(wild) .. $ Date: POSIXlt, format: "2010-05-28" "2010-05-28" "2010-05-28" ... This doesn't work: test <-subset(wild,ID=="2830" & Date=="2010-08-17"

Re: [R] Combinations

2010-10-05 Thread Jonathan Christensen
Hi, On Tue, Oct 5, 2010 at 3:52 AM, Trying To learn again wrote: > > Hi all, > > Reading more I have find a partial solution on a part of the proble in some > part of the code it should appea something like: > > # NC: All the potential combinations 3^15 > > if > > NC[price(i,j)=="1" & price(i,j)=

Re: [R] optimization w.r.t matrix

2010-10-05 Thread David Winsemius
On Oct 5, 2010, at 2:46 PM, QiJun Fung wrote: Does any one know how to optimize the following function w.r.t to beta? The difficulty here is the beta is a matrix not a vector. and f is also a function of beta and an element of the objective function. I just want to know for this complicated sit

Re: [R] loess and NA

2010-10-05 Thread Filoche
Thank you for your help! -- View this message in context: http://r.789695.n4.nabble.com/loess-and-NA-tp2956235p2956518.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/list

[R] optimization w.r.t matrix

2010-10-05 Thread QiJun Fung
Does any one know how to optimize the following function w.r.t to beta? The difficulty here is the beta is a matrix not a vector. and f is also a function of beta and an element of the objective function. I just want to know for this complicated situation, is there any packages or function to estim

Re: [R] can't compile R on CentOS 64bit (bad interpreter: Permission denied)

2010-10-05 Thread Patrick Connolly
On Sat, 02-Oct-2010 at 11:07PM +0400, Aleksey Noskov wrote: |> Hello, I am new in R |> |> I try to build R on CentOS 64bit. *./configure --prefix=$HOME/soft *executed |> without any errors. But make command print that error: I use R on CentOS without root permission. It's always worked if I ru

Re: [R] How to convert a list to a ... argument for a function

2010-10-05 Thread Charles C. Berry
On Tue, 5 Oct 2010, Richard R. Liu wrote: Hi, I have a function f <- function(..., func){ something }, where func is a function of the form function(...). ??I would like to pass func all the arguments passed to f except the last. ??I know that I can manipulate the variable number of arguments

Re: [R] How to convert a list to a ... argument for a function

2010-10-05 Thread Duncan Murdoch
On 05/10/2010 2:23 PM, Richard R. Liu wrote: Hi, I have a function f<- function(..., func){ something }, where func is a function of the form function(...). I would like to pass func all the arguments passed to f except the last. I know that I can manipulate the variable number of arguments

[R] How to convert a list to a ... argument for a function

2010-10-05 Thread Richard R. Liu
Hi, I have a function f <- function(..., func){ something }, where func is a function of the form function(...).  I would like to pass func all the arguments passed to f except the last.  I know that I can manipulate the variable number of arguments passed to f by converting ... to a list, i.e.,

Re: [R] estimate intrinsic dimension

2010-10-05 Thread Jack Siegrist
Someone said that I need to define "intrinsic dimensionality" in my question. Basically, this is the topological dimension of a set of points that are represented in a space of possibly higher dimension. For example, your data might describe a corkscrew line through a 30-dimensional space (you mea

Re: [R] reshape not using as id vars what it is supposed to be using?

2010-10-05 Thread Dimitri Liakhovitski
Thank you, Ista! you are right - in the paper I was refering to it's "measured" but in ?melt it's measure.vars! Dimitri On Tue, Oct 5, 2010 at 12:17 PM, Ista Zahn wrote: > Hi Dimitri, > The argument names may have changed. Notice that > > melt.data.frame(smiths, measured = c("age", "weight", "h

Re: [R] R doesn't want to update packages (Windows 7)

2010-10-05 Thread Dimitri Liakhovitski
I meant to say "took me" On Tue, Oct 5, 2010 at 1:01 PM, Dimitri Liakhovitski wrote: > BTW - I did not install it in any special Windows area - I installed > it wherever the default too me. > > On Tue, Oct 5, 2010 at 11:42 AM, Prof Brian Ripley > wrote: >> See >> http://cran.r-project.org/bin/wi

Re: [R] R doesn't want to update packages (Windows 7)

2010-10-05 Thread Dimitri Liakhovitski
BTW - I did not install it in any special Windows area - I installed it wherever the default too me. On Tue, Oct 5, 2010 at 11:42 AM, Prof Brian Ripley wrote: > See > http://cran.r-project.org/bin/windows/base/rw-FAQ.html#Does-R-run-under-Windows-Vista_003f > > which does cover this.  Most likely

Re: [R] R doesn't want to update packages (Windows 7)

2010-10-05 Thread Dimitri Liakhovitski
Correct - only to update packages, not for regular use. Thanks a lot for the references! Dimitri On Tue, Oct 5, 2010 at 12:29 PM, Henrik Bengtsson wrote: > Just to clarify to the OP (and please correct me if I'm wrong), > > having to run as admin should only be needed when you have to *update* >

Re: [R] loess and NA

2010-10-05 Thread Gavin Simpson
On Tue, 2010-10-05 at 08:11 -0700, Filoche wrote: > Hi everyone. > > I'm trying to do a loess with missing value on independant variable. > > > > doc = c(2.27904, 2.59536, 7.44696, NA, 6.24264, 4.58400, 5.79192, 5.39502, > 7.41216, 4.09440, 4.22868, 4.24620, 5.43804, 1.95528); > distance = c(26

Re: [R] R editor in ubuntu!

2010-10-05 Thread Kjetil Halvorsen
Forgot ... The best thing with emacs , it that it has modes for close to everything, so you don'nt need to learn new editors for whatever strange projecy you start. By the way, i installed eclipse to try it out. It is way of biggish... Kjetil On Tue, Oct 5, 2010 at 12:30 PM, Kjetil Halvorsen wr

Re: [R] Question about assigning values in a matrix, conditional on column first row; how to do the loop.

2010-10-05 Thread Thomas Stewart
Paula- Look at this example. R in this case is your data matrix. -tgs R<-matrix(sample(0:2,100,replace=T),nrow=10) R[1,]<-round(runif(10),3) f<-function(x){ show(x) y<-x[-1] y[y!=2]<--999 y[y==2]<-x[1] c(x[1],y) } apply(R,2,f) On Tue, Oct 5, 2010 at 11:54 AM, Paula Fergnani Salvi

Re: [R] R editor in ubuntu!

2010-10-05 Thread Kjetil Halvorsen
I really like emacs+ess, so getting that to work again is the preferred solution... Kjetil On Tue, Oct 5, 2010 at 11:50 AM, Erik Iverson wrote: > >> Another alternative is to use Geany [1]. It would save you the trouble >> of learning Emacs, > > /s/save/deprive > /s/trouble/thrill > > :) > > ___

Re: [R] R doesn't want to update packages (Windows 7)

2010-10-05 Thread Henrik Bengtsson
Just to clarify to the OP (and please correct me if I'm wrong), having to run as admin should only be needed when you have to *update* (update.packages()) the so called recommend packages (comes with R) that sits under 'Program Files'. If you don't run as admin and try to *install* (install.pack

[R] estimate intrinsic dimension

2010-10-05 Thread Jack Siegrist
Does anyone know of any packages or have any loose code for estimating the intrinsic dimension of a data set? Thanks for any leads, Jack -- View this message in context: http://r.789695.n4.nabble.com/estimate-intrinsic-dimension-tp2956401p2956401.html Sent from the R help mailing list archive

Re: [R] SVM functions

2010-10-05 Thread Uwe Ligges
On 05.10.2010 18:19, Neeti wrote: It would be nice if you suggest me the steps to check whether svmlight is present in my system or not? If you have not installed it, it is probably not present yet. How to check it: Well, that depends on your OS that is unstated so far. Asking a search en

Re: [R] Read file

2010-10-05 Thread Nilza BARROS
Dear Gabor and Jim You both gave me amazing solutions. I will use. Thanks! Nilza On Tue, Oct 5, 2010 at 2:11 AM, Gabor Grothendieck wrote: > On Sat, Oct 2, 2010 at 11:31 PM, Nilza BARROS > wrote: > > Dear R-users, > > > > I would like to know how could I read a file with different lines > length

Re: [R] SVM functions

2010-10-05 Thread Neeti
It would be nice if you suggest me the steps to check whether svmlight is present in my system or not? -- View this message in context: http://r.789695.n4.nabble.com/SVM-functions-tp2955768p2956384.html Sent from the R help mailing list archive at Nabble.com. ___

Re: [R] Error during scp transfer

2010-10-05 Thread Uwe Ligges
We really cannot help to solve your ssh problems. Uwe Ligges On 04.10.2010 18:06, wesley mathew wrote: Dear all I am implement one grid computing system using GridR package. I am working on windows platform. I did all the configuration according to the GridR tutorial. But it has some errors

Re: [R] reshape not using as id vars what it is supposed to be using?

2010-10-05 Thread Ista Zahn
Hi Dimitri, The argument names may have changed. Notice that melt.data.frame(smiths, measured = c("age", "weight", "height")) gives a message saying "Using subject as id variables". This is because measured variables need to be specified as measure.vars (or an abbreviation of that: even m will wo

Re: [R] Question about assigning values in a matrix, conditional on column first row; how to do the loop.

2010-10-05 Thread jim holtman
try this: > matr [,1] [,2] [1,] 0.1 0.5 [2,] 1.0 1.0 [3,] 0.0 2.0 [4,] 2.0 2.0 > result <- apply(matr[-1,], 1, function(.row){ + ifelse(.row == 2, matr[1,], -999) + }) > # data back together > rbind(matr[1,], t(result)) [,1] [,2] [1,]0.10.5 [2,] -999.0 -999.0 [3,]

Re: [R] SVM functions

2010-10-05 Thread Uwe Ligges
Probably you do not have svmlight installed on your machine. Uwe Ligges On 05.10.2010 12:42, Neeti wrote: Hi ! Right now I am learning to use svm functions available in R and trying to use these function with given example. I was stuck with svmlight function which is available in klaR pac

Re: [R] nonlinear curve fit of an implicit function

2010-10-05 Thread Ravi Varadhan
Note that we now have a constrained optimization problem in (n + 3) variables: y, A, B, and C; but we also have `n' constraints among these n+3 variables. Ravi. Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric M

Re: [R] R-help

2010-10-05 Thread Greg Snow
I would do it like this: library(TeachingDemos) tmp <- dice(1, 2) with(tmp, c(sum(Red==Green),mean(Red==Green)) ) plot(head(tmp,28)) -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Original Message- > From: r-h

Re: [R] r-help@r-project.org

2010-10-05 Thread Uwe Ligges
On 05.10.2010 17:51, Erik Iverson wrote: 1) Please use an informative subject line 2) The answer may depend on the package, and can be easy to difficult. Which package are you trying to install? In any case, the answer is in the manual "R Installation and Administration". Uwe Ligges w

[R] Question about assigning values in a matrix, conditional on column first row; how to do the loop.

2010-10-05 Thread Paula Fergnani Salvia
Hello, I’m new at programming and I will greatly appreciate if you can help me with this. I have a very large matrix (hundreds of rows and columns), with the first raw filled with different numbers (between 0 and 1). The rest of the matrix is filled with values 0, 1, 2. What I need is to repl

Re: [R] Ordering Duplicates for Selection

2010-10-05 Thread jim holtman
Here is a way of putting "Order" on your data: > x V1 V2 V3 V4 V5 1 1 12345678 Soc101 34 02-04-2003 2 2 12345678 Soc101 62 31-11-2004 3 3 12345678 Psy104 63 03-05-2003 4 4 23456789 Soc101 73 02-04-2003 5 5 23456789 Psy104 76 25-02-2004 > x$order <- ave(x$V1, x$V2, x$V3, FU

Re: [R] r-help@r-project.org

2010-10-05 Thread Erik Iverson
1) Please use an informative subject line 2) The answer may depend on the package, and can be easy to difficult. Which package are you trying to install? wenyue sun wrote: *Dear All, * ** *I want to install tar.gz in R on a Windows operating system. I know that R in Win accepts packages in

Re: [R] R editor in ubuntu!

2010-10-05 Thread Erik Iverson
Another alternative is to use Geany [1]. It would save you the trouble of learning Emacs, /s/save/deprive /s/trouble/thrill :) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http:

Re: [R] is there a way to avoid "traveling" grid?

2010-10-05 Thread Dimitri Liakhovitski
Thierry, your ggplot solution really looks great and very parsimonious! May I ask a couple of questions? 1. Is there a way to make the grid appear on top of the colored areas instead of under them - like I did in the plot solution? 2. In your code line Molten2$variable <- factor(Molten2$variable, l

[R] instal tar.gz package on windows, help

2010-10-05 Thread wenyue sun
*Dear All, * ** *I want to install a tar.gz package in R on a windows operating system. Since R in Windows accepts only packages in zip file for installation, I tried to decompress the tar.gz file and create a zip file using 7 zip for a subsequent installation, yet this didn't work. Can anyone hel

[R] r-help@r-project.org

2010-10-05 Thread wenyue sun
*Dear All, * ** *I want to install tar.gz in R on a Windows operating system. I know that R in Win accepts packages in zip file for installation. Therefore, I**tried to decompress the tar.gz file and create a zip file using 7zip but the installation of the resulting zip files didn't work. Can an

Re: [R] R editor in ubuntu!

2010-10-05 Thread Liviu Andronic
On Tue, Oct 5, 2010 at 4:52 PM, Mehdi Zarrei wrote: > I am looking for an editor to be able to execute commands into R in Linux > ubuntu. Is there any suggestion? > There is a wiki page on the subject [1]. Everyone: Please contribute your favorite editor to that list. Regards Liviu [1] http://

Re: [R] nonlinear curve fit of an implicit function

2010-10-05 Thread Ravi Varadhan
You can solve this as a (nonlinearly) constrained optimization problem: Given: x, y.obs; both in R^n Minimize the objective function: sum( (y - y.obs)^2 ) where `y' is such that it satisfies the constraints: (A+B+C)*log((B+C+y)/C)-A*log((B-y)/B)=(B+C)*D*x Do you have other constraints on A,

Re: [R] R doesn't want to update packages (Windows 7)

2010-10-05 Thread Prof Brian Ripley
See http://cran.r-project.org/bin/windows/base/rw-FAQ.html#Does-R-run-under-Windows-Vista_003f which does cover this. Most likely you need to 'Run as Administrator'. There's lot of other useful information in that FAQ that you would do to familiarize yourself with. On Tue, 5 Oct 2010, Dim

Re: [R] R editor in ubuntu!

2010-10-05 Thread Liviu Andronic
On Tue, Oct 5, 2010 at 5:43 PM, Christopher W Ryan wrote: > As an alternative to emacs-ess, you could try gedit with the R plugin. > Another alternative is to use Geany [1]. It would save you the trouble of learning Emacs, and I find it better designed for code editing than Gedit. If you're a begi

[R] Ordering Duplicates for Selection

2010-10-05 Thread C C
Hi all, I've found a lot of helpful info regarding identifying and deleting duplicates but I'd like to do something a little different - I'd like to identify the duplicate values but instead of deletion, label them with a value. I am working with historical data regarding school courses:

Re: [R] Make a loop more efficient

2010-10-05 Thread Filoche
Hi there. One more thing you could try is to avoid evaluation of length(CRX) every loop. Assign the length to a variable before the loop. Regards, Phil -- View this message in context: http://r.789695.n4.nabble.com/Make-a-loop-more-efficient-tp2955912p2956274.html Sent from the R help mailing

[R] loess and NA

2010-10-05 Thread Filoche
Hi everyone. I'm trying to do a loess with missing value on independant variable. doc = c(2.27904, 2.59536, 7.44696, NA, 6.24264, 4.58400, 5.79192, 5.39502, 7.41216, 4.09440, 4.22868, 4.24620, 5.43804, 1.95528); distance = c(26.5,56.5, 90.3, 123.0, 147.5, 176.0, 215.7, 229.3, 252.0, 325.3, 362

Re: [R] R-help

2010-10-05 Thread Mike Marchywka
> Date: Tue, 5 Oct 2010 08:18:10 -0700 > From: djmu...@gmail.com > To: tott...@yahoo.com > CC: r-help@r-project.org > Subject: Re: [R] R-help > > Hi: > > This problem is a useful lesson in the power of vectorizing calculations in > R. > > A remanufactu

[R] reshape not using as id vars what it is supposed to be using?

2010-10-05 Thread Dimitri Liakhovitski
Hellow! I am replicating the example givien in "Reshaping Data with the reshape Package" (http://www.jstatsoft.org/v21/i12 - see "download" link on the right), p. 2-3. library(reshape) data(smiths) str(smiths) The text says: "If you specify only one of measured and identifier variables, melt ass

Re: [R] Extract summary stats to table

2010-10-05 Thread Greg Snow
Write a function that does your analysis and returns the values of interest in a vector. Then run the function multiple times using replicate or sapply and the results will be put into a matrix for you. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@

Re: [R] is there a way to avoid "traveling" grid?

2010-10-05 Thread ONKELINX, Thierry
Dear Dimitri, Ggplot2 solves your problem with the gridlines and requires much less code. You only need to reshape your data somewhat. library(ggplot2) #changing the dataset my.data2 <- my.data my.data2$x <- my.data$x + my.data$a my.data2$z <- my.data$y + my.data$z Molten2 <- melt(my.data2, id.va

Re: [R] R-help

2010-10-05 Thread Dennis Murphy
Hi: This problem is a useful lesson in the power of vectorizing calculations in R. A remanufacturing of your function: dubloop <- function(nsim) { count <- 0 for(j in 1:nsim){ #begin loop die1 <- sample(1:6,1) die2 <- sample(1:6,1) if(die1 ==

Re: [R] is there a way to avoid "traveling" grid?

2010-10-05 Thread Dimitri Liakhovitski
Barry - thanks a lot, it's great. Now, the gridlines "stick" to the tick marks! Just wondering why the product of "grid" does not. D. On Tue, Oct 5, 2010 at 11:07 AM, Barry Rowlingson wrote: > On Tue, Oct 5, 2010 at 3:37 PM, Dimitri Liakhovitski > wrote: >> my.data$date > > I wouldn't use grid -

Re: [R] adding a legend to the plot (but outside of it)

2010-10-05 Thread Dimitri Liakhovitski
THanks a lot, Thomas - I am 100% clear on the legend symbol now, very helpful. With legend colors - I just tried to have more colors in all.colors than there are variables to plot on the graph. Did it on purpose - so that there are always more colors to pick from. But if I do names(my.data) - then

[R] nonlinear curve fit of an implicit function

2010-10-05 Thread Schmitt, H. (Heike)
Hello, I want to perform a nonlinear curve fit in order to obtain parameter estimates from experimentally determined data (y in dependence of x), but with an implicit function, thus, a function of which I cannot isolate y on the left-hand side of the equation. As far as I understand, the function

Re: [R] is there a way to avoid "traveling" grid?

2010-10-05 Thread Barry Rowlingson
On Tue, Oct 5, 2010 at 3:37 PM, Dimitri Liakhovitski wrote: > my.data$date I wouldn't use grid - it suggests you try abline, so something like: > abline(v=my.data$date,lty=2) - to put vertical lines at your data points. For the horizontal grid lines, we can just use the axis tick marks: > a

Re: [R] adding a legend to the plot (but outside of it)

2010-10-05 Thread Thomas Stewart
Dimitri- Regarding question 1, it is the pch argument that controls the legend symbol. In my configuration, pch=15 gives a colored, filled-in box. To see the possible pch symbols, run the following code: plot(0,0,xlim=c(0,9), ylim=c(0,9),type="n", axes=F,xlab="",ylab="") for(i in 0:9){ for(j in

Re: [R] R editor in ubuntu!

2010-10-05 Thread peter dalgaard
On Oct 5, 2010, at 16:29 , Kjetil Halvorsen wrote: > see below. > > On Tue, Oct 5, 2010 at 10:25 AM, Laurent Gatto > wrote: >> Dear Kjetil, >> >> On 5 October 2010 15:12, Kjetil Halvorsen >> wrote: >>> emacs23+ess is great BUT there is a very large problem which is >>> driving me away from i

Re: [R] R editor in ubuntu!

2010-10-05 Thread Laurent Gatto
On 5 October 2010 15:29, Kjetil Halvorsen wrote: > see below. > > On Tue, Oct 5, 2010 at 10:25 AM, Laurent Gatto > wrote: >> Dear Kjetil, >> >> On 5 October 2010 15:12, Kjetil Halvorsen >> wrote: >>> emacs23+ess is great BUT there is a very large problem which is >>> driving me away from it: >>

Re: [R] R editor in ubuntu!

2010-10-05 Thread Christopher W Ryan
As an alternative to emacs-ess, you could try gedit with the R plugin. --Chris Ryan I am looking for an editor to be able to execute commands into R in Linux ubuntu. Is there any suggestion? [[alternative HTML version deleted]] __ R-help

[R] is there a way to avoid "traveling" grid?

2010-10-05 Thread Dimitri Liakhovitski
Hello! If you run the whole code below, it'll produce a stacked diagram. And it looks good - because the tick-marks are aligned with the grid. However, if I stretch the graph window, grid becomes misaligned with the tickmarks. Or, rather, it seems aligned for the first and the last tick mark, but

Re: [R] adding a legend to the plot (but outside of it)

2010-10-05 Thread Dimitri Liakhovitski
Thanks a lot, Thomas. May I ask 2 questions: 1. Is there a way to "fill" the legend rectangles with color (currently, they just contain a colored cross)? 2. Currently, my graph grabs the colors automatically (as I loop through var, it grabs col=all.colors[which(names(my.data) %in% var)]. I am wond

[R] Linear Integration

2010-10-05 Thread Alaios
Hello I would like to calculate a weighted line integral. The integral is calculated by the cells that this lines trasverses (the small cells belong to matrix (m*n) that represent the value that a specific area has. I need to calculate the weights by finding out how much the line touches or i

Re: [R] R editor in ubuntu!

2010-10-05 Thread Kjetil Halvorsen
see below. On Tue, Oct 5, 2010 at 10:25 AM, Laurent Gatto wrote: > Dear Kjetil, > > On 5 October 2010 15:12, Kjetil Halvorsen > wrote: >> emacs23+ess is great BUT there is a very large problem which is >> driving me away from it: >> (on ubuntu) since version 23, emacs has a very problematic bug,

Re: [R] R doesn't want to update packages (Windows 7)

2010-10-05 Thread Dimitri Liakhovitski
Thnaks a lot, Duncan! Running R as administrator solved the problem! Dimitri On Tue, Oct 5, 2010 at 9:07 AM, Duncan Murdoch wrote: >  On 05/10/2010 8:58 AM, Dimitri Liakhovitski wrote: >> >> Hello! >> >> I've just installed R 2.11.1 on my new home PC. Just the base R. My PC >> has Windows 7. >> R

Re: [R] R editor in ubuntu!

2010-10-05 Thread Laurent Gatto
Dear Kjetil, On 5 October 2010 15:12, Kjetil Halvorsen wrote: > emacs23+ess is great BUT there is a very large problem which is > driving me away from it: > (on ubuntu) since version 23, emacs has a very problematic bug, which > I have reported as: > > bug#6193: emacs 23 in ubuntu 10.04 gnu linux

Re: [R] Introducing lags in my GAM

2010-10-05 Thread Simon Wood
I think that the problem is probably that y and lag(y,k=1) just get coerced back to numeric (i.e. their time-series attributes ar lost). So your model formula is equivalent to y~ + y, which is probably not what you wanted. If y is in time order, I would do something like bellver$y.1 <- c

  1   2   >