[R] Data generation

2012-01-30 Thread Partha Sinha
I want to generate a data matrix (20*30) having mean 3 and std deviation 1 (normal dist). pl help Partha __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

[R] FW: repeated measures MANOVA with interaction

2012-01-30 Thread Gregory McCullagh (x2010rcw)
If I have a matrix x: x slug surgery swat prey predator 1 122 2 91 2 240 8 115 3 348 3 110 slug = individual is tested in each swat, prey and

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

2012-01-30 Thread pabears
didn't seem to quite work: i tried different subsetting. lapply(nestedseasonlower, nested(nestedseason,.) are there any functions that can repeat a function while counting each iteration of the repeated function? (n=1, n=2, n=3) thanks -- View this message in context:

[R] height of plots

2012-01-30 Thread 1Rnwb
Hello R gurus, I have to create 12 plots, I have been using the following script, which leaves a large white space between two plot. I would appreciate if someone can suggest an alternative to reduce the white space. par(mar=c(3,3,.5,.5)) split.screen(c(6,2))# split display into two

[R] need some help with model.matrix

2012-01-30 Thread Daniel Negusse
hello folks, i am learning R and microarray analysis from scratch using different sites. today i am doing an exercise from http://manuals.bioinformatics.ucr.edu/home/R_BioCondManual#R_functions the section i am at is 2. Affymetrix data analysis. I understand the syntax given in this

[R] how to calculate length of each triangulated face in deldir

2012-01-30 Thread uday
Hi, I have some data data=read.table(SCI.was ,header=TRUE) sci_lat=data[,7] # latitude temp_lon=data[,8] # longitude # the longitude data is in 360 degree format need to convert to -180 to 180 sci_lon= ((temp_lon+180) %% 360 ) -180 m -cbind(sci_lon,sci_lat) dist - spDistsN1(m, m[1,],

[R] how to select columns

2012-01-30 Thread David Studer
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), which doesn't work) Alternative question: Is there a function

[R] Modifying whiskers in boxplots?

2012-01-30 Thread J. Willacker
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 = TRUE, do.out =

[R] PLEASE HELP creating a matrix

2012-01-30 Thread hagereseb
hello folks, i am learning R and microarray analysis from scratch using different sites. today i am doing an exercise from http://manuals.bioinformatics.ucr.edu/home/R_BioCondManual#R_functions the section i am at is 2. Affymetrix data analysis. I understand the syntax given in this section

[R] about undefined columns selected

2012-01-30 Thread xiaocong zuo
Hi,all, 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, TYPE, AGE, GNDR,

[R] Using influence plots and obtaining id numbers

2012-01-30 Thread Pam
I am a novice R user, and I am having difficulty understanding R's influence plots. I am trying to remove outliers from a particular variable, sib. I am able to generate influence plots and further outlier information such as below (which is a shortened example). For my analyses, I end up

Re: [R] about undefined columns selected

2012-01-30 Thread Milan Bouchet-Valat
Le dimanche 29 janvier 2012 à 21:50 -0500, xiaocong zuo a écrit : Hi,all, 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);

Re: [R] Data generation

2012-01-30 Thread MK
Assuming you want the whole data matrix coming from a single distribution. matrix(rnorm(20 *30, 3, 1), 20, 30) On 30/01/12 06:33, Partha Sinha wrote: I want to generate a data matrix (20*30) having mean 3 and std deviation 1 (normal dist). pl help Partha

Re: [R] how to select columns

2012-01-30 Thread Milan Bouchet-Valat
Le lundi 30 janvier 2012 à 08:30 +0100, David Studer a écrit : 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

Re: [R] height of plots

2012-01-30 Thread Jim Lemon
On 01/30/2012 07:24 AM, 1Rnwb wrote: Hello R gurus, I have to create 12 plots, I have been using the following script, which leaves a large white space between two plot. I would appreciate if someone can suggest an alternative to reduce the white space. par(mar=c(3,3,.5,.5))

[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

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 best

[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 = TRUE,

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 michael.weyla...@gmail.com Cc: r-help@r-project.org r-help@r-project.org Gesendet: 5:22 Montag, 30.Januar 2012 Betreff: Re: [R] ColorBrewer question I believe

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

[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

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 export a

[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] 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

[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

[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 #

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] 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

[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

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 the

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

[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

[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

[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)

[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] [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:

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 on

[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)

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 michael.weyla...@gmail.com To: Massimo Bressan mbres...@arpa.veneto.it Cc: r-help@r-project.org Sent: Friday, January 27, 2012 4:16 PM Subject: Re:

[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))),

[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

[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:

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

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

2012-01-30 Thread SR Millis
From: SR Millis srmil...@yahoo.com To: Jin Minming jminm...@yahoo.com 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

[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 field of

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 left

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.htmlhttp://www.r-project.org/posting-guide.htmland help us to help you. Regards, Jorge On

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

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 problem

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

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 danss...@gmail.com wrote: didn't seem to quite work: i tried

Re: [R] question on model.matrix

2012-01-30 Thread Paul Johnson
Greetings On Sat, Jan 28, 2012 at 2:43 PM, Daniel Negusse daniel.negu...@my.mcphs.edu 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

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

[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 __

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().

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

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 does

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] 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,

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 andy_l...@merck.com wrote:

[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

[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]] __

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 pauljoh...@gmail.com wrote: A user question today has me stumped. Can you advise me, please? User wants a matrix that has some numbers, some

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), which

[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

[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]

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

2012-01-30 Thread SR Millis
From: SR Millis srmil...@yahoo.com To: Jin Minming jminm...@yahoo.com 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

[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

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

[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 unretained

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.

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

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:2] Is this possible

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

[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

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 pauljoh...@gmail.com wrote: A user question today has me stumped.  Can you advise me, please? User wants a matrix

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 josephp...@ieee.org wrote: Hi, Am i doing something silly here in

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

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 pauljoh...@gmail.com 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 -

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

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,

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 to send

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

[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

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 delivera...@gmail.com 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+

Re: [R] timeseries highlighting

2012-01-30 Thread Gabor Grothendieck
On Mon, Jan 30, 2012 at 2:12 PM, R. Michael Weylandt michael.weyla...@gmail.com 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 danss...@gmail.com 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

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

[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))), where

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 jminm...@yahoo.com To: r-help@r-project.org

[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,

[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]]

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 problem.

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 see how different

Re: [R] Euler identity with complex exp

2012-01-30 Thread Peter Langfelder
On Mon, Jan 30, 2012 at 11:43 AM, Joseph Park josephp...@ieee.org 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

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

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

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 paulj...@ku.edu ## 2012-01-30 ## Special thanks to r-help email list

[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

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, rkevinbur...@charter.net 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

  1   2   >