[R] Recommended way of requiring packages of a certain version?

2010-07-16 Thread Allan Engelhardt
What is the recommended way of requiring a certain version when loading a package (or, indeed, from R itself)? Perl has the require module version use module version require version use version constructs which is kind of what I am looking for (especially 'use' which is evaluated at compile t

Re: [R] aggregate(...) with multiple functions

2010-07-16 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 16.07.2010 05:02:52: > On Thu, Jul 15, 2010 at 10:45 PM, Murat Tasan wrote: > > hi all - i'm just wondering what sort of code people write to > > essentially performa an aggregate call, but with different functions > > being applied to the various column

Re: [R] FW: coeficient of determination

2010-07-16 Thread Allan Engelhardt
Try RSiteSearch("coefficient of determination") which seems to list some promising candidates. Allan On 15/07/10 16:47, Alireza Ehsani wrote: Hello there how can i calculate coefficient of determination with R? Kind regards Ali Reza Ehsani Ph.d. student [[alternative HTML version

Re: [R] Recommended way of requiring packages of a certain version?

2010-07-16 Thread Paul Hiemstra
Hi Allan, When you create an R package you can specify in the DESCRIPTION file that your package depends on a certain R version and versions of packages. For example: Package: automap Version: 1.0-7 Date: 2010/05/04 Title: Automatic interpolation package Author: Paul Hiemstra Maintainer: Pau

Re: [R] loess line predicting number where the line crosses zero twice

2010-07-16 Thread Gavin Simpson
On Fri, 2010-07-16 at 14:25 +1200, Peter Alspach wrote: > Tena koe Stephen > > You'll need to use loess(w[,"bkf_depths"]~w[,"measure"])) and predict > with a sufficiently dense sequence of w[,'measure'] to interpolate to > an 'accuracy' that meets your requirements. Actually, if I understand > yo

Re: [R] Weighted densityplot?

2010-07-16 Thread Deepayan Sarkar
On Thu, Jul 15, 2010 at 5:51 PM, Farley, Robert wrote: > I'm trying to plot a series of densities using/comparing differing weights. > I see the reference to weights and subscripts, but I don't understand how > to implement that.  My data are of the form: > > I, J, Actual, Distance, Subset, Weight

Re: [R] Creating functions of "many" arguments

2010-07-16 Thread Patrick Burns
Your specific example can just use 'prod'. The 'prod' function uses the '...' construct which I think is what you are looking for. However, in concurrence with a previous answer, it is almost surely going to be a good idea to change your way of thinking about the problem. One word in the R wor

[R] discrepancy matrix

2010-07-16 Thread nero
Hi! I want to create a discrepancy matrix. I have got a data.frame Q: number colour date 2 343b1503 3 678 g 1701 4 347b1904 5 345b2001 6 123 g 1809 Now i want to cre

Re: [R] Recommended way of requiring packages of a certain version?

2010-07-16 Thread Hadley Wickham
> So distributing code to other people is preferably done using R packages, > which gives you this option. However (as far as I am aware), note that this option is checked at package build time, not at load time. Hadley -- Assistant Professor / Dobelman Family Junior Chair Department of Statist

Re: [R] Recommended way of requiring packages of a certain version?

2010-07-16 Thread Allan Engelhardt
On 16/07/10 09:32, Paul Hiemstra wrote: Hi Allan, When you create an R package you can specify in the DESCRIPTION file that your package depends on a certain R version and versions of packages. For example: [...] Depends: R (>= 2.7.0), methods, sp (>= 0.9-4), gstat (>= 0.9-58) Thanks Paul,

Re: [R] a very particular plot

2010-07-16 Thread Hadley Wickham
On Wed, Jul 14, 2010 at 1:32 AM, Ian Bentley wrote: > I've got a couple of more changes that I want to make to my plot, and I > can't figure things out.  Thanks for all the help. > > I'm using this R script > > library(ggplot2) > library(lattice) > # Generate 50 data sets of size 100 and assign th

[R] Two Dimensional Transformation

2010-07-16 Thread Ravi Ramaswamy
Hi - I am trying to map a two dimensional area A to another two dimensional area B using a function. For instance A = {(x,y), 0https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained,

Re: [R] Two Dimensional Transformation

2010-07-16 Thread Nikhil Kaza
Unless I am missing something this should do it a<- cbind(runif(10),runif(10)) b <- cbind(a[,1]+a[,2], a[,1]/a[,2]) On Jul 16, 2010, at 7:00 AM, Ravi Ramaswamy wrote: Hi - I am trying to map a two dimensional area A to another two dimensional area B using a function. For instance A =

[R] How to transform: 4 columns into two columns stacked

2010-07-16 Thread Ralf B
I have the following data structure: n=5 mydata <- data.frame(id=1:n, x=rnorm(n), y=rnorm(n), id=1:n, x=rnorm(n), y=rnorm(n)) print(mydata) producing the following represention id x y id.1 x.1y.1 1 1 0.5326855 -2.076337031 0.7930274 -1.0530558 2 2 0.78889

Re: [R] How to transform: 4 columns into two columns stacked

2010-07-16 Thread Ted Harding
On 16-Jul-10 11:27:18, Ralf B wrote: > I have the following data structure: > > n=5 > mydata <- data.frame(id=1:n, x=rnorm(n), y=rnorm(n), id=1:n, > x=rnorm(n), y=rnorm(n)) > print(mydata) > > producing the following represention > > id x y id.1 x.1y.1 > 1 1 0.

Re: [R] How to transform: 4 columns into two columns stacked

2010-07-16 Thread Eik Vettorazzi
its maybe not as simple as Teds solution but points to a more general approach reshape(mydata,direction="long",varying=names(mydata),v.names=c("id","x","y")) Am 16.07.2010 13:27, schrieb Ralf B: > I have the following data structure: > > n=5 > mydata <- data.frame(id=1:n, x=rnorm(n), y=rnorm(n),

Re: [R] Creating Enumerated Variables

2010-07-16 Thread John Kane
I think this is simpler but still not all that clean. === xx <- structure(list(ID = 1:9, Age = c(10L, 10L, 10L, 11L, 11L, 11L, 10L, 10L, 11L), School = c(1L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 2L ), Grade = c(98L, 97L, 92L, 90L, 80L, 70L, 80L, 7

Re: [R] send out put to file in R

2010-07-16 Thread Gábor Csárdi
On Thu, Jul 15, 2010 at 6:38 PM, chakri_amateur wrote: [...] > I want to extract the largest connected component (alias sub-graph) of the > network. My input network is a large network of >1000 vertices and >15000 > arcs. From this, I want to take out only the largest cluster. > >> If you decompos

Re: [R] Creating Enumerated Variables

2010-07-16 Thread Hadley Wickham
On Thu, Jul 15, 2010 at 11:08 PM, Dennis Murphy wrote: > Hi: > > I sincerely hope there's an easier way, but one method to get this is as > follows, > with d as the data frame name of your test data: > > d <- d[order(with(d, Age, School, rev(Grade))), ] > d$Count <- do.call(c, mapply(seq, 1, as.ve

Re: [R] CART with a circular response

2010-07-16 Thread Terry Therneau
> Could anyone advise me how can I implement classification and > regression tree analyses for a circular response (angles)? Rpart allows for user-defined splitting rules. You need to define a function which is given y and an ordered x, and returns the 'goodness of split' for each split point. Y

[R] threshold in plot

2010-07-16 Thread azam jaafari
Hi   I want to draw a plot from observed and predicted data and also shows threshold and data before threshold are identified with different color from data after threshold.   Suppose: abserved data are 0 or 1 predicted data= 0 to 1 threshold=0.5   Thanks alot     [[alternative

Re: [R] Standard Error for individual patient survival with survfit and summary.survfit

2010-07-16 Thread Terry Therneau
> Can anyone tell me what is the difference between these two standard > errors and how should I interpret the confidence intervals and std.err > given these differences? help(survfit.object) will give you the answer. The std in the object is for the cumulative hazard, the printout uses a Taylor

[R] Packages built before R 2.10.0

2010-07-16 Thread Philip Whittall
Dear list, I am running R2.11.1 on 32 bit windows. I am receiving messages as follows ... > require(car) Loading required package: car Error: package 'car' was built before R 2.10.0: please re-install it The package kohonen was another example. This failure appears to be fatal and not only affec

[R] Question about KLdiv and large datasets

2010-07-16 Thread Ralf B
Hi all, when running KL on a small data set, everything is fine: require("flexmix") n <- 20 a <- rnorm(n) b <- rnorm(n) mydata <- cbind(a,b) KLdiv(mydata) however, when this dataset increases require("flexmix") n <- 1000 a <- rnorm(n) b <- rnorm(n) mydata <- cbind(a,b) KLdiv(mydata) KL se

[R] filtered back-projection

2010-07-16 Thread Kendralin Freeman
Hi List, Does R have a package that will do filtered back-projection? I'm a medical physicist trying to produce an image of a dose cloud within a phantom using software other than Matlab and wondered if R has this capability. I looked through the imaging pages on the project site but didn't see

Re: [R] Packages built before R 2.10.0

2010-07-16 Thread Duncan Murdoch
On 16/07/2010 9:50 AM, Philip Whittall wrote: Dear list, I am running R2.11.1 on 32 bit windows. I am receiving messages as follows ... > require(car) Loading required package: car Error: package 'car' was built before R 2.10.0: please re-install it The package kohonen was another example. Thi

Re: [R] Packages built before R 2.10.0

2010-07-16 Thread Philip Whittall
Hi Duncan, Many thanks for the response. I did indeed re-install car and this is what occurred ... > utils:::menuInstallLocal() package 'car' successfully unpacked and MD5 sums checked > require(candisc) Loading required package: candisc Loading required package: car Error: package 'car' was buil

Re: [R] Question about KLdiv and large datasets

2010-07-16 Thread Peter Ehlers
On 2010-07-16 7:56, Ralf B wrote: Hi all, when running KL on a small data set, everything is fine: require("flexmix") n<- 20 a<- rnorm(n) b<- rnorm(n) mydata<- cbind(a,b) KLdiv(mydata) however, when this dataset increases require("flexmix") n<- 1000 a<- rnorm(n) b<- rnorm(n) mydata<- cbin

Re: [R] Packages built before R 2.10.0

2010-07-16 Thread Duncan Murdoch
On 16/07/2010 10:41 AM, Philip Whittall wrote: Hi Duncan, Many thanks for the response. I did indeed re-install car and this is what occurred ... > utils:::menuInstallLocal() package 'car' successfully unpacked and MD5 sums checked > require(candisc) Loading required package: candisc Loading re

Re: [R] Packages built before R 2.10.0

2010-07-16 Thread Philip Whittall
I should have added that this problem is not serious under 2.10 as you only get a Warning and everything works > require(candisc) Loading required package: candisc Loading required package: car Loading required package: heplots Warning message: package 'car' was built under R version 2.9.2 and

[R] read.table input array

2010-07-16 Thread Balpo
Hello to all! I am new with R and I need your help. I'm trying to read a file which contests are similar to this: ABCTLengths 14.00.001525878918c(1,2,3) 11.00.001716613824c(1,1,4) So all the columns are numeric values, except Lengths, which is supp

[R] assign

2010-07-16 Thread linda.s
Hi. I am a beginner. What is the difference between: x<-2 and x=2 Thanks. Linda __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide co

Re: [R] Packages built before R 2.10.0

2010-07-16 Thread Duncan Murdoch
On 16/07/2010 10:51 AM, Philip Whittall wrote: I should have added that this problem is not serious under 2.10 as you only get a Warning and everything works > require(candisc) Loading required package: candisc Loading required package: car Loading required package: heplots Warning message: pa

Re: [R] Packages built before R 2.10.0

2010-07-16 Thread Philip Whittall
Hi Duncan, That fixed it. Many thanks indeed, I now know what to do if it happens again, Philip -Original Message- From: Duncan Murdoch [mailto:murdoch.dun...@gmail.com] Sent: 16 July 2010 16:00 To: Philip Whittall Cc: r-help@r-project.org Subject: Re: [R] Packages built before R 2.10

Re: [R] assign

2010-07-16 Thread Duncan Murdoch
On 16/07/2010 10:57 AM, linda.s wrote: Hi. I am a beginner. What is the difference between: x<-2 and x=2 It depends on the context. "x <- 2" always assigns the value 2 to the variable named x. Typed as an isolated command, that's what "x = 2" does too. However, when used as an argument

Re: [R] question about string handling....

2010-07-16 Thread karena
hey, guys, all these methods work perfectly. thank you!! -- View this message in context: http://r.789695.n4.nabble.com/question-about-string-handling-tp2289178p2291497.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.

[R] package for rank ordered logit

2010-07-16 Thread Suresh Singh
Is there a package in R that can run rank-ordered logit? Thanks, Suresh __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented,

[R] save plot

2010-07-16 Thread linda.s
I made a plot, but after I made a second plot, the previous plot was gone. How can I save all the plots in a file (I do not manually copy and paste them one by one)? Thanks. Linda __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo

Re: [R] save plot

2010-07-16 Thread Erik Iverson
We need to know how you're doing this, with a minimal example that we can run. Most graphics devices accept a file or filename argument, so that's one way. If you're using the pdf device, multiple plots will create multiple pages in the final output.. linda.s wrote: I made a plot, but after

[R] Simple question regarding name of column headers

2010-07-16 Thread Addi Wei
names(miceTrainSample) [1] "b_double" "KierA2""KierFlex" "Q_VSA_POS" "pID50" In the above code, how do I delete "pID50" column to store the resulting object without indicating column "5". The code below does the trick, but I wish to delete the column by specifying "-pID50" instead of "5".

[R] changing names numeric to a time series

2010-07-16 Thread Erin Hodgess
Dear R People: What is the best way to change a named numeric (in which the names are dates) to a time series, please? > str(y1) Named int [1:730] 102 145 147 120 132 125 137 103 128 130 ... - attr(*, "names")= chr [1:730] "2006-01-01" "2006-01-02" "2006-01-03" "2006-01-04" ... > Thanks in adv

[R] changing names numeric to a time series - solved

2010-07-16 Thread Erin Hodgess
Here is the original question: What is the best way to change a named numeric to a time series > str(y1) Named int [1:730] 102 145 147 120 132 125 137 103 128 130 ... - attr(*, "names")= chr [1:730] "2006-01-01" "2006-01-02" "2006-01-03" "2006-01-04" ... > y2 <- zoo(y1,order=names(y1)) Perfec

Re: [R] package for rank ordered logit

2010-07-16 Thread Tal Galili
Did you try: library(MASS) ?polr ? Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English) -

Re: [R] Simple question regarding name of column headers

2010-07-16 Thread Ista Zahn
Hi Addi, On Fri, Jul 16, 2010 at 3:22 PM, Addi Wei wrote: > > names(miceTrainSample) > [1] "b_double"  "KierA2"    "KierFlex"  "Q_VSA_POS" "pID50" > > In the above code, how do I delete "pID50" column to store the resulting > object without indicating column "5".  The code below does the trick, b

Re: [R] changing names numeric to a time series

2010-07-16 Thread Gabor Grothendieck
On Fri, Jul 16, 2010 at 11:26 AM, Erin Hodgess wrote: > Dear R People: > > What is the best way to change a named numeric (in which the names are > dates) to a time series, please? > >> str(y1) >  Named int [1:730] 102 145 147 120 132 125 137 103 128 130 ... >  - attr(*, "names")= chr [1:730] "200

[R] I need help making a data.fame comprised of selected columns of an original data frame.

2010-07-16 Thread Ted Byers
I must have missed something simple, but still, i don't know what. I obtained my basic data as follows: x <- sprintf("SELECT m_id,sale_date,YEAR(sale_date) AS sale_year,WEEK(sale_date) AS sale_week,return_type,0.0001 + DATEDIFF(return_date,sale_date) AS elapsed_time FROM `merchants2`.`risk_input`

Re: [R] discrepancy matrix

2010-07-16 Thread Wu Gong
I guess your data frame is a little different from the reference, so your as.logical doesn't work. attach(Q) FUN <- function(X, Y) {abs(X - Y)} round(outer(rank(date)[colour=="b"],rank(date)[colour=="g"],FUN) + outer(rank(number)[colour=="b"],rank(number)[colour=="g"],FUN)) detach(Q) - A

Re: [R] I need help making a data.fame comprised of selected columns of an original data frame.

2010-07-16 Thread Steve Lianoglou
Hi, First: it's kind of hard to play along w/o some reproducible data. To that end, you can paste into an email the output of: dput(moreinfo) If there are lots of rows in `moreinfo`, just give us the first ~10-20 dput(head(moreinfo, 20)) Anyway: > At this point, each row in m_id_default_res

Re: [R] Simple question regarding name of column headers

2010-07-16 Thread Erik Iverson
Anyway, I have often wished that something like new.mt.sample <- miceTrainSample[, -"pID50"] would return miceTrainSample without the pID50 column. Here are three alternative ways to do it. # Method 1: Assign NULL to the column new.mt.sample <- miceTrainsSample new.mt.sample$pID50 <- NULL # Me

Re: [R] how to skip a specific value when using apply() function to a matrix?

2010-07-16 Thread Shuhua Zhan
Hello Nikhil and Wu, Thank you very much for your reply! What I want is to calculate the student's score column-wise by ignoring the specific values such as zeros for example only using c(2,1) in column 8 in the tmp1 and generate tmp2. I changed the zeros to NAs and modified my stud fun to stude

Re: [R] read.table input array

2010-07-16 Thread jim holtman
Here is a way of creating a separate list of variable length vectors that you can use in your processing: > # read into a dataframe > x <- read.table(textConnection("ABCTLengths + 14.00.001525878918c(1,2,3) + 14.00.001525878918c(1,2,6,7,8,3) + 14

Re: [R] Simple question regarding name of column headers

2010-07-16 Thread jim holtman
subset(miceTrainSample, select = -plD50) On Fri, Jul 16, 2010 at 11:22 AM, Addi Wei wrote: > > names(miceTrainSample) > [1] "b_double"  "KierA2"    "KierFlex"  "Q_VSA_POS" "pID50" > > In the above code, how do I delete "pID50" column to store the resulting > object without indicating column "5".

Re: [R] I need help making a data.fame comprised of selected columns of an original data frame.

2010-07-16 Thread Ted Byers
Hi Steve, Thanks Here is a tiny subset of the data: > dput(head(moreinfo, 40)) structure(list(m_id = c(171, 206, 206, 206, 206, 206, 206, 218, 224, 224, 227, 229, 229, 229, 229, 229, 229, 229, 229, 233, 233, 238, 238, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251,

[R] setting up dates

2010-07-16 Thread Erin Hodgess
I have several data sets, which begin early in 2002 and run until yesterday. They do not have observations every day. For example: > xd1[1:10] 2002-02-25 2002-02-26 2002-02-28 2002-03-01 2002-03-04 2002-03-05 2002-03-07 7 8 1 9 12 3 5

[R] Toggle between the various pages for multi-page figures

2010-07-16 Thread mahesh samtani
Hello, I am a new R user having transitioned over from S-plus recently. I have a question that is probably very trivial but I am having trouble finding a solution. In S-plus, graphic pages are created as tabs when multi-page figures are created. I have shown the R code for xpose.VPC (a function wi

Re: [R] how to skip a specific value when using apply() function to a matrix?

2010-07-16 Thread Joshua Wiley
Hello, This does what you want. The simple solution is shorter but requires that there is only one value you wish to exclude (e.g., 0). The second works for any number of values you wish to exclude, but is subsequently longer. Also there is no need to create your own function to 'studentize', ?

Re: [R] package for rank ordered logit

2010-07-16 Thread Suresh Singh
My understanding is that polr will do ordered logit but I am not sure if it is also suited for rank ordered logit (or is there no such distinction) I am thinking of following two situations 1. there is an ordered response (say small,medium,large coffee) and each individual selects one of these op

Re: [R] how to skip a specific value when using apply() function to a matrix?

2010-07-16 Thread Wu Gong
Hi szhan, I think Joshua gives all you wants -- scale is a really good function. You can also make your own function work by setting an argument na.rm. tmp1[tmp1==0]<-NA student<- function(x){ x<-(x-mean(x,na.rm=T))/sd(x,na.rm=T) return (x) } tmp4<-apply(tmp1, 2, student) -

Re: [R] setting up dates

2010-07-16 Thread Gabor Grothendieck
On Fri, Jul 16, 2010 at 12:38 PM, Erin Hodgess wrote: > I have several data sets, which begin early in 2002 and run until > yesterday.  They do not have observations every day.  For example: >> xd1[1:10] > 2002-02-25 2002-02-26 2002-02-28 2002-03-01 2002-03-04 2002-03-05 2002-03-07 >         7    

Re: [R] Access web content from within R

2010-07-16 Thread Marshall Feldman
On 7/16/2010 6:00 AM, r-help-requ...@r-project.org wrote: Message: 5 Date: Thu, 15 Jul 2010 03:36:21 -0700 (PDT) From: Bart Joosen To:r-help@r-project.org Subject: [R] Access web content from within R Message-ID:<1279190181074-2289953.p...@n4.nabble.com> Content-Type: text/plain; charset=us-ascii

[R] how to collapse categories or re-categorize variables?

2010-07-16 Thread CC
I am sure this is a very basic question: I have 600,000 categorical variables in a data.frame - each of which is classified as "0", "1", or "2" What I would like to do is collapse "1" and "2" and leave "0" by itself, such that after re-categorizing "0" = "0"; "1" = "1" and "2" = "1" --- in the en

[R] Help with Sink Function

2010-07-16 Thread Addi Wei
iterations <- 100 nvars <- 4 combined <- rbind(scaleMiceTrain, scaleMiceTest) reducedSample <- combined reducedSample <- subset(reducedSample, select = -pID50) reducedSample <- subset(reducedSample, select = -id) for (i in 1:iterations) { miceSample <- sample(combined[,-c(1,2)],nvars, repl

Re: [R] Help with Sink Function

2010-07-16 Thread Erik Iverson
This is not reproducible, and does not look minimal. You'll get better answers, and probably solve many issues on your own, if you construct small examples that illustrate the same problem you're having with your real data. Addi Wei wrote: iterations <- 100 nvars <- 4 combined <- rbind(scale

Re: [R] Help with Sink Function

2010-07-16 Thread Addi Wei
Sorry about that. Still new to this... The code below should be reproducible.All R2 should just be 1, and I should write 1 to R2outputKKNN.txt 10 timesnothing is happening. Appreciate the efforts to help! for (i in 1:10) { adata = 1:5 bdata = 6:10 lm <- lm(adata

Re: [R] how to collapse categories or re-categorize variables?

2010-07-16 Thread Wu Gong
Do you want to replace specific values of a data set? df <- sample(c(0,1,2),600,replace=T) table(df) df[df==2]<-1 table(df) - A R learner. -- View this message in context: http://r.789695.n4.nabble.com/how-to-collapse-categories-or-re-categorize-variables-tp2291704p2291727.html Sent from t

Re: [R] Mathematica and R

2010-07-16 Thread David Bickel
Hi Albyn, Thank you very much for the suggestion. I managed to install Sage on Windows (via a Linux VM), but I cannot find any documentation on how to use R from Sage. Maybe I should use the web interface of Sage to avoid having to install R on the VM. Best regards, David On 10-07-14 10:2

[R] Deleting a variable number of characters from a string

2010-07-16 Thread Davis, Brian
I have a text processing problem I'm hoping someone can help me solve. This issue it this. I have a character string in which I need to delete a variable number of characters from the string. The string itself contains the number of characters to be deleted. The number of characters to be d

Re: [R] Creating Enumerated Variables

2010-07-16 Thread Dennis Murphy
Hi: Hadley's solution is certainly preferred here due to its relative simplicity. I just wanted to correct an error from my earlier post. On Thu, Jul 15, 2010 at 2:08 PM, Dennis Murphy wrote: > Hi: > > I sincerely hope there's an easier way, but one method to get this is as > follows, > with d

Re: [R] threshold in plot

2010-07-16 Thread Dennis Murphy
Hi: Here's a simple example (divide through by 10 for your case): x <- 1:10 y <- rnorm(10, x, s = 0.3) clr <- ifelse(x <= 5, 'red', 'blue') plot(x, y, col = clr) HTH, Dennis On Fri, Jul 16, 2010 at 6:08 AM, azam jaafari wrote: > Hi > > I want to draw a plot from observed and predicted data an

Re: [R] Deleting a variable number of characters from a string

2010-07-16 Thread Wu Gong
Hi Davis, Please try ??regex gsub("(\\-|\\+)([0-9]+)(\\w*)(\\w)", replacement="\\4", x) - A R learner. -- View this message in context: http://r.789695.n4.nabble.com/Deleting-a-variable-number-of-characters-from-a-string-tp2291754p2291797.html Sent from the R help mailing list archive at

Re: [R] Help with Sink Function

2010-07-16 Thread Matt Shotwell
Your code between calls to sink() does not generate any output. Hence, nothing will be diverted to the file. To illustrate this point, consider for(i in 1:10) i This produces no output. However, for(i in 1:10) print(i) produces output as expected. -Matt On Fri, 2010-07-16 at 13:34 -0400, Ad

Re: [R] Access web content from within R

2010-07-16 Thread Bart Joosen
Marsh, you are absolutely right, I forget the link to the db. Actually its a webpage for each monograph number: http://extranet.pheur.org/4DLink1/4DCGI/Web_View/mono/198 http://extranet.pheur.org/4DLink1/4DCGI/Web_View/mono/731 ... As I have a list with the numbers of interest (l<- c(198, 731,

Re: [R] how to collapse categories or re-categorize variables?

2010-07-16 Thread Dennis Murphy
Hi: See ? levels. Here's a toy example: > x <- factor(sample(0:2, 10, replace = TRUE)) > x [1] 1 2 1 0 2 2 2 2 2 1 Levels: 0 1 2 > levels(x) <- c(0, 1, 1)# Change level 2 to 1 > x [1] 1 1 1 0 1 1 1 1 1 1 Levels: 0 1 HTH, Dennis On Fri, Jul 16, 2010 at 10:18 AM, CC wrote: > I am sure t

[R] Elementary question about computing confidence intervals.

2010-07-16 Thread Ted Byers
I would have thought this to be relatively elementary, but I can't find it mentioned in any of my stats texts. Please consider the following: library(fitdistrplus) fp = fitdist(y,"exp"); rate = fp$estimate; sd = fp$sd fOneWeek = exp(-rate*7); #fraction that happens within a week - y is m

Re: [R] how to collapse categories or re-categorize variables?

2010-07-16 Thread Ista Zahn
Hi, On Fri, Jul 16, 2010 at 5:18 PM, CC wrote: > I am sure this is a very basic question: > > I have 600,000 categorical variables in a data.frame - each of which is > classified as "0", "1", or "2" > > What I would like to do is collapse "1" and "2" and leave "0" by itself, > such that after re-c

Re: [R] Dot Plot with Confidence Limits

2010-07-16 Thread Deepayan Sarkar
On Wed, Jul 14, 2010 at 10:12 AM, Neil123 wrote: > > Hi, > > I have the following dataset and I would like to create a dotplot with > confidence limits: > >        CAT1              CAT2          MEAN                 Lower > Upper > 1         1                     1            0.619              

[R] invalid factor level, NAs generated

2010-07-16 Thread Jared Stabach
I've seen a few threads about this, but none that seem to answer my problem I have a list of .txt files in a directory that I am reading into R and row binding together. I am using the following code to do so: # Directory where files are found my.txt.file.directory <- "C:/Jared/Data/Kenya/Wildeb

Re: [R] invalid factor level, NAs generated

2010-07-16 Thread Erik Iverson
I think I have identified the problem such that when I identify the structure of some of the files that I am reading in, columns are labeled as "Factors". In other files, the same columns are labeled as numeric values. Is there a way to assign the data structure to these columns in the dataf

[R] Multinomial logistic regression in complex surveys

2010-07-16 Thread Rosario Austral
Dear R-list members, I´m using the package "survey" and I need to find a function for multinomial logistic regression in a complex design. The functions that I see are only for dicotomic and ordinal variables. Thank you! Rosario Austral De: "r-help-requ...@r-

Re: [R] invalid factor level, NAs generated

2010-07-16 Thread Dennis Murphy
Hi Jared: Is it possible you're using read.table with variable names in line 1 but not using header = TRUE as an argument? HTH, Dennis On Fri, Jul 16, 2010 at 12:41 PM, Erik Iverson wrote: > > > > >> I think I have identified the problem such that when I identify the >> structure of some of t

[R] Sage and R (was: Mathematica and R)

2010-07-16 Thread Karl-Dieter Crisman
Dear David, > I managed to install Sage on Windows (via a Linux VM), but I cannot find any > documentation on how to use R from Sage. Maybe I > should use the web interface of Sage to avoid having to install R on the VM. In the Sage command line, you can type sage: r? to get some very basic in

Re: [R] make an model object (e.g. nlme) available in a user defined function (xyplot related)

2010-07-16 Thread Deepayan Sarkar
On Mon, Jul 12, 2010 at 8:16 AM, Jun Shen wrote: > Dear Deepayan, > > Thank you for taking the time to look into this issue. > > I have a data object called "Data", please find it at the end of the > message. Then I can run the code below separately in the console. [...] > ##

Re: [R] Deleting a variable number of characters from a string

2010-07-16 Thread Gabor Grothendieck
On Fri, Jul 16, 2010 at 1:59 PM, Davis, Brian wrote: > I have a text processing problem I'm hoping someone can help me solve.  This > issue it this. > >  I have a character string in which I need to delete a variable number of > characters from the string.  The string itself contains the number

Re: [R] how to skip a specific value when using apply() function to a matrix?

2010-07-16 Thread Shuhua Zhan
Hello Joshua and Wu, Thank you for your excellent solutions. Joshua - Original Message - From: "Joshua Wiley" To: "Shuhua Zhan" Cc: r-help@r-project.org Sent: Friday, July 16, 2010 12:39:22 PM GMT -05:00 US/Canada Eastern Subject: Re: [R] how to skip a specific value when using apply() f

Re: [R] Access web content from within R

2010-07-16 Thread Henrique Dallazuanna
Try this: library(XML) readHTMLTable("http://extranet.pheur.org/4DLink1/4DCGI/Web_View/mono/198";, which = 5) On Fri, Jul 16, 2010 at 4:08 PM, Bart Joosen wrote: > > Marsh, > > you are absolutely right, I forget the link to the db. > Actually its a webpage for each monograph number: > > http://

[R] sqldf modify table

2010-07-16 Thread PeterTucker
Hi - I am something of a newbie and am a little perplexed. When (trying to) modify a table I issue the following commands with subsequent errors sqldf("alter table Korea drop column code", dbname = "mydb") error in statement: near "drop": syntax error or sqldf("alter table Korea rename column

[R] Mixed Conditional Logit with nested data

2010-07-16 Thread Paul Miller
Hello Everyone,   This is my first attempt to do something in R. As a precursor to a Willingness to Pay analysis, I want to conduct a Mixed Conditional Logit analysis but am unsure how to proceed because of some nesting within my data.   Below is some data and code that illustrate what I’m t

[R] a issue about the qutation mark?

2010-07-16 Thread karena
Following is a function that I wrote (It is working well). It's a simple one, nothing complicated. The only question that I have is a qutation mark issue, I guess. # funcname <- function(trait.file){#line1 setwd('/root/sub

[R] Nested if help

2010-07-16 Thread George Coyle
Hello, I am trying to find a direct way to write a nested if of sorts to find data for a specific time range for a specific day (across a range of days) and have exhausted my abilities with the manuals I have at hand. I have a good deal of data of this approximate form: day time price 1

[R] Troubles with DBI's dbWriteTable in RMySQL

2010-07-16 Thread Ted Byers
I am feeling rather dumb right now. I created what I thought was a data.frame as follows: aaa <- lapply(split(moreinfo,list(moreinfo$m_id),drop = TRUE), fun_m_id) m_id_default_res <- do.call(rbind, aaa) print("==") m_id_default_res print("==

[R] Creating symbolic expressions in R

2010-07-16 Thread Erin
Hello, I'm trying to do some differential equation modeling in R using the package 'deSolve.' Briefly, I'm trying to use the law of mass action (the details of which aren't really important) to structure a vector of rate equation which will be passed into an ODE function and solved with associate

Re: [R] RMySQL package on 64bit R for Windows

2010-07-16 Thread abeSRT
Did you ever find a solution for this? -- View this message in context: http://r.789695.n4.nabble.com/RMySQL-package-on-64bit-R-for-Windows-tp2248726p2291892.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing

Re: [R] sqldf modify table

2010-07-16 Thread Gabor Grothendieck
On Fri, Jul 16, 2010 at 2:46 PM, PeterTucker wrote: > > Hi - I am something of a newbie and am a little perplexed.  When (trying to) > modify a table I issue the following commands with subsequent errors > > sqldf("alter table Korea drop column code", dbname = "mydb") > error in statement: near "d

Re: [R] Nested if help

2010-07-16 Thread Dennis Murphy
Hi: I'm guessing that your time variable is not defined with a class that respects (time) ordering, so your first if statement is meaningless. In the absence of further information, either create a meaningful time/date variable or at the very least, an ordered factor. Given what you've provided,

Re: [R] a issue about the qutation mark?

2010-07-16 Thread Ista Zahn
Hi Karena, On Fri, Jul 16, 2010 at 11:23 AM, karena wrote: > So, as we all know, when using "read.csv", we need to use qutation mark out > side the filename which we wanna read in. At first, for line 8, I wrote: > read.csv("trait.file"), at last line, I wrote: > funcname(folder/hyper.csv), but

Re: [R] a issue about the qutation mark?

2010-07-16 Thread MacQueen, Don
You need to understand the difference between a variable and a value. In your case that doesn't work, you are supplying a value, "trait.value". but you have no file named "trait.value". In the case that does work you are supplying a variable, trait.value, and the value contained in that variable

Re: [R] invalid factor level, NAs generated

2010-07-16 Thread Peter Ehlers
On 2010-07-16 13:38, Jared Stabach wrote: I've seen a few threads about this, but none that seem to answer my problem I have a list of .txt files in a directory that I am reading into R and row binding together. I am using the following code to do so: # Directory where files are found my.txt.f

Re: [R] invalid factor level, NAs generated

2010-07-16 Thread Jared Stabach
Yes, this is problem. Thanks for the suggestion. I had deleted the N/A values later in the script but should have taken care of them in this first step. Thanks very much Jared On Fri, Jul 16, 2010 at 4:11 PM, Peter Ehlers wrote: > On 2010-07-16 13:38, Jared Stabach wrote: > >> I've seen a f

[R] multivariate graphs, averaging on some vars

2010-07-16 Thread skan
Hello I have a table of this kind: functionx1 x2 x3 2.232 1 1 1.00 2.242 1 1 1.01 2.732 1 1 1.02 2.770 1 2 1.00 1.932 1 2 1.01 2.132 1 2 1.02 3.2

[R] how to comment off sections

2010-07-16 Thread Joshua Wiley
Hello, Is there an way to easy comment of sections of code? I was thinking something along the lines of \dontrun{ codeline 1 codeline k } but that could be used in regular script files. When I am still working on a script, I often want to being using what is done, but I would like the par

  1   2   >