Re: [R] scraping with session cookies

2012-09-18 Thread Duncan Temple Lang
Hi ? The key is that you want to use the same curl handle for both the postForm() and for getting the data document. site = u = "http://www.wateroffice.ec.gc.ca/graph/graph_e.html?mode=text&stn=05ND012&prm1=3&syr=2012&smo=09&sday=15&eyr=2012&emo=09&eday=18"; library(RCurl) curl = getCurlHandle(c

Re: [R] How to convert a graph into an image in R

2012-09-18 Thread David Winsemius
On Sep 18, 2012, at 10:57 PM, punitha wrote: > In R, I want to convert the plotted graph into an image and save it, so that > i can make use of it later. > Generally the GUI's handle this with 'save as...' functions. but if you are in a console session then consult: ?Devices ?pdf ?png ?jpeg

[R] How to convert a graph into an image in R

2012-09-18 Thread punitha
In R, I want to convert the plotted graph into an image and save it, so that i can make use of it later. - Thank you, with regards, Punitha -- View this message in context: http://r.789695.n4.nabble.com/How-to-convert-a-graph-into-an-image-in-R-tp4643584.html Sent from the R help mailing

Re: [R] help with calculation from dataframe with multiple entries per sample

2012-09-18 Thread Jul_biologyGrad
Thanks everyone for the help! I pulled together a bunch of your suggestions to get the result that I needed. I'm posting my final code below. Probably not the most efficient way of doing things but gets the job done in a way that a newbie can understand! ##Here again is the example dataset Sample

Re: [R] ommoting rows

2012-09-18 Thread Jose Narillos de Santos
Many ThanKs, The subsecction on R is very clarifying. Sorry yesterday I was a little confused Many thanks. 2012/9/18 Ben Tupper > Hi, > > On Sep 18, 2012, at 3:25 PM, Bert Gunter wrote: > > > Please read An Introduction to R (or other R tutorial) to learn about > > indexing in R. > > > > ?"["

Re: [R] download truncating large files

2012-09-18 Thread Ian Shannon
Jim, Thanks. However that doesn't solve my problem. I should have said my problem is finding the source of the error:- is it me?; or is it the local system here?; or is it a problem with R's internal download command. I know that the package is being truncated because I did download it outsid

[R] scraping with session cookies

2012-09-18 Thread CPV
Hi, I am starting coding in r and one of the things that i want to do is to scrape some data from the web. The problem that I am having is that I cannot get passed the disclaimer page (which produces a session cookie). I have been able to collect some ideas and combine them in the code below but I

Re: [R] Trap an error from a function

2012-09-18 Thread William Dunlap
Instead of "someClass" %in% class(someThing), as in > function(x) if( "try-error" %in% > class( try( test[test[x:1]] ) ) ){ > 2}else{0} it is better to use inherits(someThing, "someClass"), as in function(x) { res <- try( test[test[x:1]],

Re: [R] Trap an error from a function

2012-09-18 Thread Thomas Lumley
On Wed, Sep 19, 2012 at 12:56 PM, David Winsemius wrote: > Basically you run you each iteration of your code inside try() and then test > to see if it's class vector includes "try-error", ... then you can do > something with the result or return NA. This may makeit more useful because I > retur

Re: [R] Trap an error from a function

2012-09-18 Thread Peter Langfelder
On Tue, Sep 18, 2012 at 5:35 PM, David Winsemius wrote: > > On Sep 18, 2012, at 5:10 PM, John Sorkin wrote: > >> Window 7 >> R 2.15 >> >> I am writing a simulation which generates sample sized estimates from >> simulated data. When I run the function shown below, >> power.t.test(delta=14.02528,sd

Re: [R] Trap an error from a function

2012-09-18 Thread David Winsemius
Basically you run you each iteration of your code inside try() and then test to see if it's class vector includes "try-error", ... then you can do something with the result or return NA. This may makeit more useful because I return the results at each iteration if there was no error: sapply(tes

Re: [R] Trap an error from a function

2012-09-18 Thread John Sorkin
David, Thank you. I will study your code so I can understand your suggestion. Thanks, John John David Sorkin M.D., Ph.D. Chief, Biostatistics and Informatics University of Maryland School of Medicine Division of Gerontology Baltimore VA Medical Center 10 North Greene Street GRECC (BT/18/GR) Bal

Re: [R] Trap an error from a function

2012-09-18 Thread David Winsemius
On Sep 18, 2012, at 5:10 PM, John Sorkin wrote: > Window 7 > R 2.15 > > I am writing a simulation which generates sample sized estimates from > simulated data. When I run the function shown below, > power.t.test(delta=14.02528,sd=1.945226,power=0.8,sig.level=0.05) > > I get an error message: >

Re: [R] Trap an error from a function

2012-09-18 Thread Duncan Murdoch
On 12-09-18 8:10 PM, John Sorkin wrote: Window 7 R 2.15 I am writing a simulation which generates sample sized estimates from simulated data. When I run the function shown below, power.t.test(delta=14.02528,sd=1.945226,power=0.8,sig.level=0.05) I get an error message: power.t.test(delta=14.0

Re: [R] memory leak using XML readHTMLTable

2012-09-18 Thread J Toll
On Mon, Sep 17, 2012 at 3:16 PM, Duncan Temple Lang wrote: > The version of the package on github is in the > standard R format and that part of the README is > no longer relevant. Sorry for the confusion. > > It might be simplest to pick up a tar.gz file of the source at > > http://www.omegahat.

Re: [R] [newbie] aggregating table() results and simplifying code with loop

2012-09-18 Thread Rui Barradas
Hello, Inline Em 18-09-2012 23:42, Davide Rizzo escreveu: Hi dear R-helpers, I really appreciate your "coding the answers" to (my) questions. I am now in the situation to get results in a very shorter time and with a proper code. + the study (summary) + In (short) respo

[R] Trap an error from a function

2012-09-18 Thread John Sorkin
Window 7 R 2.15 I am writing a simulation which generates sample sized estimates from simulated data. When I run the function shown below, power.t.test(delta=14.02528,sd=1.945226,power=0.8,sig.level=0.05) I get an error message: > power.t.test(delta=14.02528,sd=1.945226,power=0.8,sig.level=0

Re: [R] Cochran-Mantel-Haenszel test

2012-09-18 Thread Peter Langfelder
Bert is correct that this is a statistics questions, but I'll throw in my 2 cents anyway. The CMH test is formulated for count data and makes certain assumptions on the distribution of the observed values. Since you don't have count data (your data are not integer), chances are that the assumptions

Re: [R] [newbie] aggregating table() results and simplifying code with loop

2012-09-18 Thread Davide Rizzo
Hi dear R-helpers, I really appreciate your "coding the answers" to (my) questions. I am now in the situation to get results in a very shorter time and with a proper code. + the study (summary) + In (short) response to the question by John, the global target of the analys

Re: [R] Cochran-Mantel-Haenszel test

2012-09-18 Thread Bert Gunter
This looks more like a statistics than an R issue. Try posting on stats.stackexchange.com, a statistics list, instead. ALternatively, talk to your local statistician (if there is one). -- Bert On Tue, Sep 18, 2012 at 3:02 PM, McPhie, Romney wrote: > Hello, > > I have some satellite tag time-at-

[R] Cochran-Mantel-Haenszel test

2012-09-18 Thread McPhie, Romney
Hello, I have some satellite tag time-at-depth (TAD) frequency data that I would like some help with. The data was transmitted via satellite as percent time spent in each of 7 depth bins (0m, 0-1m, 1-10m, 10-50m etc.), binned over 6-hour intervals. I categorized each row of data corresponding

Re: [R] Simple String Operation.

2012-09-18 Thread arun
Hi Bhupendrasinh, No problem. One more solution that works: gsub("@.*?\\s","",x) #[1] "Even in the mid-west spring is hardly for 3 weeks, while the scenario is different." A.K. From: Bhupendrasinh Thakre To: arun Cc: David Winsemius ; R help Sent: Tuesda

Re: [R] Contradictory results between different heteroskedasticity tests

2012-09-18 Thread John Fox
Dear Carlos, Please note that the default alternative hypothesis is different in ncvTest() and bptest() -- in the former that the error variance is a function of the expectation of Y (hence the formula ~ fitted.values, with 1 df for the test), and in the latter that the error variance is a functio

Re: [R] Expected Shortfall using cornish fisher expansion

2012-09-18 Thread R. Michael Weylandt
On Tue, Sep 18, 2012 at 6:19 PM, Eko andryanto Prakasa wrote: > > Helloo, > > > i have measure VaR with time dependen volatility (GARCH) and now want to > measure expected shortfall (ES) using cornish fisher expansion (cause > non-normal distribution), but i have limitedness about using R. Could

Re: [R] Estimating the ECDF

2012-09-18 Thread Rui Barradas
Hello, I'm not sure I understand the question, but is it something like this? set.seed(3648) x <- rnorm(100) plot(ecdf(x), cex = 0.5) # Now create a function; don't use # uppercase F, it's a symbol for FALSE. f <- ecdf(x) f(0) # Should be near 0.5 Hope this helps, Rui Barradas Em 18-09-2012

Re: [R] Estimating the ECDF

2012-09-18 Thread R. Michael Weylandt
On Tue, Sep 18, 2012 at 8:50 PM, Waltenegus Dargie wrote: > Dear all, > > I would like to estimate (mathematically express) the ecdf of a random > variable using a curve fitting technique. Can anyone help me how to do this? > > Thanks. > Waltenegus > Waltengus, This is really terribly vague: per

[R] Estimating the ECDF

2012-09-18 Thread Waltenegus Dargie
Dear all, I would like to estimate (mathematically express) the ecdf of a random variable using a curve fitting technique. Can anyone help me how to do this? Thanks. Waltenegus [[alternative HTML version deleted]] __ R-help@r-project.org maili

Re: [R] ommoting rows

2012-09-18 Thread Ben Tupper
Hi, On Sep 18, 2012, at 3:25 PM, Bert Gunter wrote: > Please read An Introduction to R (or other R tutorial) to learn about > indexing in R. > > ?"[" or ?subset also will tell you how to do it, but they are rather terse. > That's a great start, but it might be helpful to provide a bit more sp

Re: [R] Conditional operations in R

2012-09-18 Thread ramoss
Thanks to all who responded, particularly to Michael. Your solution was the easiest to understand & to implement. This worked beautifully: cmtot <- arrange(cmtot, -PCTTOT)#sort by descending top <- with(cmtot,which.max(cumsum(PCTTOT) >= 50)) topcm <- cmtot[seq(1,top),] -- View this message

[R] Contradictory results between different heteroskedasticity tests

2012-09-18 Thread Carlos Pita
Hi all, I'm getting contradictory results from bptest and ncvTest on a model calculated by GLS as: olslm = lm(log(rr)~log(aloi)*reg*inv, data) varlm = lm(I(residuals(olslm)^2)~log(aloi)*reg*inv, data) glslm = lm(log(rr)~log(aloi)*reg*inv, data, weights=1/fitted(varlm)) Testing both olslm and gls

Re: [R] ommoting rows

2012-09-18 Thread arun
Hi, Try this:  dat1<-data.frame(V1=c(-9552,0,9614,0,-9752,0,0),V2=c(9552,9653,9614,9527,9752,9883,9865),V3=c("C",0,"V",0,"C",0,0))  as.matrix(subset(dat1,V3!=0)) #  V1  V2 V3 #1 "-9552" "9552" "C" #3 " 9614" "9614" "V" #5 "-9752" "9752" "C" A.K. - Original Message - From: Jose

Re: [R] ommoting rows

2012-09-18 Thread David Winsemius
On Sep 18, 2012, at 12:08 PM, Jose Narillos de Santos wrote: > Hi I have an output data Data.csv > > this style: > > ,"V1","V2","V3" 1,"-9552","9552","C" 2,"0","9653","0" > 3,"9614","9614","V" 4,"0","9527","0" 5,"-9752","9752","C" > 6,"0","9883","0" 7,"0","9865","0" > I want to create a ne

Re: [R] ommoting rows

2012-09-18 Thread Bert Gunter
Please read An Introduction to R (or other R tutorial) to learn about indexing in R. ?"[" or ?subset also will tell you how to do it, but they are rather terse. -- Bert On Tue, Sep 18, 2012 at 12:08 PM, Jose Narillos de Santos wrote: > Hi I have an output data Data.csv > > this style: > > ,"V1

[R] ommoting rows

2012-09-18 Thread Jose Narillos de Santos
Hi I have an output data Data.csv this style: ,"V1","V2","V3" 1,"-9552","9552","C" 2,"0","9653","0" 3,"9614","9614","V" 4,"0","9527","0" 5,"-9752","9752","C" 6,"0","9883","0" 7,"0","9865","0" I want to create a new matrix ommintg all the rows where third column has 0. There is a way to do

Re: [R] extracting column at regular intervals starting from different columns

2012-09-18 Thread Berend Hasselman
On 18-09-2012, at 19:21, eliza botto wrote: > > Dear useRs, > i had a matrix with 31 rows and 444 columns and i wanted to extract every > 37th column of that matrix starting from 1. more precisely i wanted to select > columns 1, 38,75, 112 and so on. then doing the same by starting from column

Re: [R] Simple String Operation.

2012-09-18 Thread Bhupendrasinh Thakre
Thanks David and Arun It solved my problem. Appreciate the help in understanding this. Best Regards, Bhupendrasinh Thakre *Disclaimer :* The information contained in this communication is confidential and may be legally privileged. It is intended solely for the use of the individual or ent

Re: [R] Data frame divison by another data frame with common groups and different length

2012-09-18 Thread Rui Barradas
Hello, Try the following. agg <- aggregate(buddleiat ~ samplet + datet, data = traffic, FUN = mean) mrg <- merge(encounters, agg, by.x = c("samplec", "datec"), by.y = c("samplet", "datet")) mrg$Div <- with(mrg, Bladen/buddleiat) Hope this helps, Rui Barradas Em 18-09-2012 12:1

Re: [R] Simple String Operation.

2012-09-18 Thread arun
HI, This may also work: gsub("@\\S+\\s*","",x) #[1] "Even in the mid-west spring is hardly for 3 weeks, while the scenario is different." #or gsub("@\\w+\\s*","",x) #[1] "Even in the mid-west spring is hardly for 3 weeks, while the scenario is different." A.K. - Original Message - Fro

[R] Expected Shortfall using cornish fisher expansion

2012-09-18 Thread Eko andryanto Prakasa
Helloo, i have measure VaR with time dependen volatility (GARCH) and now want to measure expected shortfall (ES) using cornish fisher expansion (cause non-normal distribution), but i have limitedness about using R. Could you help me, how measure that ES with cornish fisher expansion using R..

[R] Determine Threshold value in Extreme Value Theory

2012-09-18 Thread Eko andryanto Prakasa
Hi all, I want to measure value at risk with Extreme Value Theory (EVT) - Peak Over Threshold Approaches. Is there a function in R to determine Threshold in EVT ? Is there a function in R to determine Threshold in EVT using Sample Mean Excess Function? I really need your help.. thank you

Re: [R] extracting column at regular intervals starting from different columns

2012-09-18 Thread Clint Bowman
Try: x <- 1:444 start<-2 x[c(rep(FALSE,start-1),TRUE, rep(FALSE, 36-start+1))] # [1] 2 39 76 113 150 187 224 261 298 335 372 409 start<-30 x[c(rep(FALSE,start-1),TRUE, rep(FALSE, 36-start+1))] # [1] 30 67 104 141 178 215 252 289 326 363 400 437 start<-37 x[c(rep(FALSE,start-1),TRUE, rep(F

Re: [R] extracting column at regular intervals starting from different columns

2012-09-18 Thread Berend Hasselman
On 18-09-2012, at 19:21, eliza botto wrote: > > Dear useRs, > i had a matrix with 31 rows and 444 columns and i wanted to extract every > 37th column of that matrix starting from 1. more precisely i wanted to select > columns 1, 38,75, 112 and so on. then doing the same by starting from column

Re: [R] extracting column at regular intervals starting from different columns

2012-09-18 Thread David Winsemius
On Sep 18, 2012, at 10:21 AM, eliza botto wrote: > > Dear useRs, > i had a matrix with 31 rows and 444 columns and i wanted to extract every > 37th column of that matrix starting from 1. more precisely i wanted to select > columns 1, 38,75, 112 and so on. then doing the same by starting from c

[R] extracting column at regular intervals starting from different columns

2012-09-18 Thread eliza botto
Dear useRs, i had a matrix with 31 rows and 444 columns and i wanted to extract every 37th column of that matrix starting from 1. more precisely i wanted to select columns 1, 38,75, 112 and so on. then doing the same by starting from column number 2(2,39,76,113...). i was advised to use >x

Re: [R] Simple String Operation.

2012-09-18 Thread Bhupendrasinh Thakre
Thanks David. Appreciate your response and solving my problem. Best Regards, Bhupendrasinh Thakre Sent from my iPhone On Sep 18, 2012, at 11:58 AM, David Winsemius wrote: > > On Sep 18, 2012, at 9:35 AM, Bhupendrasinh Thakre wrote: > >> Hi List, >> >> This is kind of very simple but I am n

Re: [R] Simple String Operation.

2012-09-18 Thread David Winsemius
On Sep 18, 2012, at 9:35 AM, Bhupendrasinh Thakre wrote: > Hi List, > > This is kind of very simple but I am not able to understand how it works... > I have a sentence like "Even in the mid-west spring is hardly for 3 weeks, > while @south the scenario is different." > > There are some more exa

Re: [R] Constraint Optimization with constrOptim

2012-09-18 Thread Ravi Varadhan
Hi Raimund, You can use spg() in the BB package. This requires that you have a projection rule for projecting an infeasible point onto the simplex defined by: 0 <= x <= 1, sum(x) = 1. I show you here how to project onto the unit simplex. So, this is how your problem can be solved: req

Re: [R] Conditional operations in R

2012-09-18 Thread Rui Barradas
Hello, In R you would use vectorized instructions, not a do while loop. dat <- read.table(text=" client pct_total A 15% B 10% C 10% D 9% E 8% F 6% G 4% ", header = TRUE) # Make it numeric dat$pct_total <- with(dat, as.numeric(su

[R] Simple String Operation.

2012-09-18 Thread Bhupendrasinh Thakre
Hi List, This is kind of very simple but I am not able to understand how it works... I have a sentence like "Even in the mid-west spring is hardly for 3 weeks, while @south the scenario is different." There are some more example of the same nature and don't know the source yet. What i want to do

Re: [R] Conditional operations in R

2012-09-18 Thread Bert Gunter
Have your read an Introduction to R? If not, do so before posting further. There are also many "R for SAS users" tutorials on the web I'm sure. Google or check CRAN. In particular, you need to understand how indexing works. See ?"[" and ?subset You will certainly have to define what you mean by "j

Re: [R] add reference lines (or grid) in background

2012-09-18 Thread Luigi
Dear all , Thank you for the replies. The idea of plotting back on top of the grid was the right direction and after browsing and browsing I found a tip in the R archive ([R] How to get a grid behind a boxplot) by Neuro LeSuperHéros which uses par(new=T): x<-rnorm(100) boxplot(x) abline(h=c(-1,0,

Re: [R] Conditional operations in R

2012-09-18 Thread R. Michael Weylandt
On Tue, Sep 18, 2012 at 3:41 PM, ramoss wrote: > Hello, > > I am a newbie to R coming from SAS background. I am trying to program the > following: > I have a monthly data frame with 2 variables: > > client pct_total > A 15% > B 10% > C 10% > D 9% > E

Re: [R] Error_Unlogit

2012-09-18 Thread R. Michael Weylandt
On Tue, Sep 18, 2012 at 4:12 PM, Ben Kamau wrote: > Hi all > > Kindly help, I am getting the message below > > Error: could not find function "unlogit" > > I got no idea what could be the problem?? It's likely in some package (mlogit perhaps?) which you need to install _and load_ with the library

Re: [R] I want to send the vector a into the Object A.......

2012-09-18 Thread arun
Hi, Try this:  print(assign(paste0(x[1],".Arms"),c(1,2,3))) [1] 1 2 3 # a.Arms #[1] 1 2 3 A.K. - Original Message - From: Sri krishna Devarayalu Balanagu To: Jean V Adams ; "r-help@r-project.org" Cc: Sent: Tuesday, September 18, 2012 5:08 AM Subject: Re: [R] I want to send the vector

Re: [R] Why x[1] is not getting substituted?

2012-09-18 Thread arun
Hi, Try this:  paste("Trial and",x[1], "sheet",collapse=" ") #[1] "Trial and a sheet" A.K. - Original Message - From: Sri krishna Devarayalu Balanagu To: "r-help@r-project.org" Cc: Sent: Tuesday, September 18, 2012 5:40 AM Subject: [R] Why x[1] is not getting substituted? Suppose I wa

[R] Conditional operations in R

2012-09-18 Thread ramoss
Hello, I am a newbie to R coming from SAS background. I am trying to program the following: I have a monthly data frame with 2 variables: client pct_total A 15% B 10% C 10% D 9% E 8% F 6% G 4% I need to come up w/ a monthly list o

[R] Error_Unlogit

2012-09-18 Thread Ben Kamau
Hi all Kindly help, I am getting the message below Error: could not find function "unlogit" I got no idea what could be the problem?? Thanks Kamau [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.c

Re: [R] Why x[1] is not getting substituted?

2012-09-18 Thread Greg Snow
In addition to Jessica's answers try sprintf("Trial and %s sheet", x[1]) library(gsubfn) fn$cat("Trial and `x[1]` sheet\n") On Tue, Sep 18, 2012 at 8:42 AM, Jessica Streicher wrote: >> paste("Trial and",x[1],"sheet") > [1] "Trial and a sheet" >> cat("Trial and",x[1],"sheet") > Trial and a sheet

Re: [R] extracting column and regular interval in R

2012-09-18 Thread eliza botto
thankyou Berend. regards eliza > Subject: Re: [R] extracting column and regular interval in R > From: b...@xs4all.nl > Date: Tue, 18 Sep 2012 17:43:15 +0200 > CC: r-help@r-project.org > To: eliza_bo...@hotmail.com > > > On 18-09-2012, at 16:55, eliza botto wrote: > > > > > Dear R users,

Re: [R] Lowest AIC after stepAIC can be lowered by manual reduction of variables

2012-09-18 Thread Greg Snow
Do you understand what you did (not the individual steps, but what the overall process does)? You simplified your model using things other than the AIC, if you go back and look at the AIC at each step that you did you will probably find that some of the intermediate steps actually had a slightly h

Re: [R] extracting column and regular interval in R

2012-09-18 Thread Berend Hasselman
On 18-09-2012, at 16:55, eliza botto wrote: > > Dear R users, > i have a matrix with 31 rows and 444 columns and i want to extract every 37th > column of that matrix starting from 1. more precisely i want to select > columns 1, 38,75, 112 and so on. then doing the same by starting from column

Re: [R] help with calculation from dataframe with multiple entries per sample

2012-09-18 Thread William Dunlap
The following works even when the input data frame has its rows scrambled. It does not currently check that there is exactly one entry in each sample for Time==2 and Time==3. within(mydata, `Gain2-3` <- ave(seq_along(Sample), Sample,

Re: [R] [newbie] aggregating table() results and simplifying code with loop

2012-09-18 Thread Rui Barradas
Hello, Em 18-09-2012 15:29, John Kane escreveu: Looks very interesting and as I said you're a much better progamer than I am. I get headaches using lapply()! Thanks! As for lapply, if you understand apply you'll understand lapply. With some differences, the principle is the same. I am going

Re: [R] extracting column and regular interval in R

2012-09-18 Thread eliza botto
thnkyou very much micheal. i worked!!! regards eliza > From: michael.weyla...@gmail.com > Date: Tue, 18 Sep 2012 15:58:31 +0100 > Subject: Re: [R] extracting column and regular interval in R > To: eliza_bo...@hotmail.com > CC: r-help@r-project.org > > x[c(TRUE, rep(FALSE, 36)),] > > and let r

Re: [R] extracting column and regular interval in R

2012-09-18 Thread R. Michael Weylandt
x[c(TRUE, rep(FALSE, 36)),] and let recycling work its magic! To concretize: x <- 1:100 x[c(TRUE, rep(FALSE, 4))] Cheers, Michael On Tue, Sep 18, 2012 at 3:55 PM, eliza botto wrote: > > Dear R users, > i have a matrix with 31 rows and 444 columns and i want to extract every 37th > column of

[R] extracting column and regular interval in R

2012-09-18 Thread eliza botto
Dear R users, i have a matrix with 31 rows and 444 columns and i want to extract every 37th column of that matrix starting from 1. more precisely i want to select columns 1, 38,75, 112 and so on. then doing the same by starting from column number 2(2,39,76,113...). i know that there is a ma

Re: [R] Data frame divison by another data frame with common groups and different length

2012-09-18 Thread R. Michael Weylandt
On Tue, Sep 18, 2012 at 12:17 PM, Marta Miguel wrote: > Dear all, > > > I have two different data frames, that have two common variables: date and > sample. Here is a small extract of both of them > >> head(traffic) > datetsessiont samplet buddleiat > 1 07-08-20121 1

Re: [R] Zip a file

2012-09-18 Thread R. Michael Weylandt
On Tue, Sep 18, 2012 at 9:40 AM, Rantony wrote: > > Error: could not find function "zip" > > So, is it required to install any package for zip functioning ? Technically, one needs the "utils" package, but if it's not autoloading, something seems quite messed up with your R installation. Do you ha

Re: [R] I want to send the vector a into the Object A.......

2012-09-18 Thread Berend Hasselman
On 18-09-2012, at 11:08, Sri krishna Devarayalu Balanagu wrote: > Thank you very much > I am having one more doubt. Please clarify it, if possible. > > x = c("a", "b", "c", "d", "e") > suppose I want to create an object named "a.Arms" with the elements 1,2,3. I > am trying with following code.

Re: [R] Why x[1] is not getting substituted?

2012-09-18 Thread Jessica Streicher
> paste("Trial and",x[1],"sheet") [1] "Trial and a sheet" > cat("Trial and",x[1],"sheet") Trial and a sheet On 18.09.2012, at 11:40, Sri krishna Devarayalu Balanagu wrote: > Suppose I want the output as "Trial and a sheet" without quotes > x=c("a", "b", "c") > print("Trial and x[1] sheet") > >

Re: [R] add reference lines (or grid) in background

2012-09-18 Thread Jose Iparraguirre
Dear Luigi, Here's an option: boxplot(x, boxcol="white", whiskcol="white",medcol="white",staplecol="white") abline(h=c(-1,0,1)) grid(NA, 4, lwd = 2) boxplot(x,add=T) Regards, José Iparraguirre -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]

Re: [R] [newbie] aggregating table() results and simplifying code with loop

2012-09-18 Thread John Kane
Looks very interesting and as I said you're a much better progamer than I am. I get headaches using lapply()! I am going to have to spend some time stepping through the functions to really see what you are doing. However if I understand the output, for example one can simply aggreate the info

Re: [R] Appending many different and separate Excel files using R

2012-09-18 Thread Rui Barradas
Hello, This is the sort of question that could interess others, so you should have CCed it to the list. As for the question, from the package vignette, section 3.3.6: "writeWorksheetToFile() is a wrapper function, calling loadWorkbook(), createSheet() and saveWorkbook() functions subsequently

Re: [R] count NAs per week

2012-09-18 Thread Tagmarie
Thank you Arun, that was exactly what I was looking for. This is the second time you helped me in this mailing list. Thanks! And also thanks to all of the others of you whou helped me. It is amazing how many possibilities there are to solve my problem (which isn't a prob now anymore). Have a gre

[R] "rugarch" package

2012-09-18 Thread nserdar
My code: spec<-ugarchspec(variance.model = list(model = "sGARCH", garchOrder = c(1, 1), submodel = "Null", external.regressors = NULL, variance.targeting = FALSE), mean.model = list(armaOrder=c(0,0),include.mean =FALSE, archm = FALSE, archpow = 1, arfima = FALSE, external.regressors = NULL, archex

Re: [R] Formula in a data-frame

2012-09-18 Thread arun
Hi, May be this helps you. TF1<-aggregate(Frequency~Specie,data=Frequency,FUN=sum) TV1<-aggregate(Volume~Specie,data=Volume,FUN=sum) new1<-merge(TF1,Frequency, by="Specie") new2<-merge(TV1,Volume,by="Specie") new1$Fi<-new1$Frequency.y/new1$Frequency.x  new2$Vi<-new2$Volume.y/new2$Volume.x res<-n

[R] Comparing rqpd() and rq()

2012-09-18 Thread sseemann
Dear R users, I am trying to estimate a panel data model using rqpd(). I also estimated the same model using rq() and dummy variables for the groups. The coefficient estimates differ substantially between the two approaches (rqpd() produces substantially larger coefficients). Should the two appro

Re: [R] Summarizing data containing data/time information (as factor)

2012-09-18 Thread arun
HI, Try this: source("Data20120918.txt") dat2<-within(dat1,{V2<-as.POSIXct(V2,format="%d/%m/%Y %H:%M")})  res<-subset(dat3,V2>=as.POSIXct("2012-04-29 12:00:00")& V2<=as.POSIXct("2012-05-01 12:00:00")) head(res) # V1  V2   V3 #18 532703 2012-04-29 12:00:00 0.04 #19 532703 2012-

[R] Why x[1] is not getting substituted?

2012-09-18 Thread Sri krishna Devarayalu Balanagu
Suppose I want the output as "Trial and a sheet" without quotes x=c("a", "b", "c") print("Trial and x[1] sheet") Getting "Trial and x[1] sheet" Can anyone help? Notice: The information contained in this electronic mail message is intended only for the use of the designated recipient. This messa

Re: [R] Zip a file

2012-09-18 Thread Rantony
Yes. It’s a part of a particular function. It is required thing to be done in R, otherwise we have to be done manually and that will take time. From: arun kirshna [via R] [mailto:ml-node+s789695n4643401...@n4.nabble.com] Sent: Monday, September 17, 2012 11:14 PM To: Akkara, Antony (GE

Re: [R] I want to send the vector a into the Object A.......

2012-09-18 Thread Sri krishna Devarayalu Balanagu
Thank you very much I am having one more doubt. Please clarify it, if possible. x = c("a", "b", "c", "d", "e") suppose I want to create an object named "a.Arms" with the elements 1,2,3. I am trying with following code. But getting error paste(x[1], ".Arms", sep="") <- c(1,2,3) Error: could not f

[R] Lowest AIC after stepAIC can be lowered by manual reduction of variables

2012-09-18 Thread Florian Moser
Hello I am not really a statistic person, so it's possible i did something completely wrong... if this is the case: sorry... I try to get the best GLM model (with the lowest AIC) for my dataset. Therefore I run a stepAIC (in the "MASS" package) for my GLM allowing only two-variable-interactions.

[R] Data frame divison by another data frame with common groups and different length

2012-09-18 Thread Marta Miguel
Dear all, I have two different data frames, that have two common variables: date and sample. Here is a small extract of both of them > head(traffic) datetsessiont samplet buddleiat 1 07-08-20121 1 1 2 07-08-20121 1 1 3 07-08-2012

[R] [Re] add reference lines (or grid) in background

2012-09-18 Thread Jose Iparraguirre
Dear Luigi, Here's an option: boxplot(x, boxcol="white", whiskcol="white",medcol="white",staplecol="white") abline(h=c(-1,0,1)) grid(NA, 4, lwd = 2) boxplot(x,add=T) Regards, José Iparraguirre -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org

Re: [R] add reference lines (or grid) in background

2012-09-18 Thread Kenn Konstabel
There is a "panel.first" argument that can be used with many different types of plots. plot(x, panel.first=abline(h=-3:3, lty="dotted", col="gray"), pch=16, col="red", cex=3) # red big plotting characters: to show that ablines are drawn before plotting # the result is different from doing the plot

Re: [R] Formula in a data-frame

2012-09-18 Thread Rui Barradas
Hello, 1) Instead of computing TFrequency and TVolume like you have, try the following. TF <- with(Frequency, ave(Frequency, Specie, FUN = sum)) TV <- with(Volume, ave(Volume, Specie, FUN = sum)) Fi <- with(Frequency, Frequency/TF) Vi <- with(Volume, Volume/TV) Importance <- Fi*Vi/sum(Fi*Vi)

Re: [R] extracting values

2012-09-18 Thread John Kane
Hi, Since most of us are unlikely to have a copy of the book available perhaps you could supply the following informaion' What packages are you using besides the basic R installation What is the code What is the data > The best way to supply sample data is to use the dput() function to output a

Re: [R] add reference lines (or grid) in background

2012-09-18 Thread John Kane
Not sure if it is quite the same but ggplot2 does this as its default formatting. library(ggplot2) x<-rnorm(100) qplot(factor(0),x, geom="boxplot") John Kane Kingston ON Canada > -Original Message- > From: marongiu.lu...@gmail.com > Sent: Tue, 18 Sep 2012 09:35:47 +0100 > To: r-help@r-

Re: [R] eval(parse(...)) only once in a function

2012-09-18 Thread Christof Kluß
Hi Thomas thx, already the e <- parse(text="df$str==12")[[1]] is nice. So I have not to call parse in my function! (The function is called very often, so it makes the program much faster.) And eval(bquote(function(df) b<-.(e))) is great! That's exactly what I was looking for. Christof Am 17-0

Re: [R] add reference lines (or grid) in background

2012-09-18 Thread Jim Lemon
On 09/18/2012 06:35 PM, Luigi wrote: Dear all, Is there a simple way to add reference lines in background? I am trying with abline() or grid() but the lines, since they are executed after the plot function, are draw on top. How can I draw such lines beneath the main plot? Here is an example:

[R] add reference lines (or grid) in background

2012-09-18 Thread Luigi
Dear all, Is there a simple way to add reference lines in background? I am trying with abline() or grid() but the lines, since they are executed after the plot function, are draw on top. How can I draw such lines beneath the main plot? Here is an example: x<-rnorm(100) boxplot(x) abline(h=c(

Re: [R] other files in \inst\doc

2012-09-18 Thread Uwe Ligges
On 17.09.2012 20:30, A.I. McLeod wrote: I would like to include a Mathematica notebook and cdf file (both are ASCII files) in the \inst\doc directory as supporting documentation. These files are not large, about 340K each one. When I check using R CMD check --as-cran ... I get the following war

Re: [R] creating graphs using Rook

2012-09-18 Thread Jeff Newmiller
FAQ 7.19 http://cran.r-project.org/doc/FAQ/R-FAQ.html --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live Go... Live: