Re: [R] (no subject)

2012-07-03 Thread Rui Barradas
Hello, Or maybe to avoid the typo (Market is column 5), use variables names, in something like myData <- read.table(text=" Date Stock1 Stock2 Stock3Market 01/01/2000 1 2 3 4 01/02/2000 5 6 7 8 0

[R] Printing from R Console in colour

2012-07-03 Thread amarjit chandhial
Hi,I want to be able to print in colour from the R console i.e. commands (in navy) with results (in red) as on the console.   From the console if I click on File -> Print, the commands with results print on my printer but only in monochrome, not in colour. Similarly, if I Edit -> Select All, Edit

Re: [R] How to use Sys.time() while writing a csv file name

2012-07-03 Thread PtitBleu
Hello, It seems that there is a problem with ":". If you only need the date, you can use as.Date(Sys.time()) instead of the complete form. If you need the time, you can try the following commands which change the ":" into "-" : newsystime<-<-format(Sys.time(),"%Y-%m-%d-%H-%M-%S") write.csv(data.f

Re: [R] Date

2012-07-03 Thread arun
Hi, Try this: Year<-c("01/2000","02/2000","03/2000") #If you want to convert it directly to month/year library(zoo) as.yearmon(Year,format="%m/%Y") [1] "Jan 2000" "Feb 2000" "Mar 2000" #As your intention is to have DD/MM/ format,  Year1<-paste("01/",Year,sep="") Year1 [1] "01/01/2000" "01/02

[R] Please help

2012-07-03 Thread Jun Chen
Dear All, I am a research student in environment. I have only little programming knowledge. I am currently doing the last project about rainfall impact on ground water quality in an area. It happens that I have to use R to read rainfall data (3 dimension) from ASC file (*.asc), and t

Re: [R] Data manipulation with aggregate

2012-07-03 Thread arun
Hi, Try this: myData = data.frame(Name = c('a', 'a', 'b', 'b'), length = c(1,2,3,4), type= c('x','x','y','z')) z<-aggregate(length~Name,myData,mean) z1<-aggregate(length~type,myData,mean) merge(z,merge(z,z1),all=TRUE)   Name length type 1    a    1.5    x 2    b    3.5 A.K. - Original

[R] help with filled.contour() -

2012-07-03 Thread Jonathan Hughes
Dear all, I can't figure out a way to have more than one plot using filled.contour() in a single plate. I tried to use layout() or par(), but the way filled.contour() is written seems to override those commands. Any suggestions would be really appreciated. Jonathan

Re: [R] problem loading siar

2012-07-03 Thread Pascal Oettli
Hello, It is not what happens. Function "convexhull" exists in both "siar" and "spatstat" packages. As you already load "spatstat", when you are loading "siar", the "convexhull" in "spatstat" is masked by the one in "siar". Thus, when you will run "convexhull" function, it will be the one fr

[R] problem loading siar

2012-07-03 Thread Sukran yalcin ozdilek
Hi, I have a problem while loading the "siar" program in R. When I am loading siar, system does not load convexhull. On the screen I have seen such writings. The following object(s) are masked from ‘package:spatstat’: convexhull How can I load the convexhull, how can I unmask from t

Re: [R] How to use Sys.time() while writing a csv file name

2012-07-03 Thread Vincy Pyne
Dear Mr Newmiller and Mr Oettli, Thanks a lot for your valuable guidance. Task is done. Thanks again. Regards Vincy --- On Wed, 7/4/12, Jeff Newmiller wrote: From: Jeff Newmiller Subject: Re: [R] How to use Sys.time() while writing a csv file name To: "Vincy Pyne" , r-help@r-project.org Re

Re: [R] loop for regression

2012-07-03 Thread Joshua Wiley
Hi, A few comments. First a for loop is probably not optimally efficient. Consider instead (using a bulit in example dataset): lm(cbind(mpg, hp) ~ cyl + vs, data = mtcars) which gives: Call: lm(formula = cbind(mpg, hp) ~ cyl + vs, data = mtcars) Coefficients: mpg hp (Inter

Re: [R] How to use Sys.time() while writing a csv file name

2012-07-03 Thread Jeff Newmiller
You forgot to follow the posting guide and tell us what operating system you are using (sessionInfo), but I am going to guess that you are on Windows where the colon (":") is an illegal symbol in filenames. Try formatting the time explicitly in the conversion to character using the format string

Re: [R] How to use Sys.time() while writing a csv file name

2012-07-03 Thread Pascal Oettli
Hello, Try something like that: > lgd <- format(Sys.time(), "%Y_%m_%d_%H_%M_%S") Regards, Pascal Le 04/07/2012 14:21, Vincy Pyne a écrit : Dear R helpers, I am using Beta distribution to generate the random no.s (recovery rates in my example). However, each time I need to save these random

Re: [R] (no subject)

2012-07-03 Thread Hasan Diwan
On 3 July 2012 22:03, Akhil dua wrote: > and I need to run a seperate regression of every stock on market > so I want to write a "for loop" so that I wont have to write codes again > and again to run the regression... > 1. Do give a subject line -- a blank one is commonly used by a virus. 2. I

Re: [R] loop for regression

2012-07-03 Thread Bert Gunter
?lm and note in particular the section beginning "If response is a matrix..." -- Bert On Tue, Jul 3, 2012 at 10:08 PM, Akhil dua wrote: > -- Forwarded message -- > From: Akhil dua > Date: Wed, Jul 4, 2012 at 10:33 AM > Subject: > To: r-help@r-project.org > > > Hi everyone I > h

[R] How to use Sys.time() while writing a csv file name

2012-07-03 Thread Vincy Pyne
Dear R helpers, I am using Beta distribution to generate the random no.s (recovery rates in my example). However, each time I need to save these random no.s in a csv format. To distinguish different csv files, one way I thought was use of Sys.time in the file name. My code is as follows - # My

Re: [R] loop for regression

2012-07-03 Thread Bert Gunter
Homework? (We don't do homework here). -- Bert On Tue, Jul 3, 2012 at 10:08 PM, Akhil dua wrote: > -- Forwarded message -- > From: Akhil dua > Date: Wed, Jul 4, 2012 at 10:33 AM > Subject: > To: r-help@r-project.org > > > Hi everyone I > have data on stock prices and market ind

[R] loop for regression

2012-07-03 Thread Akhil dua
-- Forwarded message -- From: Akhil dua Date: Wed, Jul 4, 2012 at 10:33 AM Subject: To: r-help@r-project.org Hi everyone I have data on stock prices and market indices and I need to run a seperate regression of every stock on market so I want to write a "for loop" so that I wo

[R] (no subject)

2012-07-03 Thread Akhil dua
Hi everyone I have data on stock prices and market indices and I need to run a seperate regression of every stock on market so I want to write a "for loop" so that I wont have to write codes again and again to run the regression... my data is in the format given below Date Stock

Re: [R] Date

2012-07-03 Thread Jeff Newmiller
?paste Please (re-) read the "Introduction to R" document supplied with the software for faster answers. Also, please read the Posting Guide mentioned at the bottom of every message on this list. In particular, providing data in raw tabular form is often ambiguous, and the use of the dput func

Re: [R] Is it possible to remove this loop? [SEC=UNCLASSIFIED]

2012-07-03 Thread Jin . Li
Thanks for your validation. Yes Peter's solution is the fastest, faster than the previous one by saving 25% time. It was missed out in my previous testing. Jin -Original Message- From: Pascal Oettli [mailto:kri...@ymail.com] Sent: Wednesday, 4 July 2012 2:07 PM To: Li Jin Cc: r-help@r-p

[R] Date

2012-07-03 Thread Akhil dua
Hi I have monthly data and the dates are in MM/YY Format I need to convert them into DD/MM/YY format by pasting 01 in place of DD to all the observations in my Year Column ex: YearStock Prices 01/2000 1 02/2000 2 03/2000 3 I need to convert them to Yea

Re: [R] Is it possible to remove this loop? [SEC=UNCLASSIFIED]

2012-07-03 Thread Pascal Oettli
Le 04/07/2012 12:43, Peter Ehlers a écrit : On 2012-07-03 17:23, jin...@ga.gov.au wrote: Thank you all for providing various alternatives. They are all pretty fast. Great help! Based on a test of a dataset with 800,000 rows, the time used varies from 0.04 to 11.56 s. The champion is: a1$h2 <-

Re: [R] Is it possible to remove this loop? [SEC=UNCLASSIFIED]

2012-07-03 Thread Peter Ehlers
On 2012-07-03 17:23, jin...@ga.gov.au wrote: Thank you all for providing various alternatives. They are all pretty fast. Great help! Based on a test of a dataset with 800,000 rows, the time used varies from 0.04 to 11.56 s. The champion is: a1$h2 <- 0 a1$h2[a1$h1=="H"] <- 1 Interesting. My t

Re: [R] Is it possible to remove this loop? [SEC=UNCLASSIFIED]

2012-07-03 Thread Jin . Li
Thank you all for providing various alternatives. They are all pretty fast. Great help! Based on a test of a dataset with 800,000 rows, the time used varies from 0.04 to 11.56 s. The champion is: > a1$h2 <- 0 > a1$h2[a1$h1=="H"] <- 1 Regards, Jin Geoscience Australia Disclaimer: This e-mail (and

Re: [R] Help! Please recommend good books/resources on visualizing data and understanding multivariate relations...

2012-07-03 Thread massimo di stefano
I found this [1] book interesting. About "big data" It really depends from a number of things... if can help, I know hdf5 work pretty Well with huge dataset . [1] http://www.ggobi.org/book/index.html On Jul 3, 2012 7:14 PM, "Michael" wrote: > Hi all, > > Could you please help me? > > I am look

Re: [R] Help! Please recommend good books/resources on visualizing data and understanding multivariate relations...

2012-07-03 Thread Rich Shepard
On Tue, 3 Jul 2012, Michael wrote: I am looking for books/pointers/resources/tutorials on visualizing complex/big data and on understanding multivariate relations in complicated data. Michael, You need to become familiar with the works of Edward Tufte, the dean of complex data visualization

[R] Help! Please recommend good books/resources on visualizing data and understanding multivariate relations...

2012-07-03 Thread Michael
Hi all, Could you please help me? I am looking for books/pointers/resources/tutorials on visualizing complex/big data and on understanding multivariate relations in complicated data. More specifically, we have categorical variables and are interested in how to visualize the categorical data and

Re: [R] EM algorithm to find MLE of coeff in mixed effects model

2012-07-03 Thread Paul Johnson
On Tue, Jul 3, 2012 at 12:41 PM, jimmycloud wrote: > I have a general question about coefficients estimation of the mixed model. > I have 2 ideas for you. 1. Fit with lme4 package, using the lmer function. That's what it is for. 2. If you really want to write your own EM algorithm, I don't feel

Re: [R] Data manipulation with aggregate

2012-07-03 Thread jim holtman
try this: > myData = data.frame(Name = c('a', 'a', 'b', 'b'), length = c(1,2,3,4), type + = c('x','x','y','z')) > > result <- do.call(rbind, lapply(split(myData, myData$Name), function(.name){ + data.frame(Name = .name$Name[1L] + , length = mean(.name$length) + , type = if (all(.name$type[1L] == .

Re: [R] design matrix creation in R

2012-07-03 Thread Bert Gunter
If David's response is what you were seeking, I would then ask: homework?? In general, explicit model matrices are not needed for linear modeling in R. Still not clear what you meant by "reparametrization," but if David's interpretation is correct, my "impossible" comment is clearly wrong. -- Be

Re: [R] help with read.table.ffdf parameters

2012-07-03 Thread MCOM
Marck, A little late, but perhaps this will help someone in the future. I am guessing that some of your "integer" fields contain scientific notation, and for some reason read.table is not interpreting those as integers. Consider changing the affected column classes from "integer" to "numeric" an

Re: [R] subset data based on values in multiple columns

2012-07-03 Thread arun
Hi, Try this: data1<-data.frame(date,time,count) dat1<-data1[with(data1,rev(order(count))),] data2<-subset(dat1,rle(dat1$count)$lengths==1) dat3<-aggregate(data2$count,list(data2$date),max) colnames(dat3)<-c("date","count") data4<-merge(dat3,data2)  data4<-data4[,c(1,3,2)]  data4     date   

Re: [R] design matrix creation in R

2012-07-03 Thread Duncan Murdoch
On 03/07/2012 4:10 PM, mms...@comcast.net wrote: Hello, I want to create a design matrix using R. Can you explain the code which creates the following please? I understand the first part. b=g1(?) does what? That is gl, not g1 (i.e. gee ell not gee one).See ?gl for a description. Duncan

Re: [R] design matrix creation in R

2012-07-03 Thread David Winsemius
On Jul 3, 2012, at 4:10 PM, mms...@comcast.net wrote: Hello, I want to create a design matrix using R. Can you explain the code which creates the following please? I understand the first part. What first part if the next part is ... this ? b=g1(?) does what? That's just generating a f

Re: [R] design matrix creation in R

2012-07-03 Thread Bert Gunter
1. You need to learn to use R Help. It is there for a purpose. help (help) ## or ?help is where to start. 2. Before posting further, please read "An Introduction to R." Ships with every distro. 3. ?gl 4. This is not the best way to do this anyway. dd <- expand.grid(b=1:4,a=1:3) ## is preferab

[R] design matrix creation in R

2012-07-03 Thread mmstat
Hello, I want to create a design matrix using R. Can you explain the code which creates the following please? I understand the first part. b=g1(?) does what? dd <- data.frame(a = gl(3,4), b = gl(4,1,12)) # balanced 2-way dd a b 1 1 1 2 1 2 3 1 3 4 1 4 5 2 1 6 2 2 7 2 3 8 2 4 9 3 1

Re: [R] remove loop which compares row i to row i-1

2012-07-03 Thread Bert Gunter
Of course it _should_ be: ifelse(x[-length(x)] < x[-1], ...,...) Sorry... -- Bert On Tue, Jul 3, 2012 at 1:00 PM, Bert Gunter wrote: > Vectorize vectorize vectorize! > > if(x[-length(x)] < x[-1]) {...} > > (where x is the whole vector of entries) > > Bill Dunlap has posted some elegant code

Re: [R] remove loop which compares row i to row i-1

2012-07-03 Thread Bert Gunter
Vectorize vectorize vectorize! if(x[-length(x)] < x[-1]) {...} (where x is the whole vector of entries) Bill Dunlap has posted some elegant code within the last month or 2 aimed at this sort of thing, so search on his posts in the archive. -- Bert On Tue, Jul 3, 2012 at 12:10 PM, jcrosbie wro

Re: [R] Assigning a vector to every element of a list.

2012-07-03 Thread Spencer Maynes
I've taken another look, and I actually think you're right. I'm going with Gabor's. Changing d to a list is such a simple solution that I can't believe I didn't try it earlier. On Tue, Jul 3, 2012 at 1:39 PM, Peter Ehlers wrote: > On 2012-07-03 09:47, Spencer Maynes wrote: > >> Thanks guys for t

Re: [R] "evaluating expressions" contained in a dataframe

2012-07-03 Thread Rui Barradas
Hello, I've changed the way you create data.frame 'tests', like it was the conditions were factors, which are coded as integers. We need them of class character to be parsed. Note that the same could be done with the data.frame 'info' but it's not absolutely needed. tests <- data.frame(rule

[R] remove loop which compares row i to row i-1

2012-07-03 Thread jcrosbie
I would like to remove a loop to speed up my code. I want to remove a loop which references the last row. In general I want to a remove a loop which looks something like this: for 2 to number of rows in a matrix do{ if indextrow-1 is < currentIndexRow then do something. } My R code: fo

Re: [R] Removing rows if certain elements are found in character string

2012-07-03 Thread Claudia Penaloza
Got it! Thank you Rui! cp On Tue, Jul 3, 2012 at 10:14 AM, Rui Barradas wrote: > Hello, > > I'm glad it helped. See answer inline. > > Em 03-07-2012 17:09, Claudia Penaloza escreveu: > > Thank you Rui and Jim, both 'i1' and 'i1new' worked perfectly >> because there are no instances of 'Dd' or '

Re: [R] Assigning a vector to every element of a list.

2012-07-03 Thread Peter Ehlers
On 2012-07-03 09:47, Spencer Maynes wrote: Thanks guys for the help, I'm going to go with Patrick Burns answer because it seems to work the best for my situation, but these all seem like they should work. Patrick's solution is similar to Gabor's, but, personally, I favour Gabor's. Seems neatest

[R] A challenging question: merging excel files under a specific pattern

2012-07-03 Thread Stef Salvez
Dear all, I have an excel file that contains 6 sheets 1,2,3,4,5,6 The analysis is repeated every 3 sheets Sheets 1, 2, 3: I want to add (horizontally) the data contained in the matrix : sheet2 (5:end,3:end ) of *Sheet2 * to the sheet3 such that the first element of the matrix *sheet2 (5:end,3

Re: [R] VIM package - how to get the underlying code

2012-07-03 Thread Uwe Ligges
On 02.07.2012 22:48, Mathias Worni wrote: Sorry for the misunderstanding. What I meant to say is that I cannot get the code for the specific graphic that I am running, so that I can keep my code reproducible. Which code for the graphics? To be reproducible, you need the R vesion, the package

[R] need help EM algorithm to find MLE of coeff in mixed effects model

2012-07-03 Thread Jie
Dear All, have a general question about coefficients estimation of the mixed model. I simulated a very basic model: Y|b=X*\beta+Z*b +\sigma^2* diag(ni); b follows N(0,\psi) #i.e. bivariate normal where b is the latent variable, Z and

[R] EM algorithm to find MLE of coeff in mixed effects model

2012-07-03 Thread jimmycloud
I have a general question about coefficients estimation of the mixed model. I simulated a very basic model: Y|b=X*\beta+Z*b +\sigma^2* diag(ni); b follows N(0,\psi) #i.e. bivariate normal where b is the latent variable, Z and X are ni*2

Re: [R] Assigning a vector to every element of a list.

2012-07-03 Thread arun
Hi, Glad all of them worked.  In my reply to you, my first solution was: list2<-lapply(1:10,function(x) vec1) The more generic form should be: list2<-lapply(1:length(list1),function(x) vec1) A.K. - Original Message - From: Spencer Maynes To: r-help@r-project.org Cc: Sent: Tuesday, Ju

Re: [R] integral with error:non-finite function value

2012-07-03 Thread Berend Hasselman
Al Ehan wrote > > Hi guys, > > I'm trying to use the the integral function to estimate the area under a > PDF and a crossing curve. first I stated the function with several vectors > in it: > > fn=function(a,b,F,mu,alpha,xi) > { > x<-vector() > fs<-function(x) > { > c <- (mu+(alpha*(1-(1-F)^xi

Re: [R] open mp problem when installing R

2012-07-03 Thread Prof Brian Ripley
On 03/07/2012 06:56, Erin Hodgess wrote: Dear R People: I'm back to installing R from source, this time on a 64 bit machine. What OS? I'm using the R-Patched.tar.gz as my source. When I have the openmp option set to -fopenmp, I get the error that libgomp.spec is not found. Ok, so I comment

[R] integral with error:non-finite function value

2012-07-03 Thread Al Ehan
Hi guys, I'm trying to use the the integral function to estimate the area under a PDF and a crossing curve. first I stated the function with several vectors in it: fn=function(a,b,F,mu,alpha,xi) { x<-vector() fs<-function(x) { c <- (mu+(alpha*(1-(1-F)^xi)/xi)) tmp <- (1 + (xi * (x - mu))/alpha)

[R] NADA Data Frame Format: Wide or Long?

2012-07-03 Thread Rich Shepard
I have water chemistry data with censored values (i.e., those less than reporting levels) in a data frame with a narrow (i.e., database table) format. The structure is: $ site: Factor w/ 64 levels "D-1","D-2","D-3",..: 1 1 1 1 1 1 1 1 ... $ sampdate: Date, format: "2007-12-12" "2007-12-12

[R] "evaluating expressions" contained in a dataframe

2012-07-03 Thread New RUser
#I have a dataframe called "tests" that contain "character expressions". These characters are rules that use data from within another dataframe. Is there any way within R I can access the rules in the dataframe called tests, and then "evaluate" these "rules"? #An example may better explain wha

[R] Data manipulation with aggregate

2012-07-03 Thread Filoche
Hi everyone. I have these data : myData = data.frame(Name = c('a', 'a', 'b', 'b'), length = c(1,2,3,4), type = c('x','x','y','z')) which gives me: Name length type 1a 1x 2a 2x 3b 3y 4b 4 z I would group (mean) this DF using 'Name' as grouping

Re: [R] read the date format

2012-07-03 Thread arun
Hi, Hope this helps. date1<- c("thursday November 20, 2012", "friday November 21, 2012", "saturday November 22, 2012")  date2<- as.Date(date1, format= "%A %B %d, %Y")  date2 [1] "2012-11-20" "2012-11-21" "2012-11-22" A.K. - Original Message - From: arunkumar To: r-help@r-projec

[R] ggplot2: legend

2012-07-03 Thread Thaler,Thorn,LAUSANNE,Applied Mathematics
Dear all, I produced the following graph with ggplot which is almost fine, yet I don't like that the legend for "Means" and "Observations" includes a line, though no line is used in the plot for those two (the line for "Overall Mean" on the other hand is wanted): library(ggplot2) ddf <- data.f

Re: [R] Problem using mtext to write onto a jpeg

2012-07-03 Thread georgeshirreff
Dear David, In fact just updating R seems to have fixed the problem. There's a lesson. Thanks a lot, George On 3 July 2012 17:02, David Winsemius [via R] < ml-node+s789695n4635292...@n4.nabble.com> wrote: > > On Jul 3, 2012, at 4:01 AM, georgeshirreff wrote: > > > Dear all, > > > > I am trying

Re: [R] Assigning a vector to every element of a list.

2012-07-03 Thread Spencer Maynes
Thanks guys for the help, I'm going to go with Patrick Burns answer because it seems to work the best for my situation, but these all seem like they should work. On Tue, Jul 3, 2012 at 2:51 AM, Patrick Burns wrote: > b <- rep(list(d), length(b)) > > > On 02/07/2012 23:16, Spencer Maynes wrote: >

Re: [R] Automating R script with Windows 7

2012-07-03 Thread Jeff Newmiller
I did not suggest that you don't HAVE an operating system... simply that you don't know how to use yours. However you accomplish starting programs automatically, you WILL need to specify both the R interpreter (which you do seem to be accomplishing) and the name of the script you wish to run (w

Re: [R] R with VBA_Excel

2012-07-03 Thread David Winsemius
On Jul 3, 2012, at 4:43 AM, cindy.dol wrote: Do you know how can I run a script on R from Excel without rExcel but with VBA and batch? It would seem that this question should be directed to a VBA mailing list. -- David Winsemius, MD West Hartford, CT _

Re: [R] Removing rows if certain elements are found in character string

2012-07-03 Thread Rui Barradas
Hello, I'm glad it helped. See answer inline. Em 03-07-2012 17:09, Claudia Penaloza escreveu: Thank you Rui and Jim, both 'i1' and 'i1new' worked perfectly because there are no instances of 'Dd' or 'dD' in the data set (that I would/not want to include/exclude)... but I understand that 'i1new'

Re: [R] Removing rows if certain elements are found in character string

2012-07-03 Thread Claudia Penaloza
Thank you Rui and Jim, both 'i1' and 'i1new' worked perfectly because there are no instances of 'Dd' or 'dD' in the data set (that I would/not want to include/exclude)... but I understand that 'i1new' targets precisely what I want. Why isn't a leader of zero's required for either 'i1' or 'i1new',

Re: [R] insert missing dates

2012-07-03 Thread Rui Barradas
Hello, The trick is to use seq() for date classes. First of all, when creating data.frames use stringsAsFactors=FALSE, in order not to convert them to factors. I've added this option to your data.frame() instructions. And then, mydata1$dates <- as.POSIXct(mydata1$dates) mydata1b$dates <- as

Re: [R] saving contour() plot info

2012-07-03 Thread Robert Douglas Kinley
Many thanks for these ideas ... I'll try them, and report back Cheers Bob Kinley -Original Message- From: Duncan Murdoch [mailto:murdoch.dun...@gmail.com] Sent: 03 July 2012 15:54 To: Robert Douglas Kinley Cc: r-help@r-project.org Subject: Re: [R] saving contour() plot info O

Re: [R] question

2012-07-03 Thread Rui Barradas
Hello, Inline. Em 03-07-2012 09:22, Sajeeka Nanayakkara escreveu: I have already fitted several models using R code; arima(rates,c(p,d,q)) As I heard, best model produce the smallest AIC value, but maximum likelihood estimation procedure optimizer should converge. How to check whether maximum

Re: [R] read the date format

2012-07-03 Thread Rui Barradas
Hello, Try, with 'x' your date(s), as.Date(x, format="%A, %B %d,%Y") strptime(x, format="%A, %B %d,%Y") Note: this is in the help page for ?strptime Hope this helps, Rui Barradas Em 03-07-2012 07:04, arunkumar escreveu: hi I have a data like thursday, November 20,2012. I'm not able

Re: [R] saving contour() plot info

2012-07-03 Thread Duncan Murdoch
On 03/07/2012 10:36 AM, Robert Douglas Kinley wrote: { I think this message got rejected at the 1st attempt - trying again} R 2.15.1 , windows XP I have a very non-stationary bivariate time-series - say {xt,yt} t=1 ... lots. I want to do a bivariate density contour-plot of the whole seri

Re: [R] Problem using mtext to write onto a jpeg

2012-07-03 Thread David Winsemius
On Jul 3, 2012, at 4:01 AM, georgeshirreff wrote: Dear all, I am trying to write figures directly to a file using the jpeg() function. this_ylab=expression(paste("P",sep="")~lambda) this_xlab=expression(rho) jpeg("file_name.jpeg",width=100,height=100,units="mm",res=300) Try instead some

[R] problem in lodging package

2012-07-03 Thread Sukran yalcin ozdilek
Dear, I would like to use the siar program, when I lodging package the message appear, so I couldn't use the related calculations. The following object(s) are masked from ‘package:spatstat’:convexhull Could you please write me what shoud I do? Sukran Yalcin Ozdilek [[alternative HTML ve

Re: [R] Automating R script with Windows 7

2012-07-03 Thread maviney
Thank you for your help So i have tried many ways on different computers, but i believe i have an operating system, as I open RScript up in my local directory it just flashes at me and them disappears I tried to task schedule, using the following code "C:\Program Files\R\R-2.12.1\bin\i386\Rscri

Re: [R] how to do a graph with tree different colors??

2012-07-03 Thread wl2776
Try using polygon() or grid.polygon() from the grid package. You can find code example on the R project title page. Go to http://r-project.org and click on the plot (the example plot showing PCA, clustering and factors, lower left are two graphs, similar to what you want). This will bring you to

[R] nls problem

2012-07-03 Thread joerg van den hoff
hi list, used versions: 2.12.1 and 2.14.0 under ubuntu and macosx. I recently stumbled over a problem with `nls', which occurs if the model is not specified explicitly but via an evaluation of a 'call' object. simple example: 8<--

Re: [R] Error() model is singular - what does that mean

2012-07-03 Thread zetwal
That I correct. I have only 9. Thanks for the explanation :) -- View this message in context: http://r.789695.n4.nabble.com/Error-model-is-singular-what-does-that-mean-tp4635103p4635263.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] how to do a graph with tree different colors??

2012-07-03 Thread wl2776
R Graph Gallery contains lots of plot examples with source code: http://addictedtor.free.fr/graphiques/ -- View this message in context: http://r.789695.n4.nabble.com/how-to-do-a-graph-with-tree-different-colors-tp4635206p4635269.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] Automating R script with Windows 7

2012-07-03 Thread Bart Joosen
In R you should slashes instead of backslashes: C:\PROGRA~1\R\R-2.11.1\bin\RScript.exe C:/Users/Vincent/Documents/temp/test.r Bart -- View this message in context: http://r.789695.n4.nabble.com/Automating-R-script-with-Windows-7-tp4446693p4635260.html Sent from the R help mailing list archive at

Re: [R] Assigning a vector to every element of a list.

2012-07-03 Thread arun
Hi, If you want to assign a vector to every element of a list, vec1<-11:20 list1<-split(LETTERS[1:10],1:length(LETTERS[1:10])) list2<-lapply(1:10,function(x) vec1) or, list3<-lapply(list1,function(x) list1=vec1) or list4<-list() vec2<-1:5 list4[1:length(list1)]<-list(vec2) # if you want to assi

[R] insert missing dates

2012-07-03 Thread Васильченко Александр
Hello I have dataframes. mydata1 <-data.frame(value=c(15,20,25,30,45,50),dates=c("2005-05-25 07:00:00 ","2005-05-25 19:00:00","2005-06-25 07:00:00","2005-06-25 19:00:00 ","2005-07-25 07:00:00","2005-8-25 19:00:00")) or mydata2 <-data.frame(value=c(15,20,25,30,45,50),dates=c("2005-05-25 00:00:00 ","

[R] question

2012-07-03 Thread Sajeeka Nanayakkara
I have already fitted several models using R code; arima(rates,c(p,d,q))  As I heard, best model produce the smallest AIC value, but maximum likelihood estimation procedure optimizer should converge. How to check whether maximum likelihood estimation procedure optimizer has converged or not?

[R] read the date format

2012-07-03 Thread arunkumar1111
hi I have a data like thursday, November 20,2012. I'm not able to convert into data format in R Can anyone please help - Thanks in Advance Arun -- View this message in context: http://r.789695.n4.nabble.com/read-the-date-format-tp4635245.html Sent from the R help mailing list ar

Re: [R] Is it possible to remove this loop? [SEC=UNCLASSIFIED]

2012-07-03 Thread Bart Joosen
And one more alternative: a1$h2 <- apply(a1,1, function(x) if (x["h1"]=="H") 1 else 0 ) -- View this message in context: http://r.789695.n4.nabble.com/Is-it-possible-to-remove-this-loop-SEC-UNCLASSIFIED-tp4635250p4635271.html Sent from the R help mailing list archive at Nabble.com. ___

[R] Problem using mtext to write onto a jpeg

2012-07-03 Thread georgeshirreff
Dear all, I am trying to write figures directly to a file using the jpeg() function. this_ylab=expression(paste("P",sep="")~lambda) this_xlab=expression(rho) jpeg("file_name.jpeg",width=100,height=100,units="mm",res=300) plot(input_values,output_values,pch=16,cex=cex_pt,xlab="",frame.plot=T,an

[R] saving contour() plot info

2012-07-03 Thread Robert Douglas Kinley
{ I think this message got rejected at the 1st attempt - trying again} R 2.15.1 , windows XP I have a very non-stationary bivariate time-series - say {xt,yt} t=1 ... lots. I want to do a bivariate density contour-plot of the whole series and then step through the series 1 second at a time

Re: [R] carpet plots

2012-07-03 Thread John Kane
Anything here that might help http://learnr.wordpress.com/2010/01/26/ggplot2-quick-heatmap-plotting/ John Kane Kingston ON Canada > -Original Message- > From: joeclar...@hotmail.com > Sent: Mon, 2 Jul 2012 13:21:25 -0700 > To: mueller.eisb...@googlemail.com, r-help@r-project.org > Subjec

Re: [R] how to do a graph with tree different colors??

2012-07-03 Thread John Kane
Any sample data for us to work with? See ?dput for a good method of supplying sample data. John Kane Kingston ON Canada > -Original Message- > From: denissearchun...@yahoo.com.mx > Sent: Mon, 2 Jul 2012 14:04:53 -0700 (PDT) > To: r-help@r-project.org > Subject: [R] how to do a graph wi

Re: [R] Code scatter plot data from matrix with 3rd column

2012-07-03 Thread John Kane
Your data is effectively unreadable. Please use dput() to supply sample data. Here is one way to do what you want for data frames using the ggplot2 package. library(ggplot2) mydata <- data.frame(x = 1:10, y = rnorm(10), z = c(rep(1,4), rep(2, 6))) ggplot(mydata, aes(x, y, colour= as.factor( z)

Re: [R] Is it possible to remove this loop? [SEC=UNCLASSIFIED]

2012-07-03 Thread David Winsemius
On Jul 3, 2012, at 5:08 AM, Jim Lemon wrote: On 07/03/2012 05:18 PM, jin...@ga.gov.au wrote: Hi all, I would like create a new column in a data.frame (a1) to store 0, 1 data converted from a factor as below. a1$h2<-NULL for (i in 1:dim(a1)[1]) { if (a1$h1[i]=="H") a1$h2[i]<-1 else a

Re: [R] Wrapper function for multivariate arrays for ode

2012-07-03 Thread David Winsemius
On Jul 2, 2012, at 10:09 PM, Tjun Kiat Teo wrote: I am trying to to write a wrapper function for the ode solver (under the package desolve) to enable it to take multivariate arrays. I know how to do it for 1 dimension arrays but my code breaks down when I try to do it for 2 dimensional arrays.

Re: [R] Automating R script with Windows 7

2012-07-03 Thread Ista Zahn
On Mon, Mar 5, 2012 at 2:47 PM, vincent.deluard wrote: > Hi Jim, > > Please disregard my earlier post -- I have done some research and realized > the space between after "program " was the the issue. I can now open > RScript.exe from the command prompt using the abbreviated form: > > C:\PROGRA~1\R

Re: [R] MLE

2012-07-03 Thread Bert Gunter
Homework?? We don't do homework here. If not, ?optim or look at the CRAN "Optimize" task view for optimizers. There is even a maxLik package that might be useful. -- Bert On Mon, Jul 2, 2012 at 8:58 PM, Ali Tamaddoni wrote: > Hi All > > > > I have a data frame called "nbd" with two columns (x a

Re: [R] Help with lmer formula

2012-07-03 Thread Camila Mendes
Thanks Joshua for the clear explanation. I've previously posted in r sig mixed, but I got no response... :( Cheers, - Camila On Mon, Jul 2, 2012 at 9:31 PM, Joshua Wiley wrote: > Hi Camila, > > In mixed equation form instead of multilevel, it would be: > > Y_it = gamma_00 + gamma_10*X_it + ga

Re: [R] Is it possible to remove this loop? [SEC=UNCLASSIFIED]

2012-07-03 Thread Jim Lemon
On 07/03/2012 05:18 PM, jin...@ga.gov.au wrote: Hi all, I would like create a new column in a data.frame (a1) to store 0, 1 data converted from a factor as below. a1$h2<-NULL for (i in 1:dim(a1)[1]) { if (a1$h1[i]=="H") a1$h2[i]<-1 else a1$h2[i]<-0 } My question: is it possible

[R] R with VBA_Excel

2012-07-03 Thread cindy.dol
Do you know how can I run a script on R from Excel without rExcel but with VBA and batch? -- View this message in context: http://r.789695.n4.nabble.com/R-with-VBA-Excel-tp4635265.html Sent from the R help mailing list archive at Nabble.com. __ R-help@

Re: [R] Code scatter plot data from matrix with 3rd column

2012-07-03 Thread Rui Barradas
Hello, In order to avoid messing up the data, use dput. See below, in the end. As for your question, try this: set.seed(1234) xyz <- data.frame(x=sample(20, 10), y=sample(20, 10), z=sample(0:1, 10, TRUE)) # pch=16 --> solid circle; cex=4 --> 4 fold expansion with(xyz, plot(x, y, col=z+1, pch

Re: [R] Is it possible to remove this loop? [SEC=UNCLASSIFIED]

2012-07-03 Thread Petr PIKAL
Hi > Hi all, > > I would like create a new column in a data.frame (a1) to store 0, 1 data > converted from a factor as below. > > a1$h2<-NULL > for (i in 1:dim(a1)[1]) { > if (a1$h1[i]=="H") a1$h2[i]<-1 else a1$h2[i]<-0 > } > > My question: is it possible to remove the loop from a

Re: [R] Fitting and Plotting the fitted distributions

2012-07-03 Thread Rui Barradas
Hello, This is here for some days now, and I've decided to give it a try. I've rewritten your fitfunction(), making it simpler. And include the gamma distribution in the list. require(MASS) fitfunction <- function(Type, x) list(Type=Type, Fit=fitdistr(x, Type)) fun <- function(x, data){

Re: [R] Removing rows if certain elements are found in character string

2012-07-03 Thread Rui Barradas
Hello, Inline. Em 03-07-2012 01:15, jim holtman escreveu: You will have to change the 'i1' expression as follows: i1 <- grepl("^([0D]|[0d])*$", dd$ch) i1 # matches strings with d & D in them [1] TRUE TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE # second string had 'd' & 'D' in

Re: [R] Assigning a vector to every element of a list.

2012-07-03 Thread Patrick Burns
b <- rep(list(d), length(b)) On 02/07/2012 23:16, Spencer Maynes wrote: I have a vector d of unknown length, and a list b of unknown length. I would like to replace every element of b with d. Simply writing b<-d does not work as R tries to fit every element of d to a different element of d, and

Re: [R] Specify model with polynomial interaction terms up to degree n

2012-07-03 Thread Rui Barradas
Hello, Sorry, but it was you that misread some of the suggestions. I have written raw=TRUE not raw=raw. Just see m <- matrix(1:6, ncol=2) # your example p2 <- poly(m, degree=2, raw=TRUE) # it's raw=TRUE, not raw=raw !!! deg2 <- attr(p2, 'degree') == 2 p2[, deg2] p6 <- poly(m, degree=6, raw

Re: [R] carpet plots

2012-07-03 Thread Jim Lemon
On 07/03/2012 06:21 AM, Joseph Clark wrote: These "carpet plots" are also called "heat maps" and there's a current thread with the subject line "Heat Maps" in which I've given a couple of examples of code for them. The R function image() is very easy to use: image( x=(x values), y=(y value

  1   2   >