[R] Please Help!

2012-01-30 Thread Li Liu
Dear Professor: I am a learner on R. I met a problem when I use the function arima in R. I wish you could give me a hand. The following is the code I wrote. > set.seed(1) > b <- c(0.8) > x <- w <- rnorm(1000) > for (t in 2:1000) { x[t] <- x[t] + b * w[t - 1] } > x.ma <- arima(x, or

Re: [R] about colnames

2012-01-30 Thread Jeff Newmiller
The problem occurred when you imported your data, but you haven't shown those steps. --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live Go...

[R] about colnames

2012-01-30 Thread xiaocong zuo
Hi, when I run the below code,there is an error occured. could you please tell me how to treat it? > pdf('covariate.pdf') > par(mfrow=c(1,1)) > pairs(data2[,c("ID","TYPE","AGE","GNDR","HT")], + panel=function(x,y) { points(x,y); lines(lowess(x,y))}) Error in `[.data.frame`(data2, , c("ID"

[R] Currency symbols in Xtick or Ytick labels

2012-01-30 Thread Eugene Gallagher
How do you label Xtick and Ytick marks with Currency symbols: $2000 instead of 2000? I would like to add dollar symbols to tickmarks on boxplots, histograms and back-to-back histograms. My Examples (requiring the lattice and Hmisc packages): data(case0102, package="Sleuth2") str(case0102)

Re: [R] Getting htmlParse to work with Hebrew? (on windows)

2012-01-30 Thread Duncan Temple Lang
With some off-line interaction and testing by Tal, the latest version of the XML package (3.9-4) should resolve these issues. So the encoding from the document is used in more cases as the default. It is often important to specify the encoding for HTML files in the call to htmlParse() and use "UTF

[R] Need to Write a Code that can find the molecular weight of various compounds

2012-01-30 Thread matthew.ttd.nguyen
Hi! Just started working at a lab and have only minimal experience with R. I was wondering if there was a way to write a code that would intake a data set of chemical compounds (ex: H2O, CH3) and be able to give an output column of the molecular weight? I tried some really basic coding to try to

[R] Venn Diagram help!!!!

2012-01-30 Thread rantree
Hi there ! I've got 7 Samples that may contain 29 differents kinds of material every line below corresponds to a differente kind of material, example: Sample 1, 2,3,5 and 6 has material 1 So I want to know how can I do a Venn Diagram with the data below ps ( it was generated by a csv,

Re: [R] Sensitivity analysis - looking a tool for epidemiologic research

2012-01-30 Thread MacQueen, Don
R has several packages for epidemiology. Maybe one of them has it. Take a look. To name just two: "Epi" and "epitools" -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 1/27/12 9:01 PM, "Dominic Comtois" wrote: >Stata

[R] Change line colors based on data values in Lattice

2012-01-30 Thread Liu, Andrew
Say I have x = seq(1, 40) y = seq(1, 40)^2 g = rep(c("A", "B", "A", "B"), each = 10) xyplot(y~x, groups = g, type = 'l') Is there a way to have a single line and have it be one color when g == "A", and another when g == "B"? Thanks! Regards, Andrew Liu Fixed Income | Investment Fellow T. Rowe

[R] mgcv bam() with grouped binomial data

2012-01-30 Thread Casey Olives
Hello, I'm trying to use the bam() function in the R mgcv package for a large set of grouped binary data. However, I have found that this function does not take data in the format of cbind(numerator, denominator) on the left hand side of the formula. As an example, consider the following dat1

Re: [R] Checking for invalid dates: Code works but needs improvement

2012-01-30 Thread Rui Barradas
Hello, I'm glad it helped. > > Error in if (any(is.na(x) & M != "un" & Y != "un")) cat("Warning: Invalid > date values in", : > missing value where TRUE/FALSE needed > > Why is this happening? If the code correctly correctly handles the date > "06/20/1840" without producing an error, > why can

Re: [R] Euler identity with complex exp

2012-01-30 Thread Joseph Park
Thanks Gentlemen. Now I see the disconnect. I was misusing exp( i x ) and expecting to get exp( i x ) = cos x + i sin x, which is Euler's formula. Since it is a mapping of a real number onto the unit circle in the complex plane, any answer it gives must have a magnitude of 1 and the argument to

Re: [R] Euler identity with complex exp

2012-01-30 Thread Joseph Park
Thanks Michael & Peter. Michael's expansion makes sense. This is what I expected: > a = pi + 0i > complex( real = cos(Re(a)), imaginary = sin(Im(a)) ) [1] -1+0i Not this: > exp(a) [1] 23.14069+0i Is this not an implementation of Euler's formula: > complex( real = cos(2*pi), imaginary = sin

Re: [R] Linear Mixed Model set-up

2012-01-30 Thread Ben Bolker
Maggie Neff gmail.com> writes: > > Hello, > > I have some data covering contaminant concentrations in fish over a time > period of ~35 years. Each year, multiple samples of fish were taken (with > varying sample sizes each year). Ultimately, I want an estimation of the > variance between year

Re: [R] Different type of legend?

2012-01-30 Thread rkevinburton
Sorry. I am not sure how to post a link. Basically the legend looks like: * * * * * * * * * * * -4 -3 -2 -1 0 1 2 3 4 Where ' * ' are colored boxes that are right next to each other. Kind of like a gradient. On Mon, Jan 30, 2012 at 3:29 PM, R. Michael Weylandt wrote: Server stripped the

Re: [R] Different type of legend?

2012-01-30 Thread R. Michael Weylandt
Server stripped the attachment. Can you post a link somewhere? Michael On Mon, Jan 30, 2012 at 4:25 PM, wrote: > > How would I create a legend that looks like the attached image? Basically > all of the color boxes are right next to each other and the text is below. > This kind of arrangement al

[R] Different type of legend?

2012-01-30 Thread rkevinburton
How would I create a legend that looks like the attached image? Basically all of the color boxes are right next to each other and the text is below. This kind of arrangement allows for many more items in the legend. Using the legend() method seems to top out at about 14 items (that will fit i

Re: [R] replacing characters in matrix. substitute, delayedAssign, huh?

2012-01-30 Thread Paul Johnson
Henrik's proposal works well, so far. Thanks very much. I could not have figured that out (without much more suffering). Here's the working example in case future googlers find their way to this thread. ## Paul Johnson ## 2012-01-30 ## Special thanks to r-help email list contributors, ## espe

Re: [R] And Statement for two if functions

2012-01-30 Thread R. Michael Weylandt
Nested if's are fine in R, but as David said you probably want ifelse(). This sounds sufficiently homework-y that I'm hesitant to give example code but it's all over the archives. Just to head off a problem I see in your pesudo-code; you're going to want to use ifelse() to construct the points vec

Re: [R] Euler identity with complex exp

2012-01-30 Thread R. Michael Weylandt
This is off-topic for R-help, but we might as well finish what's been started: Take a closer look at exp(i*x). If x is real, i*x is a pure imaginary number, not a complex number so the formula you are using doesn't hold in general.** The general Euler result for complex (= mixed real and imaginary

Re: [R] Euler identity with complex exp

2012-01-30 Thread Peter Langfelder
On Mon, Jan 30, 2012 at 11:43 AM, Joseph Park wrote: > Thanks Michael & Peter. > > Michael's expansion makes sense. > > This is what I expected: > >> a = pi + 0i >> complex( real = cos(Re(a)), imaginary = sin(Im(a)) ) > [1] -1+0i As they say, the error is between the keyboard and the chair. You c

Re: [R] Checking for invalid dates: Code works but needs improvement

2012-01-30 Thread Marc Schwartz
On Jan 30, 2012, at 1:30 PM, Marc Schwartz wrote: > > On Jan 30, 2012, at 12:15 PM, David Winsemius wrote: > >> >> On Jan 30, 2012, at 8:44 AM, Paul Miller wrote: >> >>> Hi Rui, Marc, and Gabor, >>> >>> Thanks for your replies to my question. All were helpful and it was >>> interesting to s

Re: [R] Checking for invalid dates: Code works but needs improvement

2012-01-30 Thread Marc Schwartz
On Jan 30, 2012, at 12:15 PM, David Winsemius wrote: > > On Jan 30, 2012, at 8:44 AM, Paul Miller wrote: > >> Hi Rui, Marc, and Gabor, >> >> Thanks for your replies to my question. All were helpful and it was >> interesting to see how different people approach various aspects of the same >>

[R] User Interface Equivalent Code

2012-01-30 Thread Ajay Askoolum
When I plot, the plot's user interface offers me a choice: File | Copy to the Clipboard | as a Bitmap. What is the equivalent code for achieving this but without the plot interface becoming visible? Thanks. [[alternative HTML version deleted]] _

[R] rpart usersplits

2012-01-30 Thread jcress410
I'm inspecting tests/usersplits.R in rpart, trying to get my head around how to pass data to the split function. I'm trying to instantiate a number of goodness measures which compare treatment vs control within splits. A simple example is difference-in-difference estimate of a candidate split,

Re: [R] Fw: Variable selection based on both training and testing data

2012-01-30 Thread SR Millis
Jim, With regard to variable and model selection, you might consider using Bayesian model averaging (bma program) or some sort of shrinkage (lars or lasso2 programs). Scott Millis From: Jin Minming To: "r-help@r-project.org" ; SR Millis Sent: Monday, Janu

Re: [R] And Statement for two if functions

2012-01-30 Thread kerry1912
Sorry that post was written in a bit if a rush. I am writing a function in which I am trying to create a league table from a data frame of rugby matches with the columns as follows: home team, away team, home score and away score. In rugby you can get an extra bonus point if you are the losing te

[R] Problem in fitting model equation in "nls" function

2012-01-30 Thread ram basnet
Dear R users, I am struggling to fit expo-linear equation to my data using "nls" function. I am always getting error message as i highlighted below in yellow color: ### Theexpo-linear equation which i am interested to fit my data:   response_variable =  (c/r)*log(1+exp(r*(Day-tt))), wher

Re: [R] timeseries highlighting

2012-01-30 Thread Gabor Grothendieck
On Mon, Jan 30, 2012 at 2:12 PM, R. Michael Weylandt wrote: > library(zoo) > demo("zoo-overplot") > Also: library(zoo) example(xblocks) -- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com ___

Re: [R] repeat function for entire list of matrices

2012-01-30 Thread R. Michael Weylandt
No problem. Glad it worked for you. Michael On Mon, Jan 30, 2012 at 12:05 PM, pabears wrote: > michael, > > i don't know what happened, i was reading up on ?lapply(), i was up really > late, and somehow it didn't seem to take, but i tried it again this morning > and it worked like a charm...

Re: [R] timeseries highlighting

2012-01-30 Thread R. Michael Weylandt
library(zoo) demo("zoo-overplot") Michael On Mon, Jan 30, 2012 at 2:05 PM, Alexy Khrabrov wrote: > I'd like to plot a given time series in a primary color but highlight > a segment of it in a different color.  Is there an elegant way to do > it? > > A+ > > ___

[R] timeseries highlighting

2012-01-30 Thread Alexy Khrabrov
I'd like to plot a given time series in a primary color but highlight a segment of it in a different color. Is there an elegant way to do it? A+ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the postin

Re: [R] replacing characters in matrix. substitute, delayedAssign, huh?

2012-01-30 Thread Duncan Murdoch
On 30/01/2012 1:26 PM, Paul Johnson wrote: A user question today has me stumped. Can you advise me, please? User wants a matrix that has some numbers, some variables, possibly even some function names. So that has to be a character matrix. It might make more sense for it to be a list-mode ma

Re: [R] how to sum multiple data entries for the same sampling event?

2012-01-30 Thread R. Michael Weylandt
Perhaps something like # Untested library(plyr) ddply(DATA, "Date", function(d) sum(d$lmb.cpue)) For example, on some fake data DATA <- data.frame(class = rep(letters[1:5], each = 2), type = rep(c("good", "bad"), 5), value = rnorm(10)) ddply(DATA, "class", function(d) sum(d$value)) If you want

Re: [R] plot with ylim with regural interval

2012-01-30 Thread David Winsemius
On Jan 30, 2012, at 1:28 PM, gianni lavaredo wrote: Dear Researchers, sorry for the easy question but Is it possible to plot with an interval of 1 or .5 in a plot using ylim? Thanks gianni x = 0:10; y = 0:10; plot(x~y,ylim=c(0,10),las=1) plot(x~y,ylim=c(0,10), xaxt="n") axis(1, at=seq(

Re: [R] Euler identity with complex exp

2012-01-30 Thread Peter Langfelder
Not sure why you think the formula does not hold... but am guessing you think that sin(x) and cos(x) are have values in [-1, 1]? Well that only holds for real x. If you have a complex x, sin(x) and cos(x) are unbounded - indeed, if you can write x=iy and y is real, you can show (up to my own ignora

Re: [R] replacing characters in matrix. substitute, delayedAssign, huh?

2012-01-30 Thread Gabor Grothendieck
On Mon, Jan 30, 2012 at 1:26 PM, Paul Johnson wrote: > A user question today has me stumped.  Can you advise me, please? > > User wants a matrix that has some numbers, some variables, possibly > even some function names.  So that has to be a character matrix. > Consider: > >> BM <- matrix("0.1", 5

Re: [R] Reg : Hello all.. help needed regarding heatmaps

2012-01-30 Thread R. Michael Weylandt
If you don't mind using an external (but very popular) graphics package known as ggplot2 it's super easy: https://learnr.wordpress.com/2010/01/26/ggplot2-quick-heatmap-plotting/ I'm sure it can be done in base graphics as well, but I'll leave that to someone else. It's also well implemented in g

Re: [R] Euler identity with complex exp

2012-01-30 Thread R. Michael Weylandt
Seems fine to me: exp(pi + i*2pi) = exp(pi) * exp(i *2pi) = exp(pi) * (cos(2pi) + i*sin(2*pi)) = exp(pi) *(1+ 0i) = exp(pi) ~ 23.14 exp(pi/2) ~ 4.81 What would you expect? Michael On Mon, Jan 30, 2012 at 10:37 AM, Joseph Park wrote: > Hi, > > Am i doing something silly here in expecting Euler'

Re: [R] replacing characters in matrix. substitute, delayedAssign, huh?

2012-01-30 Thread Henrik Bengtsson
The quick solution: parseAndEval <- function(x, ...) eval(parse(text=x)) apply(BM, MARGIN=c(1,2), FUN=parseAndEval) My $.02 /Henrik On Mon, Jan 30, 2012 at 10:26 AM, Paul Johnson wrote: > A user question today has me stumped.  Can you advise me, please? > > User wants a matrix that has some nu

[R] Linear Mixed Model set-up

2012-01-30 Thread Maggie Neff
Hello, I have some data covering contaminant concentrations in fish over a time period of ~35 years. Each year, multiple samples of fish were taken (with varying sample sizes each year). Ultimately, I want an estimation of the variance between years, and the variance within years + random effect

Re: [R] repeat function for entire list of matrices

2012-01-30 Thread pabears
michael, i don't know what happened, i was reading up on ?lapply(), i was up really late, and somehow it didn't seem to take, but i tried it again this morning and it worked like a charm.(sorry about the ellipses, i was just being lazy/unclear). that's great, thanks, this is a great h

Re: [R] how to select columns

2012-01-30 Thread Marc Schwartz
On Jan 30, 2012, at 12:33 PM, David Winsemius wrote: > > On Jan 30, 2012, at 2:30 AM, David Studer wrote: > >> Hello, >> I have the following question: >> >> when creating a data.frame >> a1<-c(1,2,3) >> a2<-c(1,2,3) >> c<-data.frame(a1,a2) >> I can select columns using an index like: >> c[,1:

Re: [R] Fw: Variable selection based on both training and testing data

2012-01-30 Thread Jin Minming
Dear Scott, I am so sorry that I think I just sent an empty email to you. Thanks a lot for your advice. The problem is that we do not have sufficient prior knowledge for the regression form and even appropriate inputs. We need try to find some possible regression equations, then add our explana

Re: [R] plot with ylim with regural interval

2012-01-30 Thread Jorge I Velez
Hi Gianni, Yes, take a look at x <- y <- 1:10 plot(x, y, ylim=c(0,10),las=1, yaxt = 'n') axis(2, seq(0, 10, by = .5), seq(0, 10, by = .5), las = 2) plot(x, y, ylim=c(0,10),las=1, yaxt = 'n') axis(2, seq(0, 10, by = 1), seq(0, 10, by = 1), las = 2) Also, check ?plot and ?par for more details. H

[R] how to sum multiple data entries for the same sampling event?

2012-01-30 Thread karengrace84
I'm having trouble with some catch per unit effort data (CPUE, fisheries data). Some of the samples were "retained" and some "unretained," and they are entered as 2 separate entries for the same sampling event (Date and time). I want to calculate the total CPUE (so sum the "retained" and "unretaine

Re: [R] Calculate a function repeatedly over sections of a ts object

2012-01-30 Thread Jorge Molinos
Thank you very much Mike. The script is working now. Jorge From: R. Michael Weylandt [michael.weyla...@gmail.com] Sent: 30 January 2012 04:29 To: Jorge Molinos; r-help Subject: Re: [R] Calculate a function repeatedly over sections of a ts object Sorry

[R] Reg : Hello all.. help needed regarding heatmaps

2012-01-30 Thread koushik gangavaram
Hello all , I am beginner and new to this -R world. I have heard much about R and started working on it. I have some data of 20 business applications( y -axis) and Months( x-axis) and values as their score for every month . I tried to generate a heatmap with this data and got some good results.

[R] Fw: Variable selection based on both training and testing data

2012-01-30 Thread SR Millis
From: SR Millis To: Jin Minming Sent: Monday, January 30, 2012 9:25 AM Subject: Re: [R] Variable selection based on both training and testing data Jim, First, stepwise methods for variable selection should be avoided.  Frank Harrell (in Regression Modeling Strategies) discusses this at len

[R] Euler identity with complex exp

2012-01-30 Thread Joseph Park
Hi, Am i doing something silly here in expecting Euler's formula to be handled by exp? exp( ix ) = cos x + i sin x. The first example below follows this, the others not. Thanks for the education! > exp( complex(real = 0, imag = 2*pi) ) [1] 1-0i > exp( complex(real = pi, imag = 2*pi) ) [1] 23.1

[R] ode() tries to allocate an absurd amount of memory

2012-01-30 Thread Thomas Brown
Hi there R-helpers: I'm having problems with the function ode() found in the package deSolve. It seems that when my state variables are too numerous (>33000 elements), the function throws the following error: Error in vode(y, times, func, parms, ...) : cannot allocate memory block of size 13743

Re: [R] how to select columns

2012-01-30 Thread David Winsemius
On Jan 30, 2012, at 2:30 AM, David Studer wrote: Hello, I have the following question: when creating a data.frame a1<-c(1,2,3) a2<-c(1,2,3) c<-data.frame(a1,a2) I can select columns using an index like: c[,1:2] Is this possible too when using column-names? (something like c(,"a1":"a2"), whi

Re: [R] replacing characters in matrix. substitute, delayedAssign, huh?

2012-01-30 Thread Richard M. Heiberger
Are you sure this isn't a dataframe? Some minor rethinking of the structure might get it there. Rich On Mon, Jan 30, 2012 at 1:26 PM, Paul Johnson wrote: > A user question today has me stumped. Can you advise me, please? > > User wants a matrix that has some numbers, some variables, possibly

[R] plot with ylim with regural interval

2012-01-30 Thread gianni lavaredo
Dear Researchers, sorry for the easy question but Is it possible to plot with an interval of 1 or .5 in a plot using ylim? Thanks gianni x = 0:10; y = 0:10; plot(x~y,ylim=c(0,10),las=1) [[alternative HTML version deleted]] __ R-help@r-projec

[R] replacing characters in matrix. substitute, delayedAssign, huh?

2012-01-30 Thread Paul Johnson
A user question today has me stumped. Can you advise me, please? User wants a matrix that has some numbers, some variables, possibly even some function names. So that has to be a character matrix. Consider: > BM <- matrix("0.1", 5, 5) Use data.entry(BM) or similar to set some to more abstract

Re: [R] Variable selection based on both training and testing data

2012-01-30 Thread Jin Minming
I do not have enough test data for regression analysis although I know there are some statistical regression methods that can be used for small dataset. That is why I need build a model firslty using training dataset. Thanks, Jim --- On Mon, 30/1/12, Liaw, Andy wrote: > From: Liaw, Andy >

Re: [R] Checking for invalid dates: Code works but needs improvement

2012-01-30 Thread David Winsemius
On Jan 30, 2012, at 8:44 AM, Paul Miller wrote: Hi Rui, Marc, and Gabor, Thanks for your replies to my question. All were helpful and it was interesting to see how different people approach various aspects of the same problem. Spent some time this weekend looking at Rui's solution, which

Re: [R] discrete simulated annealing

2012-01-30 Thread Petr Savicky
On Mon, Jan 30, 2012 at 04:57:36PM +, yan jiao wrote: > Dear All, > > I need to use simulated annealing for optimization > is there a way to limit the search place to only discrete values? And > also exclude certain solutions, e.g. exclude the solutions when all the > variables are the same?

Re: [R] And Statement for two if functions

2012-01-30 Thread David Winsemius
On Jan 30, 2012, at 9:52 AM, kerry1912 wrote: I want to perform two if functions at the same time: if(home team > away team & home team <= away team + 7) in R but i am struggling to work out how to write this correctly. Generally newcomers to the R language find that the "ifelse" function

Re: [R] ROC curve

2012-01-30 Thread David Winsemius
On Jan 30, 2012, at 4:52 AM, Josiane NJIWA wrote: Hello all, I am very new to R and i am facing two problems. First i didn't succeed changing the konsole language in english even after trying the line command set language='en'. R is a functional language, so it shouldn't surprise you t

Re: [R] RCurl format

2012-01-30 Thread Duncan Temple Lang
Hi "KTD Services" (!) I assume by DELETE, you mean the HTTP method and not the value of a parameter named _method that is processed by the URL script. If that is the case, then you want to use the customRequest option for the libcurl operation and you don't need or want to use postForm().

[R] discrete simulated annealing

2012-01-30 Thread yan jiao
Dear All, I need to use simulated annealing for optimization is there a way to limit the search place to only discrete values? And also exclude certain solutions, e.g. exclude the solutions when all the variables are the same? many thanks Yan __ R

Re: [R] handling a lot of data

2012-01-30 Thread Paul Bivand
If you do not need all the variables in the SPSS files, use package 'memisc'. spss.system.file() and it's subset() allow you to just load the variables needed. You will need to transform into data.frame as the memisc data.set includes the SPSS attributes, user-missings etc. Paul Bivand Centre for

Re: [R] question on model.matrix

2012-01-30 Thread Paul Johnson
Greetings On Sat, Jan 28, 2012 at 2:43 PM, Daniel Negusse wrote: >> >> >> while reading some tutorials, i came across this and i am stuck. i want to >> understand it and would appreciate if anyone can tell me. >> >> design <- model.matrix(~ -1+factor(c(1,1,2,2,3,3))) >> >> can someone break dow

Re: [R] repeat function for entire list of matrices

2012-01-30 Thread R. Michael Weylandt
lapply() takes a function in its second argument, but that is not what you passed it. Also, there's no such construct in R as "." What happens with the code I gave you? Michael On Sun, Jan 29, 2012 at 4:28 PM, pabears wrote: > didn't seem to quite work: > > i tried different subsetting.

Re: [R] handling a lot of data

2012-01-30 Thread R. Michael Weylandt
This won't help with large memory issues, but just a pointer: When you start to construct data_all with these commands data_all = vector("list", 17); data_all[[1993]] = data1993; The first pre-allocates a list of length 17, but the second adds the data to the 1993rd slot requiring a complete rea

Re: [R] package does not have a NAMESPACE

2012-01-30 Thread Petr Savicky
On Mon, Jan 30, 2012 at 02:35:29PM +, Reinker, Stefan wrote: > Hello Ondrej, > > I experienced the same problem and circumvented it by installing R 2.13.2 > where the package runs fine. I also tried contacting the authors with not > reply so far, but if you manage to solve the NAMESPACE prob

Re: [R] ROC curve

2012-01-30 Thread Corey Dow-Hygelund
Hi Josiane, Concerning ROC curves, the package ROCR should do what you want to do. Use install.packages to add it to you library. Getting you data into a text file format, use read.delim to read into an data frame. Once you have a data frame, you can use the methods in ROCR to analyze the data.

Re: [R] And Statement for two if functions

2012-01-30 Thread Jorge I Velez
Hi kerry1912, And what exactly would you like to do after the if(...) statement? How did you read your data in? What's the output of str(yourdata)? Please see http://www.R-project.org/posting-guide.htmland help us to help you. Regards, Jorge On Mo

Re: [R] merge multiple data frames

2012-01-30 Thread MacQueen, Don
Does this example help? It doesn't handle the problem of common field names, but see below for another example. df1 <- data.frame(jn=1:4, a1=letters[1:4], a2=LETTERS[1:4]) df2 <- data.frame(jn=2:6, b1=month.abb[2:6]) df3 <- data.frame(jn=3:7, x=rnorm(5), y=13:17) dfn <- sqldf('select * from df1 l

[R] Displaying percentages within bars

2012-01-30 Thread Mario Giesel
Hello, R friends,   I've got this graph: p <- ggplot(diamonds, aes(x = color))  + scale_fill_brewer(type="seq", pal = "Blues")   + scale_y_continuous("",formatter="percent") + coord_flip() p+geom_bar(aes(fill=cut),colour='black',position='fill')   Is it possible to place percentages within each f

[R] Fw: Variable selection based on both training and testing data

2012-01-30 Thread SR Millis
From: SR Millis To: Jin Minming Sent: Monday, January 30, 2012 9:25 AM Subject: Re: [R] Variable selection based on both training and testing data Jim, First, stepwise methods for variable selection should be avoided.  Frank Harrell (in Regression Modeling Strategies) discusses this at le

Re: [R] package does not have a NAMESPACE

2012-01-30 Thread Reinker, Stefan
Hello Ondrej, I experienced the same problem and circumvented it by installing R 2.13.2 where the package runs fine. I also tried contacting the authors with not reply so far, but if you manage to solve the NAMESPACE problem in 2.14 I would be interested. The source does not seem to be availabl

[R] And Statement for two if functions

2012-01-30 Thread kerry1912
I want to perform two if functions at the same time: if(home team > away team & home team <= away team + 7) in R but i am struggling to work out how to write this correctly. Thanks for any help. -- View this message in context: http://r.789695.n4.nabble.com/And-Statement-for-two-if-functions-

[R] about changing line type and line width in Taylor Diagram

2012-01-30 Thread Roopashree Shrivastava
Dear all, I am new to plotting Taylor Diagram using plotrix package within R, hence this post. I have written a script which plots Taylor Diagram with one reference and 7 model values. However the font size, line width and line type are not clear when saving the diagram as a jpeg file. I tried the

[R] Problem in Fitting model equation in "nls" function

2012-01-30 Thread ram basnet
Dear R users,   I am struggling to fit expo-linear equation to my data using "nls" function. I am always getting error message as i highlighted below in yellow color:     ### Theexpo-linear equation which i am interested to fit my data:   response_variable =  (c/r)*log(1+exp(r*(Day-tt))), w

Re: [R] merge multiple data frames

2012-01-30 Thread Massimo Bressan
thanks michael it's working like a charm: that's exaclty what I was looking for bye max - Original Message - From: "R. Michael Weylandt" To: "Massimo Bressan" Cc: Sent: Friday, January 27, 2012 4:16 PM Subject: Re: [R] merge multiple data frames Oh, sorry -- I assumed that was i

[R] r-help; parameter estimate

2012-01-30 Thread Christopher Kelvin
I need help, the codes below estimates the weibull parameters with complete failure, my question is how do i change the state to include some censoring (may be right, type-I or type-II) to generate and estimate the parameters. thank you x=rweibull(10,2,2) library(survival) d<-data.frame(ob=c(x),

[R] [R-pkgs] New package "geotools"

2012-01-30 Thread Antoine Lucas
Dear All, I have upload a new package "geotools", that main purpose is to propose functions to get distance between cities, with city name or postal code (usage: shipment). For now: there is only the french cities dataset. An example: Return all postal code at 7 kms from Paris: codesNearToCode(z

Re: [R] merge multiple data frames

2012-01-30 Thread Massimo Bressan
hi don I followed your advice about using sqldf package but the problem of labelling the fields persists; for some reasons I can not properly handle the sql 'as' statement a_b<-sqldf("select a.*, b.* from a left join b on a.date=b.date") a_b_c<-sqldf("select a_b.*, c.* from a_b left join c

[R] ANOVA factors

2012-01-30 Thread Wolfgang Polasek
Hi all How to make from a n x m matrix with the stack command 2 categorical factors in R, the row and the col factor? Is there a function for nice graphical outputs in ANOVA? Thanks Wolfgang [[alternative HTML version deleted]] __ R-help@r-pr

[R] parameter estimate

2012-01-30 Thread Christopher Kelvin
I need help, the codes below estimates the weibull parameters with complete failure, my question is how do i change the state to include some censoring (may be right, type-I or type-II) to generate and estimate the parameters. thank you x=rweibull(10,2,2) library(survival) d<-data.frame(ob=c(x),

[R] RCurl format

2012-01-30 Thread KTD Services
I am having trouble with the postForm function in RCurl. I want to send a the command DELETE https://somewebsite.com.json but I can't seem to find it. I could try: postForm(url, _method="DELETE", .opts = list(username:password) ) but I get the error: Error: unexpected input in "postFo

[R] ROC curve

2012-01-30 Thread Josiane NJIWA
Hello all, I am very new to R and i am facing two problems. First i didn't succeed changing the konsole language in english even after trying the line command set language='en'. I would like to plot ROC curves. I have a serie of 10 threshold tests that i do for 10 patients. The prediction for

Re: [R] percentage from density()

2012-01-30 Thread Duke
Great suggestions and comments, Bill, Greg and Rolf. You provided me some valuable ways to deal with the data I am working with. Thank you all so much! Bests, D. On 1/29/12 4:03 PM, William Dunlap wrote: If v is your original data, v<- c(-20, rep(0,98), 20) why not use mean( -20< v&

Re: [R] nice report generator?

2012-01-30 Thread Duncan Murdoch
On 30/01/2012 6:59 AM, Tal Galili wrote: Helloe dear Duncan, Gabor, Michael and others, After taking some time, I wrote a bridge function between a "cast_df" object from the {reshape} package into a table in Duncan's new {tables} package. The motivation was to make "cast_df" table prettier in t

[R] useR! 2012: Earlybird Registration for International R Users Conference, Nashville TN 12-15 2012

2012-01-30 Thread Frank Harrell
The 8th international R users conference useR! 2012 will be in Nashville TN USA June 12-15 with a special all-day pre-conference course from Bill Venables on June 11. We have a terrific lineup of half-day tutorials on June 12 and will have invited and contributed presentations of interest to a wi

[R] Checking for invalid dates: Code works but needs improvement

2012-01-30 Thread Paul Miller
Hi Rui, Marc, and Gabor, Thanks for your replies to my question. All were helpful and it was interesting to see how different people approach various aspects of the same problem. Spent some time this weekend looking at Rui's solution, which is certainly much clearer than my own. Managed to figu

Re: [R] Variable selection based on both training and testing data

2012-01-30 Thread Liaw, Andy
Variable section is part of the training process-- it chooses the model. By definition, test data is used only for testing (evaluating chosen model). If you find a package or function that does variable selection on test data, run from it! Best, Andy > -Original Message- > From: r-he

[R] Getting htmlParse to work with Hebrew? (on windows)

2012-01-30 Thread Tal Galili
Hello dear R-help mailing list. I wish to be able to have htmlParse work well with Hebrew, but it keeps to scramble the Hebrew text in pages I feed into it. For example: # why can't I parse the Hebrew correctly? library(RCurl) library(XML) u = "http://humus101.com/?p=2737"; a = getURL(u) a #

[R] Variable selection based on both training and testing data

2012-01-30 Thread Jin Minming
Dear all, The variable selection in regression is usually determined by the training data using AIC or F value, such as stepAIC. Is there some R package that can consider both the training and test dataset? For example, I have two separate training data and test data. Firstly, a regression mode

Re: [R] Installing Rcompression package

2012-01-30 Thread Prof Brian Ripley
On 30/01/2012 12:24, Jeremy MAZET wrote: Dear all I'm trying to install the Rcompression package under R-2.14.0 on a Windows plateform. I need it to use the Ropenoffice package Because there is no binary available, I'm trying to install it from source but I have always some error messages. I ha

[R] Installing Rcompression package

2012-01-30 Thread Jeremy MAZET
Dear all I'm trying to install the Rcompression package under R-2.14.0 on a Windows plateform. I need it to use the Ropenoffice package Because there is no binary available, I'm trying to install it from source but I have always some error messages. I have installed zlib and Bzip2 softwares,

Re: [R] nice report generator?

2012-01-30 Thread Tal Galili
Helloe dear Duncan, Gabor, Michael and others, After taking some time, I wrote a bridge function between a "cast_df" object from the {reshape} package into a table in Duncan's new {tables} package. The motivation was to make "cast_df" table prettier in the R terminal, as well as allow us to expor

[R] Consultant to program R-code dealing with social networks

2012-01-30 Thread Michael Haenlein
Dear all, I am looking for a consultant/ programmer to program a relatively simple R code for me. Specifically, I have about 50 social networks. These networks have between 5,000 and 5 million nodes and between 30,000 and 70 million edges. The code should (a) read one network into R, (b) draw a s

Re: [R] multiple column comparison

2012-01-30 Thread Petr PIKAL
Hi I did not see any response and actually I can not offer any ready made solution too. For such problems there could be various solutions from cycles to *apply, reshape or plyr options. However for anybody to start with it would be nice to get rather more clear description together with some

Re: [R] ColorBrewer question

2012-01-30 Thread Mario Giesel
It works! Thanks a lot for your explanations, Michael.   Good luck,  Mario Von: R. Michael Weylandt Cc: "r-help@r-project.org" Gesendet: 5:22 Montag, 30.Januar 2012 Betreff: Re: [R] ColorBrewer question I believe you need to use the scale_fill_brewer since fi

[R] Odp: Modifying whiskers in boxplots?

2012-01-30 Thread Petr PIKAL
Hi > > Hello, > > I know this has been covered on here before, but as a complete novice, I > need a little more guidance. I would like to produce boxplots with the > whiskers extending to the 10 and 90th percentiles. I found this code: > > myboxplot.stats <- function (x, coef = NULL, do.conf

Re: [R] handling a lot of data

2012-01-30 Thread Milan Bouchet-Valat
Le lundi 30 janvier 2012 à 09:54 +0100, Petr Kurtin a écrit : > Hi, > > I have got a lot of SPSS data for years 1993-2010. I load all data into > lists so I can easily index the values over the years. Unfortunately loaded > data occupy quite a lot of memory (10Gb) - so my question is, what's the >

[R] handling a lot of data

2012-01-30 Thread Petr Kurtin
Hi, I have got a lot of SPSS data for years 1993-2010. I load all data into lists so I can easily index the values over the years. Unfortunately loaded data occupy quite a lot of memory (10Gb) - so my question is, what's the best approach to work with big data files? Can R get a value from the fil

  1   2   >