Re: [R] survplot() for cph(): Design vs rms

2011-08-25 Thread array chip
Thanks Frank! - Original Message - From: Frank Harrell To: r-help@r-project.org Cc: Sent: Thursday, August 25, 2011 4:33 PM Subject: Re: [R] survplot() for cph(): Design vs rms http://biostat.mc.vanderbilt.edu/Rrms shows differences between Design and rms Frank array chip wrote: > >

[R] excluding models during dredge and model averaging in MuMIn

2011-08-25 Thread Andrew MacIntosh
Dear R Users, I am using the package "MuMIn" to sort through models, with the goal of estimating parameters through model averaging of the candidate set. I have been using the dredge function to build all possible models based on my starting point (hypothetical global model). I see that there is a

Re: [R] How to find the accuracy of the predicted glm model with family = binomial (link = logit)

2011-08-25 Thread Noah Silverman
Andra, Two common methods are the AUC (area under the curve) and the Log Likelihood. The ROCR package has several nice functions for evaluating the accuracy of your model -- Noah Silverman UCLA Department of Statistics 8117 Math Sciences Building Los Angeles, CA 90095 On Aug 25, 2011, at 9:58

[R] How to find the accuracy of the predicted glm model with family = binomial (link = logit)

2011-08-25 Thread Andra Isan
Hi All, When modeling with glm and family = binomial (link = logit) and response values of 0 and 1, I get the predicted probabilities of assigning to my class one, then I would like to compare it with my vector y which does have the original labels. How should I change the probabilities into v

Re: [R] Sharp turn in cdf?

2011-08-25 Thread Jim Silverton
x = c(runif(1000, 0,2.5), runif(100, 2.5, 4)) plot(ecdf(x)) You will notice a sharp turn around x = 2.5 How do I get that value of x using R? -- Thanks, Jim. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://

Re: [R] X11 problem

2011-08-25 Thread Rolf Turner
Thanks. I had never heard of "build-dep". Further on you said: You can always read up :-) Sure. But there is a virtually infinite amount of stuff that one could read, only a tiny fraction of which is relevant. And much of which is confusing, frustratingly obscure, bewildering, sometimes mi

Re: [R] Setting up a State Space Model in dlm

2011-08-25 Thread quantguy
I get the identical error even when applying the sample code from the dlm vignette on state space models: http://www.jstatsoft.org/v41/i04/paper The sample code is here: tmp <- ts(read.table("http://shazam.econ.ubc.ca/intro/P.txt";, header=T), start=c(1978,1), frequency=12) * 100 y <- tmp[,1:4] -

Re: [R] string manipulation

2011-08-25 Thread Lorenzo Cattarino
Apologies for confusion. What I meant was the following: mytext <- "I want the number 2000, not the number two thousand" and the problem is to select "2000" as the first four digits after the word "number". The position of 2000 in the string might change. thanks Lorenzo -Original Messag

[R] issue with available.packages() and download.file()

2011-08-25 Thread Seth Schommer
Dear R-Users, I think I have encountered a potential bug (or at least unwanted behavior), but I'm not sure so I wanted to post here first. Lately I've been encountering an error when running a package I put together. I have my package set up to check for updates when it loads but this error occu

Re: [R] Specifying argument values in a function

2011-08-25 Thread R. Michael Weylandt
Hi Sam, The heart of your problem is that you are not using strings in your off statements. Rather, you are calling objects called norm and cumu and R is trying to test those for equality. In the first case, when you get to norm, R tries to call the norm() function, which is the magnitude of a ve

Re: [R] Creating new dataset based on variable name

2011-08-25 Thread jim holtman
If you dig a little deeper, the real answer to your question is to use a list to store the ~60 dataframe instead of polluting the workspace with a lot of objects that are not connected together. 'list's will make future processing easier since everything is in one object and if you want to save/lo

Re: [R] Change point in CDF

2011-08-25 Thread David Winsemius
On Aug 25, 2011, at 9:33 PM, Jim Silverton wrote: Hi all, I have some data. I want to fit a smooth cdf to the data. Then I want to find both the value of x and the % on the y axis for which the the slope is 1 ( or the point where the slope change is the greatest...hummh well the part whe

Re: [R] string manipulation

2011-08-25 Thread jim holtman
To be on the safe side in case there are other characters at the end of the string, use: > mytext <- "I do not want the first number 1234, but the second number > 5678sadfsadffdsa" > # make sure you get 4 digits > sub("^.*second number[^[0-9]]*([0-9]{4}).*", "\\1", mytext) [1] "5678" > On Thu,

Re: [R] Change point in CDF

2011-08-25 Thread Jim Silverton
Hi all, I have some data. I want to fit a smooth cdf to the data. Then I want to find both the value of x and the % on the y axis for which the the slope is 1 ( or the point where the slope change is the greatest...hummh well the part where you can identify where there is a point of inflection...f

Re: [R] string manipulation

2011-08-25 Thread Steven Kennedy
You can split your string, and then only take the first 4 digits after that (this is only an improvement if your numbers might not be at the end of mytext): mytext <- "I do not want the first number 1234, but the second number 5678" sstr<-strsplit(mytext,split="second number ")[[1]][2] nynumbers<-

Re: [R] string manipulation

2011-08-25 Thread Henrique Dallazuanna
Try this: gsub(".*second number ", "", mytext) On Thu, Aug 25, 2011 at 8:00 PM, Lorenzo Cattarino wrote: > I R-users, > > I am trying to find the way to manipulate a character string to select a 4 > digit number after some specific word/s. Example: > > mytext <- "I do not want the first number

Re: [R] Very Basic Source Question

2011-08-25 Thread swonder03
That was it - silly mistake. Thank you very much. -- View this message in context: http://r.789695.n4.nabble.com/Very-Basic-Source-Question-tp3769129p3769751.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing

Re: [R] change values in a character vector

2011-08-25 Thread Peter Alspach
Tena koe Henri-Paul Does the following do what you want? testVector <- LETTERS[1:3] temp <- matrix(c(rep(c(NA, 'foo'), each=length(testVector)), testVector, rep(c(NA, 'bar', 'blah'), each=length(testVector))), ncol=6) c(t(temp)) HTH Peter Alspach > -Original Message- > From: r-

[R] string manipulation

2011-08-25 Thread Lorenzo Cattarino
I R-users, I am trying to find the way to manipulate a character string to select a 4 digit number after some specific word/s. Example: mytext <- "I do not want the first number 1234, but the second number 5678" Is there any function that allows you to select a certain number of digits (in thi

Re: [R] survplot() for cph(): Design vs rms

2011-08-25 Thread Frank Harrell
http://biostat.mc.vanderbilt.edu/Rrms shows differences between Design and rms Frank array chip wrote: > > Thank you David. The plot from Design package will draw a plot of survival > probability at 5 years (in my example) versus different age. I will look > into Predict() in rms package to see h

Re: [R] Possible Error in generic function rzigp in ZIGP Package

2011-08-25 Thread Ben Bolker
Chee Chen yahoo.com> writes: > > Dear All, > I would like to report a possible mistake in the generic function > rzigp in ZIGP package, and seek for help. Unless you get very lucky and somewhere here volunteers to dig into the package and find out what's wrong, your best bet is to contact t

Re: [R] How download Yahoo Quote?

2011-08-25 Thread R. Michael Weylandt
library(quantmod) getSymbols("IBM") Michael On Aug 25, 2011, at 6:20 PM, Yumin wrote: >Hello all: > >Friend told me that we can download the stock historical quote from > Yahoo site by R! > Could you tell me that is true or not, how to do that? > >Thanks! > > -- > View this mes

[R] Specifying argument values in a function

2011-08-25 Thread Sam Albers
Hello all, I am trying write a fairly simple function that provide a quick way to calculate several distributions for a data set. I am trying to provide a function that has a argument that specifies which distribution is outputted (here "norm" or "cumu"). I also have a melt argument but that seems

[R] How download Yahoo Quote?

2011-08-25 Thread Yumin
Hello all: Friend told me that we can download the stock historical quote from Yahoo site by R! Could you tell me that is true or not, how to do that? Thanks! -- View this message in context: http://r.789695.n4.nabble.com/How-download-Yahoo-Quote-tp3769563p3769563.html Sent from t

Re: [R] Passing parameters

2011-08-25 Thread Scott
Hi Annie, while I don't use python, I've been in similar positions. here's a good link for the arguments function. It's the best example/tutorial I've seen on the topic. It will also help you perhaps to print the values of the arguments to screen/file within R to see if things are going okay. htt

Re: [R] Using write.table i have a table with two columns i would like to save it as an excel file

2011-08-25 Thread Scott
One option you've got is to configure that your operating system so any CSV file will be opened up in Excel. Those instructions will depend on the type of operating system. I'd usually turn row.names=FALSE on either write.table or row.table as it's not that important (for what I do it's normally j

Re: [R] Construct a File Path: File Path Unknown

2011-08-25 Thread Scott
If you create a directory to work in for your project you could store that and use that later maindir<-getwd() #then even if you change directories for different parts of your project (but remain inside that folder) you could put maindir variable into the path of the dir command. The less director

Re: [R] Very Basic Source Question

2011-08-25 Thread Scott
>I'm trying to do is get comfortable with 'source' and run "source(C:/Program Files (x86)/Eclipse/eclipse/ProjectName/SourceFile.R)". I'm not familiar with StatET/Eclipse IDE so this attempted answer might be way off mark. I'd be guessing it probably relates to quotation symbols in the correct l

Re: [R] Creating new dataset based on variable name

2011-08-25 Thread Scott
>for (i in 1:NROW(vector.with.names) You need length instead of nrow (lowercase) which will be NULL for a vector. >I also want to convert the name from file name to something I can understand For this part of your statement, I think you're after the assign function (included in basic install of R

Re: [R] Construct a File Path: File Path Unknown

2011-08-25 Thread Brad Patrick Schneid
it would probably be faster if you can be as specific as possible... in the help that has been provided, it is looking everywhere in c:/ you could narrow that down a bit and save it from looking too deep in your system. dir("C:\Documents and Settings\username\Desktop", pattern="foo.pdf", ful

Re: [R] Using write.table i have a table with two columns i would like to save it as an excel file

2011-08-25 Thread kevin123
Thank you for the help, csv works much better, Kevin On Thu, Aug 25, 2011 at 11:47 AM, R. Michael Weylandt < michael.weyla...@gmail.com> [via R] < ml-node+3769105-2014137821-262...@n4.nabble.com> wrote: > I'd suggest you should probably just use the simpler write.csv() function > to > make a fil

Re: [R] survplot() for cph(): Design vs rms

2011-08-25 Thread array chip
Thank you David. The plot from Design package will draw a plot of survival probability at 5 years (in my example) versus different age. I will look into Predict() in rms package to see how this can be done. John - Original Message - From: David Winsemius To: array chip Cc: "r-h

Re: [R] Creating new dataset based on variable name

2011-08-25 Thread JacobSimmering
Scott/David, Thanks for your help - what I was looking for was assign. This takes care of my question. -- View this message in context: http://r.789695.n4.nabble.com/Creating-new-dataset-based-on-variable-name-tp3769285p3769620.html Sent from the R help mailing list archive at Nabble.com.

[R] change values in a character vector

2011-08-25 Thread Henri-Paul Indiogine
Greetings! I have a 127 long vector with all different character entries.I need to generate another vector that is 6 times a long and the second one and has the following structure: NA "foo" "a unique string" NA "bar" "blah" NA "foo" "another unique string" NA "bar" "blah" . This has to

Re: [R] survplot() for cph(): Design vs rms

2011-08-25 Thread David Winsemius
On Aug 25, 2011, at 5:11 PM, array chip wrote: Hi, in Design package, a plot of survival probability vs. a covariate can be generated by survplot() on a cph object using the folliowing code: n <- 1000 set.seed(731) age <- 50 + 12*rnorm(n) label(age) <- "Age" sex <- factor(sample(c('male','

Re: [R] Construct a File Path: File Path Unknown

2011-08-25 Thread Tyler Rinker
Bill, Thank you very much! That's very fast. Exactly what I was looking for. Jean thank you for your response as well. Tyler> From: wdun...@tibco.com > To: tyler_rin...@hotmail.com; jvad...@usgs.gov > CC: r-help@r-project.org > Subject: RE: [R] Construct a File Path: File Path Unknown > Date

Re: [R] Creating new dataset based on variable name

2011-08-25 Thread David Winsemius
On Aug 25, 2011, at 4:19 PM, JacobSimmering wrote: I am trying to import several different SAS transport files into R. I know how to get the files into R as data frames, however, I don't want to do this one at a time for all ~60 data sets. I also want to convert the name from file name to

Re: [R] R hangs after htmlTreeParse

2011-08-25 Thread Duncan Temple Lang
Hi Simon I tried this on OS X, Linux and Windows and it works without any problem. So there must be some strange interaction with your configuration. So below are some things to try in order to get more information about the problem. It would be more informative to give us the explicit version

Re: [R] X11 problem

2011-08-25 Thread Dirk Eddelbuettel
On 26 August 2011 at 08:39, Rolf Turner wrote: | | Carole: | | If you really need to install R from source you probably need to do: | | sudo apt-get update | sudo apt-get install libx11-dev | | before you do your ./configure and make. Whoever _really_ insists on building locally sho

Re: [R] replicate lines of data frame

2011-08-25 Thread Henri-Paul Indiogine
Hi Jorge! 2011/8/25 Jorge I Velez : > Try ("x" is your data): > x[rep(1:nrow(x), each = 6),] Yes, it works. Thanks! I see that the row names are now: 1, 1.1, 1.2, 1.3, 1.4, 1.5, 2, 2.1 . It does not bother me, but is this going to be a problem later on? I need to further manipulate the

[R] survplot() for cph(): Design vs rms

2011-08-25 Thread array chip
Hi, in Design package, a plot of survival probability vs. a covariate can be generated by survplot() on a cph object using the folliowing code: n <- 1000 set.seed(731) age <- 50 + 12*rnorm(n) label(age) <- "Age" sex <- factor(sample(c('male','female'), n, TRUE)) cens <- 15*runif(n) h <- .02*exp(.

Re: [R] X11 problem

2011-08-25 Thread Rolf Turner
Carole: If you really need to install R from source you probably need to do: sudo apt-get update sudo apt-get install libx11-dev before you do your ./configure and make. If you just want to install the binary, you could try sudo apt-get update sudo apt-get install r-base r-ba

Re: [R] duplicate 'row.names' are not allowed???

2011-08-25 Thread R. Michael Weylandt
There's a "no-homework" policy on this list and given that you are sending from a ".student" account and referencing example assignments, you probably won't get any help. Looking at the given code, it seems like you should get in touch with a TA sooner rather than later though. Best of luck, Mich

Re: [R] Construct a File Path: File Path Unknown

2011-08-25 Thread William Dunlap
Try using normalizePath("foo.pdf") after creating the file. It should return an absolute path to an existing file. Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of Tyler

[R] Creating new dataset based on variable name

2011-08-25 Thread JacobSimmering
I am trying to import several different SAS transport files into R. I know how to get the files into R as data frames, however, I don't want to do this one at a time for all ~60 data sets. I also want to convert the name from file name to something I can understand (e.g., from q181 to doctor.visits

Re: [R] Very Basic Source Question

2011-08-25 Thread Jorge I Velez
Hi, I think you misplaced the quotes. From ?source: file: a connection or a character string giving the pathname of the file or URL to read from. ‘""’ indicates the connection ‘stdin()’. Try instead (untested): source("C:/Program Files (x86)/Eclipse/eclipse/ProjectName/Sou

Re: [R] Adding a normal density curve over the empirical curve

2011-08-25 Thread R. Michael Weylandt
There's nothing wrong with leaving in buggy code when there's a bug that you just can't get (assuming it's part of your real code): I only ask for the error message because it saves us a little bit of time if you can let us know what errors you are getting. Anyways, best of luck, Michael On Thu,

Re: [R] replicate lines of data frame

2011-08-25 Thread Jorge I Velez
Hi Henri-Paul, Try ("x" is your data): x[rep(1:nrow(x), each = 6),] HTH, Jorge On Thu, Aug 25, 2011 at 3:22 PM, Henri-Paul Indiogine <> wrote: > Greetings! > > I am just now learning to use R for my dissertation project. I need > to manipulate a lot of text and numeric data. I created a da

[R] Syntax for a three-level logistic model

2011-08-25 Thread Diaz-Escamilla, Rafael E
Dear People at R help, I am trying to figure out the syntax for a three-level logistic model with a single random effect (intercept): Data Collected My data consist of three levels: level 1 is four setting for each student (setting nested within student), and each student is registered in one of

[R] Decision tree with the group median as response?

2011-08-25 Thread Jay
As I am only familiar with the basics regarding decision trees I would like to ask, with the risk of sating a silly question: is it possible to perform recursive partitioning with the group median as the response/objective? For example, in stead of rpart focusing on means, could a similar tree be

[R] Very Basic Source Question

2011-08-25 Thread swonder03
I'm having an issue sourcing an R file from my workbench using StatET in the Eclipse IDE. All I'm trying to do is get comfortable with 'source' and run "source(C:/Program Files (x86)/Eclipse/eclipse/ProjectName/SourceFile.R)". When I try to call the path for the file i get the error: "unexpected '

[R] duplicate 'row.names' are not allowed???

2011-08-25 Thread Ville Iiskola
Hi I have an example file in excel and i have following instructions to open and analyze the data in it. > library(RODBC) > library(mlogit) > z<-odbcConnectExcel("C:\\2008 Racedata.xls") Everything ok untill the next command > x<-mlogit.data(y,choice="winner",shape="long",id.var="datekey",alt.

[R] replicate lines of data frame

2011-08-25 Thread Henri-Paul Indiogine
Greetings! I am just now learning to use R for my dissertation project. I need to manipulate a lot of text and numeric data. I created a data frame that has 7 columns and 127 unique rows. Now I need to replicate each line 6 times and then later change values in the first 2 columns. I am tryin

Re: [R] within-groups variance and between-groups variance

2011-08-25 Thread Daniel Malter
#Here is I think an easier way of coding all the components you need. #The within-group variances, you get with this function: apply(iris[,1:4],2,function(x) tapply(x,iris$Species,var)) #You can get what you computed by taking the column means. apply(apply(iris[,1:4],2,function(x) tapply(x,iri

Re: [R] Combining a greek letter and a newline on the same label

2011-08-25 Thread Sébastien Vigneau
Thank you very much for the detailed explanations, and sorry for being vague in my question. "atop" is what I needed :) Sebastien On Thu, Aug 25, 2011 at 11:59 AM, David Winsemius wrote: > > On Aug 25, 2011, at 11:23 AM, Sébastien Vigneau wrote: > > Hi, >> >> I would like to add a two-lines l

Re: [R] Construct a File Path: File Path Unknown

2011-08-25 Thread Tyler Rinker
Jean, Thank you. It's slow but it works. dir("C:/", pattern="plotrix.pdf", full.names=T, ignore.case=T, recursive=T) Does anyone have a faster way? If it helps using: shell.exec("search-ms://query=plotrix.pdf")utilizes windows's search bar to find the file (this is quick), however i

Re: [R] Bivariate normal regression in R

2011-08-25 Thread Viechtbauer Wolfgang (STAT)
Another way would be to consider this as a path model and use the sem or lavaan package to fit this model. Here is an example: x <- rnorm(1000) e1 <- rnorm(1000) e2 <- e1 + rnorm(1000) e1 <- e1 + rnorm(1000) y1 <- 2 + 1*x + e1 y2 <- 4 + 2*x + e2 dat <- data.frame(x, y1, y2) model <- 'y1 ~ x

Re: [R] Selections in lists

2011-08-25 Thread Jorge I Velez
Hi mdvaan, Not the best solution, but it should get you started: lapply(g, function(l){ n <- names(l) res <- lapply(1:length(n), function(ii){ rr <- l[[n[ii]]] rn <- rownames(rr) cn <- colnames(rr) i <- rn %in% n[[ii]] rr

Re: [R] Selections in lists

2011-08-25 Thread David Winsemius
On Aug 25, 2011, at 11:24 AM, mdvaan wrote: Hi, I have produced a list g and I would like to reduce the amount of information contained in each object in g. For each matrix I would like to keep the values where the column name equals g[year][[1]][[x]] and the row names equals g[year][[1]][[

Re: [R] Choropleth in R

2011-08-25 Thread Jean V Adams
It sounds like you're looking for a heatmap type of overlay, not a choropleth map, given that you have a collection of coordinates. If that is correct, then something like this might help. df <- structure(list(long = c(-4.45, -5.04, -4.41, -4.7, -3.87, -2.67, -4, -4.37, -3, -3.04, -1.71, -1.26

Re: [R] Fwd: Segment out of the Graph

2011-08-25 Thread David Winsemius
On Aug 25, 2011, at 2:06 PM, Claudio Zanettini wrote: -- Forwarded message -- From: Claudio Zanettini Date: 2011/8/25 Subject: Re: [R] Segment out of the Graph To: David Winsemius Thanks David and Michael, In attachment there is one of the graph. No attachment. No code.

Re: [R] how to match a dataframe and a list

2011-08-25 Thread R. Michael Weylandt
I'd be willing to guess that some combination of match() %in% unlist() will get the job done, but without knowing what sort of data you have, I can't write example code. If you could, use the dput() function to turn your data into plain text and let us work directly with it to help you out. If i

Re: [R] Using write.table i have a table with two columns i would like to save it as an excel file

2011-08-25 Thread R. Michael Weylandt
I'd suggest you should probably just use the simpler write.csv() function to make a file type that will move much more conveniently between Excel and R. The syntax is: write.csv(ThingBeingSaved, "filename.csv") If you only put the file name to write.csv it will be placed in your working director

Re: [R] Adding a normal density curve over the empirical curve

2011-08-25 Thread R. Michael Weylandt
I'm not going to download your data since it's probably irrelevant to your problem and I have no interest in downloading unknown files. Consider this instead: library(quantmod) SPY = getSymbols("SPY",auto.assign=F) SPY = weeklyReturn(Ad(SPY)) densitySPY = density(SPY) plot(densitySPY,main="Kerne

Re: [R] debugging functions in R

2011-08-25 Thread Spencer Graves
See also the debug function, which allows you to walk through a function line by line. I also concur with Duncan's recommendation to try the R package system. I'm an author of one of two contributed documents available from CRAN -> Documentation: Contributed -> "Creating R Packa

Re: [R] Bivariate normal regression in R

2011-08-25 Thread Dimitris Rizopoulos
One possibility is function gls() from package nlme. Best, Dimitris On 8/25/2011 8:22 PM, DHIMAN BHADRA wrote: Hello everyone, I need to fit a bivariate normal regression model to a dataset where the same covariate (say, X) influences two separate but correlated responses (say, Y1 and Y2). So

Re: [R] debugging functions in R

2011-08-25 Thread Duncan Murdoch
On 11-08-24 10:20 AM, Eran Eidinger wrote: Hi, I am not sure if this is the right list to ask this question (though I did not find a more appropriate one). I've started using R a month ago, and small scripts work fine. However, when I start writing more complex code, it gets messy. 1. Is there

[R] Bivariate normal regression in R

2011-08-25 Thread DHIMAN BHADRA
Hello everyone, I need to fit a bivariate normal regression model to a dataset where the same covariate (say, X) influences two separate but correlated responses (say, Y1 and Y2). So, the bivariate model would look like : Y1 = a1 + b1*X + e1 Y2 = a2 + b2*X + e2 where e1 and e2 are error terms wh

Re: [R] Construct a File Path: File Path Unknown

2011-08-25 Thread Jean V Adams
Try the dir() function. ?dir # for example dir("c:/", pattern="foo.pdf", full.names=T, ignore.case=T, recursive=T) Jean Tyler Rinker wrote on 08/25/2011 11:54:28 AM: > > I am not a programmer and am self-taught so I may lack the > language to ask this appropriately (perhaps why an rseek searc

[R] how to match a dataframe and a list

2011-08-25 Thread Serena105
Hi! I am a beginner and I hope you will help me! I have one data frame with numbers as columns names that correspond to codes. In a list I have the codes and the corresponding state. Now I need to match the columns (codes) of the data.frame with the codes in the list, since not all the codes in

[R] Selections in lists

2011-08-25 Thread mdvaan
Hi, I have produced a list g and I would like to reduce the amount of information contained in each object in g. For each matrix I would like to keep the values where the column name equals g[year][[1]][[x]] and the row names equals g[year][[1]][[-x]]. So in g$`1999`$`8029`, year = 1999 and x = 8

[R] Using write.table i have a table with two columns i would like to save it as an excel file

2011-08-25 Thread kevin123
Using write.table i would like to save data as an excel file to a folder. I am not too sure how to write the file path or what to name the file. I would appreciate any feedback. > write.table(x, file = "", append = FALSE, quote = TRUE, sep = " ", + eol = "\n", na = "NA", dec = ".",

[R] within-groups variance and between-groups variance

2011-08-25 Thread Coghlan, Avril
Hello, I have been looking for functions for calculating the within-groups variance and between-groups variance, for the case where you have several numerical variables describing samples from a number of groups. I didn't find such functions in R, so wrote my own versions myself (see below). I ca

[R] Adding a normal density curve over the empirical curve

2011-08-25 Thread Newbie
Hi I have created the following plot over the empirical returns.. What I now want to do is to overlay a curve/line with the normal density as a comparison of the two. Does anyone know how to do this? (NB the last two lines are the problem, and are wrong, I know). Thank you in advance! Rikke http

Re: [R] Choropleth in R

2011-08-25 Thread Reza Salimi-Khorshidi
Thanks Jean, but this package appears to be perfect for the US + a couple of other country that unfortunately UK is not one of them. What I want is a solution that takes a list of coordinates/postcodes/cities and a list of values and gives me a colourful UK map. Any thoughts? Cheers On Thu, Aug 25

[R] Fwd: Segment out of the Graph

2011-08-25 Thread Claudio Zanettini
-- Forwarded message -- From: Claudio Zanettini Date: 2011/8/25 Subject: Re: [R] Segment out of the Graph To: David Winsemius Thanks David and Michael, In attachment there is one of the graph. the line below the graph is not related to the y label. I draw it at y= -10 just beco

Re: [R] read.table truncated data?

2011-08-25 Thread jim holtman
When you have an unbalanced quote, it may be hard to determine exactly where it is. It is probably up to the user to determine with there is truncation. In some cases you might have data that goes over several lines that are within quotes and is legal. You might also read up on the 'fill' and 'f

Re: [R] Easier ways to create .Rd files?

2011-08-25 Thread Greg Snow
For the initial .Rd file look at the 'prompt' function, it will create a basic .Rd file based on the current function definition with all the structure in place, then you go in and edit it to have more meaningful information. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain

Re: [R] Segment out of the Graph

2011-08-25 Thread David Winsemius
On Aug 25, 2011, at 1:30 PM, Claudio Zanettini wrote: I tried setting ylim=(0, 1000) but the segment that I have draw is at y=-10 so if I set the y origin to 0 I don t have the segment, if a l leave it at -10 I have the segment but the axis start from -10. I would like to have both. So to h

Re: [R] Segment out of the Graph

2011-08-25 Thread R. Michael Weylandt
I'm not really sure what you are asking for, but I might venture to suggest a few ideas: 1) Do you mean to say you want two plots: one with ylim around -10 and the other running from 0 to 1000? 2) Are you looking for a "break" in the y-axis? If so, plotrix may be able to help, but it's hardly wor

Re: [R] Segment out of the Graph

2011-08-25 Thread Claudio Zanettini
> I tried setting ylim=(0, 1000) > but the segment that I have draw is at y=-10 > so if I set the y origin to 0 I don t have the segment, > if a l leave it at -10 I have the segment but the axis start from -10. > > I would like to have both. > So to have a graph with ylim=( 0, 1000) > and under it

Re: [R] Segment out of the Graph

2011-08-25 Thread R. Michael Weylandt
"lim" is not the argument: "ylim" is. You put in a vector of length 2 comprising the min and max y you wish: consider this: x = -5:5; y = x^2; z = rep(-5,11); layout(1:2) plot(x,y,type="b"); lines(x,z,col=2) plot(x,y,ylim = c(-8,max(y)+3),type="b"); lines(x,z,col=2) For your work, you'd need yli

Re: [R] Segment out of the Graph

2011-08-25 Thread Claudio Zanettini
Yes I tried but if I set the lim to 0 then it will not displayed the line that is at -10, right? 2011/8/25 R. Michael Weylandt > Look at ylim, as an optional argument to plot. > > Michael > > On Thu, Aug 25, 2011 at 1:07 PM, Claudio Zanettini < > claudio.zanett...@gmail.com> wrote: > >> Hello ev

Re: [R] Segment out of the Graph

2011-08-25 Thread R. Michael Weylandt
Look at ylim, as an optional argument to plot. Michael On Thu, Aug 25, 2011 at 1:07 PM, Claudio Zanettini < claudio.zanett...@gmail.com> wrote: > Hello everyone, > I have a graph and a segment parallel to the x axis at y=-10, x=0, and > bars on it. > Now the question is, > Is there a way to le

[R] Segment out of the Graph

2011-08-25 Thread Claudio Zanettini
Hello everyone, I have a graph and a segment parallel to the x axis at y=-10, x=0, and bars on it. Now the question is, Is there a way to leave the segment there but let the graph axis start from the origin? In this way the segment will be out of the graph Thanks [[alternative HTML ver

[R] Question about FlexMix package

2011-08-25 Thread Andra Isan
Hello All, I am trying to use FlexMix package for my two linear regression models: http://finzi.psych.upenn.edu/R/library/flexmix/doc/regression-examples.pdf y1 = w1 * x1 + w2 *x2 + w3 * x3 +beta1 y2 = w4 * x4 + w4 *x4 + w4 * x4 +beta2 and I would like to combine these two regression models wi

[R] Optim function with multivariate inputs

2011-08-25 Thread Noah Silverman
Hi, I have function that I want to optimize. Am playing with the optim() function in R Two issues: 1) I can't seem to get it to work with a function that takes multiple inputs. Dummy Example: myFunc <- function(A,B,D,D){ # Do stuff return E } > myFunc(1,2,3,4) [1] 12 # wor

[R] Construct a File Path: File Path Unknown

2011-08-25 Thread Tyler Rinker
I am not a programmer and am self-taught so I may lack the language to ask this appropriately (perhaps why an rseek search was unfruitful). Let's say I saved a file to my desktop called foo.pdf. Then I want R to return the file path of foo.pdf (pretend I don't know the location(path) of

Re: [R] X11 problem

2011-08-25 Thread 颜林林
Thank you for the information! On Thu, 2011-08-25 at 10:53 -0500, Dirk Eddelbuettel wrote: > On 25 August 2011 at 22:24, Linlin Yan (颜林林) wrote: > | Because the official source is not as new as the latest version yet. > > That is not true --- you get the most recent R version prebuilt for Ubuntu

Re: [R] read.table truncated data?

2011-08-25 Thread zhenjiang xu
Thanks, Jim. quote='' works. And then I found a single quote in each of these lines: 3262 10403 17544 24685 31826 38967 None of them near the position the table got truncated. Why is it? And read.table is a great function. Is it possible for it to give a warning message when the data gets truncat

Re: [R] Split data frame by date (POSIXlt)

2011-08-25 Thread MacQueen, Don
I suspect, but have not tested, that your src$date element has class "POSIXlt", which is internally a list, in which case splitting by it might not work properly, and might be the cause of your out of bounds error message. One of these might do the job: src$date <- format(strptime(tickdata$da

Re: [R] Change color in forest.rma (metafor)

2011-08-25 Thread Viechtbauer Wolfgang (STAT)
The color of the squares is also currently hard coded. The thing is, there are so many different elements to a forest plot (squares, lines, polygons, text, axes, axis labels, etc.), if I would add arguments to set the color of each element, things would really get out of hand (as far as I am c

Re: [R] Combining a greek letter and a newline on the same label

2011-08-25 Thread David Winsemius
On Aug 25, 2011, at 11:23 AM, Sébastien Vigneau wrote: Hi, I would like to add a two-lines label consisting of: "Delta word1\n word2" (with Delta being the actual greek letter). But you are not saying how word1 and word2 are supposed to be positioned relative to each other and to Delta.

Re: [R] Append a value to a vector

2011-08-25 Thread Claudio Zanettini
Oh thanks, yes now I understand. I did not realized that I did not save it. :) 2011/8/24 Jean V Adams > > Claudio Zanettini wrote on 08/24/2011 > 04:33:50 PM: > > > > > Thank you, this work fine, > > and is not contorted like mine:) > > In this case lastV=LastI but depending on the data that I

Re: [R] read.table truncated data?

2011-08-25 Thread jim holtman
But did you try the following: x <- read.table(, comment.char = '', quote = '') Most cases is that there is a missing quote somewhere in your data. use a text editor and search for single and double quotes. On Thu, Aug 25, 2011 at 11:49 AM, zhenjiang xu wrote: > Thanks for your replies. I l

Re: [R] Question about object permanence/marshalling

2011-08-25 Thread jim holtman
You probably need to change 'marshal' also. I see that you are passing in the character string and this is what you are saving. what you probably is something like this where you pass in the object and then get its name: >> marshal <- function(object.value) { object <- deparse(substitut

Re: [R] X11 problem

2011-08-25 Thread Dirk Eddelbuettel
On 25 August 2011 at 22:24, Linlin Yan (颜林林) wrote: | Because the official source is not as new as the latest version yet. That is not true --- you get the most recent R version prebuilt for Ubuntu (and other Linux distros) via the CRAN repositories. See the R FAQ about where to get to current U

Re: [R] read.table truncated data?

2011-08-25 Thread zhenjiang xu
Thanks for your replies. I looked at those lines and didn't spot anything unusual. > tail(a) test_id gene_id gene locus sample_1 sample_2 status 21418 tY(GUA)J1 - SUP7 chr10:354243-354332 air1rrp6 air2rrp6 OK 21419 tY(GUA)J2 - SUP4 chr10:542955-543044 air1rrp6

[R] R hangs after htmlTreeParse

2011-08-25 Thread Simon Kiss
Dear colleagues, I'm trying to parse the html content from this webpage: http://timesofindia.indiatimes.com/searchresult.cms?sortorder=score&searchtype=2&maxrow=10&startdate=2001-01-01&enddate=2011-08-25&article=2&pagenumber=1&isphrase=no&query=IIM&searchfield=§ion=&kdaterange=30&date1mm=01&date1dd

Re: [R] rpart: plot without scientific notation

2011-08-25 Thread David Winsemius
On Aug 25, 2011, at 10:38 AM, Jean V Adams wrote: I don't see a quick solution to this. You could contact the maintainer of the rpart.plot package, Stephen Milborrow maintainer("rpart.plot") or you could try to modify the rpart.plot() function yourself to meet your needs rpart.pl

  1   2   >