Re: [R] sourcecode for the balloonplot function from the gplots package

2012-08-25 Thread R. Michael Weylandt michael.weyla...@gmail.com
Use getAnywhere() or getS3method(). Michael On Aug 25, 2012, at 4:13 AM, ravi rv...@yahoo.se wrote: Hi, I want to take a look at the sourcecode for balloonplot. I would appreciate it if I could get help on overcoming the following problem : methods(balloonplot) [1] balloonplot.default*

Re: [R] PHP escapeshellcmd() equivalent

2012-08-24 Thread R. Michael Weylandt
I don't know PHP, but what does escapeshellcmd() provide over and above what system() / system2() do? Cheers, Michael On Fri, Aug 24, 2012 at 2:48 PM, Roebuck,Paul L proeb...@mdanderson.org wrote: [Redirected from R-Devel...] Not that I recall running across such, but does R (or CRAN package)

Re: [R] ifelse problem - bug or operator error

2012-08-24 Thread R. Michael Weylandt
On Fri, Aug 24, 2012 at 3:22 PM, Jennifer Sabatier plessthanpointohf...@gmail.com wrote: Hi R-Helpers, I don't think I need to post a dataset for this question but if I do, I can. Anyway, I am having a lot of trouble with the ifelse command. You probably should have: dput() makes it super

Re: [R] ifelse problem - bug or operator error

2012-08-24 Thread R. Michael Weylandt
Off the wall / wild guess, do you use attach() frequently? Not entirely sure how it would come up, but it tends to make weird errors like this occur. M On Fri, Aug 24, 2012 at 4:36 PM, Jennifer Sabatier plessthanpointohf...@gmail.com wrote: Hi Rui, Thanks so much for responding but I think

Re: [R] ifelse problem - bug or operator error

2012-08-24 Thread R. Michael Weylandt
to say without knowing how your data was calculated), but Rui seems to think not. M Thanks, Jen On Fri, Aug 24, 2012 at 5:38 PM, R. Michael Weylandt michael.weyla...@gmail.com wrote: Off the wall / wild guess, do you use attach() frequently? Not entirely sure how it would come up, but it tends

Re: [R] ifelse problem - bug or operator error

2012-08-24 Thread R. Michael Weylandt
On Fri, Aug 24, 2012 at 4:50 PM, R. Michael Weylandt michael.weyla...@gmail.com wrote: On Fri, Aug 24, 2012 at 4:46 PM, Jennifer Sabatier plessthanpointohf...@gmail.com wrote: Hi Michael, No, I never use attach(), exactly for the reasons you state. To do due diligence I did a search of code

Re: [R] ifelse problem - bug or operator error

2012-08-24 Thread R. Michael Weylandt
didn't think I could do it easily so I figured I would just put my data up. I will check out the R FAQ you mentioned. Thanks, again, Jen On Fri, Aug 24, 2012 at 5:50 PM, R. Michael Weylandt michael.weyla...@gmail.com wrote: On Fri, Aug 24, 2012 at 4:46 PM, Jennifer Sabatier

Re: [R] date

2012-08-24 Thread R. Michael Weylandt michael.weyla...@gmail.com
Three steps: 1) as.character to get character representation 2) as.POSIXct to convert to time 3) julian() or strptime() to get Julian date. Read the docs (esp on part 2 and 3) to get the format strings just right. Cheers, Michael On Aug 24, 2012, at 10:30 PM, Veerappa Chetty

Re: [R] log-normal distribution fitting with expected value = 1

2012-08-22 Thread R. Michael Weylandt
Take a look at fitdist in the MASS package. Cheers, Michael On Wed, Aug 22, 2012 at 4:23 AM, Biophil bioph...@gmail.com wrote: Dear R users, I would like to estimate mu and sigma of a log-normal distribution, where I know that the expected value is 1, as it is a normalized distribution.

Re: [R] apply question

2012-08-21 Thread R. Michael Weylandt
You don't need loops or apply with paste since it's vectorized: x - data.frame(n = 1:5, l = letters[1:5], stringsAsFactors = FALSE) paste(x[,1], x[,2], sep = _) Cheers, Michael On Tue, Aug 21, 2012 at 10:57 AM, Chet Seligman chet.selig...@gmail.com wrote: This works, where zz is a dataframe:

Re: [R] Regular Expressions in grep

2012-08-21 Thread R. Michael Weylandt
You're misreading the docs: from grep, value: if ‘FALSE’, a vector containing the (‘integer’) indices of the matches determined by ‘grep’ is returned, and if ‘TRUE’, a vector containing the matching elements themselves is returned. Since there's a match somewhere

Re: [R] What makes R different from other programming languages?

2012-08-20 Thread R. Michael Weylandt
As a language, there are some nifty things about function arguments: http://blog.moertel.com/articles/2006/01/20/wondrous-oddities-rs-function-call-semantics. Lexical scoping + first class functions also come to mind. If we are thinking about libraries, graphics:

Re: [R] jpeglib.h not found

2012-08-20 Thread R. Michael Weylandt
You likely need to use your package manager to install something like jpeglib-dev or some such. (I don't know the name Fedora uses) Michael On Mon, Aug 20, 2012 at 11:08 AM, Debarghya Mukherjee deb.mukherje...@gmail.com wrote: Dear sir, For my statistical work I have installed

Re: [R] Doubt in relation with packaging

2012-08-20 Thread R. Michael Weylandt
Rui's solution certainly works, but don't fear namespaces. For a simple package, you basically just write export(xxx) for all the main functions and import(yyy) for all the packages yyy you use. If you have S3 methods, it's also important to register those as S3method(plot, zzz) If you are

Re: [R] What makes R different from other programming languages?

2012-08-20 Thread R. Michael Weylandt
. Michael Weylandt michael.weyla...@gmail.com: As a language, there are some nifty things about function arguments: http://blog.moertel.com/articles/2006/01/20/wondrous-oddities-rs-function-call-semantics. Lexical scoping + first class functions also come to mind. If we are thinking about

Re: [R] specific matrix element tranformation

2012-08-18 Thread R. Michael Weylandt
Please do include context. name assignment can mean a few things: i) Adding a name attribute can be done with names(x) - _whatever_ ii) Assigning to an object name should be done outside the function, not within it: x - myLongFunc(...) Cheers, Michael On Fri, Aug 17, 2012 at 9:04 PM, bantex

Re: [R] plot only x- and y-axis with origin, no box()

2012-08-18 Thread R. Michael Weylandt michael.weyla...@gmail.com
Try adding bty='n' Michael On Aug 18, 2012, at 9:21 AM, ARI BEN bondy93...@hotmail.fr wrote: Envoyé de mon iPhone __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] Get the filename from the given path

2012-08-17 Thread R. Michael Weylandt
On Fri, Aug 17, 2012 at 5:28 AM, Rantony antony.akk...@ge.com wrote: Hi, Here i have a file path, for eg : - FPath - D:\\MyFolder\\MyFile.txt HOW IS POSSIBLE TO GET THE FILE NAME FROM THIS GIVEN PATH ? Quite possibly by yelling at it or regular expressions: you know, whatever -

Re: [R] Get the filename from the given path

2012-08-17 Thread R. Michael Weylandt michael.weyla...@gmail.com
On Aug 17, 2012, at 10:00 AM, Rainer M Krug r.m.k...@gmail.com wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 17/08/12 15:04, Berend Hasselman wrote: On Fri, Aug 17, 2012 at 5:28 AM, Rantony antony.akk...@ge.com wrote: Hi, Here i have a file path, for eg : - FPath -

Re: [R] Remove several numbers from a sequence

2012-08-17 Thread R. Michael Weylandt michael.weyla...@gmail.com
Take a look at ?setdiff Michael On Aug 17, 2012, at 12:18 PM, penguins cat...@bas.ac.uk wrote: Can anyone tell me how to remove several numbers for a sequence. For example: xx- c(1,5,7,10) yy-seq(1,10,1) how do I get take xx away from yy to get the new sequence 2,3,4,6,8,9 Many

Re: [R] dimnames in an array(I'll be grateful if this message will be passed to all list users)

2012-08-17 Thread R. Michael Weylandt michael.weyla...@gmail.com
. Michael regards, A Thu, 16 Aug 2012 00:00:35 -0400 от R. Michael Weylandt michael.weyla...@gmail.com: On Wed, Aug 15, 2012 at 3:57 AM, aleksandr shfets a_shf...@mail.ru wrote: Hi Michael, Thanks for help on double brackets: I wasn't aware of this use of them. I went back to readjust my

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

2012-08-17 Thread R. Michael Weylandt michael.weyla...@gmail.com
On Aug 17, 2012, at 4:19 PM, Amir Kasaeian amir_kasae...@yahoo.com wrote: Dear all, Good day! I have a problem in reading Excel files in R and appending them to each other. Suppose we have several Excel files in a directory with headers and want to use R to append them in a single file

Re: [R] r data structures

2012-08-16 Thread R. Michael Weylandt
On Thu, Aug 16, 2012 at 4:50 PM, Schumacher, Jay S j...@neo.tamu.edu wrote: are these correct/accurate/sensible statements: a vector is a one dimensional object. a matrix is a two dimensional object. a list is a one dimensional object. i'm working from this web page:

Re: [R] r data structures

2012-08-16 Thread R. Michael Weylandt
On Thu, Aug 16, 2012 at 5:44 PM, MacQueen, Don macque...@llnl.gov wrote: Whereas for a matrix or data frame, one must supply *two* index values (even if one of them may be omitted) mydf[ 1 , 3 ] mydf[ , 5 ] mymat[ 2:5 , ] mymat[ 3 , 4:6 ] are valid statements. Not quite:

Re: [R] hidden for() loop subsetting a matrix?

2012-08-15 Thread R. Michael Weylandt
On Wed, Aug 15, 2012 at 5:32 AM, Federico Calboli f.calb...@imperial.ac.uk wrote: Hi, I am subsetting a matrix thus: test [,1] [,2] [,3] [1,]17 13 [2,]28 14 [3,]39 15 [4,]4 10 16 [5,]5 11 17 [6,]6 12 18 test[cbind(c(1,3,5),

Re: [R] Basic question -loading data

2012-08-15 Thread R. Michael Weylandt
On Wed, Aug 15, 2012 at 3:59 AM, Dinuk Jayasuriya dinuk.jayasur...@anu.edu.au wrote: Hi Jeff, Thank you - your comment was much appreciated. I'm now running an ordered probit regression and get the following error: Error in family$linkfun(mustart) : Value 1.125 out of range (0, 1) Error

Re: [R] dimnames in an array(I'll be grateful if this message will be passed to all list users)

2012-08-15 Thread R. Michael Weylandt
, 14 Aug 2012 01:27:50 -0400 от R. Michael Weylandt michael.weyla...@gmail.com: On Mon, Aug 13, 2012 at 5:10 AM, aleksandr russell sss...@gmail.com wrote: Hello, I'm hoping someone with a wide experience with R may be able to see what the program is trying to tell me. I've got an array: y1

Re: [R] sum predictions by hand

2012-08-15 Thread R. Michael Weylandt
On Thu, Aug 16, 2012 at 12:05 AM, Andrei Arsene Simion andrei.arsene.sim...@gmail.com wrote: Hi, If I do a standard svm regression with e1071 x - seq(0.1, 5, by = 0.05) y - log(x) + rnorm(x, sd = 0.2) m - svm(x, y) we can do predict(m,x) to get the fitted values. But what if I wan tho

Re: [R] Graphing question(basic)

2012-08-14 Thread R. Michael Weylandt
Hi Mohan, Your code isn't reproducible as is: see http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example for more information on how you can help us help you. That said, I think you are looking for the ?segments function. Cheers, Michael On Tue, Aug 14, 2012 at

Re: [R] Error; contrasts can be applied only to factors with 2 or more levels

2012-08-14 Thread R. Michael Weylandt
On Tue, Aug 14, 2012 at 5:54 AM, grace sololo...@hotmail.com wrote: Hi, I have been running the same code without problem for the last few days, changing data sets etc with no issue. Today I changed the covariates for the model and am now getting this error message: Error in

Re: [R] Graphing question(basic)

2012-08-14 Thread R. Michael Weylandt
= red) # Segments is the way if I understand your original request segments(-4, 2.2, 1, 2.2, lty = 1, lwd = 2, col = green4) Thanks, Mohan -Original Message- From: R. Michael Weylandt [mailto:michael.weyla...@gmail.com] Sent: Tuesday, August 14, 2012 11:49 AM To: Mohan

Re: [R] R function to fit ARCH and GARCH models

2012-08-13 Thread R. Michael Weylandt michael.weyla...@gmail.com
Indeed -- many of them (find a recent post on Pat Burns Portfolio Probe blog for a comprehensive discussion) -- also see rugarch. Michael On Aug 13, 2012, at 8:17 AM, Sajeeka Nanayakkara nsaje...@yahoo.com wrote: Is there any R function to fit ARCH and GARCH models for univariate time

Re: [R] Standard introductory presentation

2012-08-13 Thread R. Michael Weylandt michael.weyla...@gmail.com
You could do much worse than Bill Venables' short course presentation given at UseR 2012. Keep up the good work! Michael On Aug 13, 2012, at 3:13 PM, clangkamp christian.langk...@gmxpro.de wrote: Hi Everyone In the Contributed Documentation part of the R Project website there are dozens

Re: [R] pass by reference

2012-08-13 Thread R. Michael Weylandt michael.weyla...@gmail.com
On Aug 13, 2012, at 9:23 PM, Sachinthaka Abeywardana sachin.abeyward...@gmail.com wrote: Hi Jim, R, What you just showed me simply prints out the 2nd column. If you inspect your original data, it still just has 1 column. So its still passing by value. Yes -- that's entirely by design.

Re: [R] pass by reference

2012-08-13 Thread R. Michael Weylandt michael.weyla...@gmail.com
On Aug 13, 2012, at 9:30 PM, Sachinthaka Abeywardana sachin.abeyward...@gmail.com wrote: Think you are missing the point, assigning the value back is the same as passing by value. This is rather inefficient if you ever have to deal with large datasets. You dont want to keep having a local

Re: [R] A drawing problem with R

2012-08-13 Thread R. Michael Weylandt michael.weyla...@gmail.com
What's your sessionInfo()? And how did you Change the locale? And what was your actual plot command and graphics device? Michael On Aug 13, 2012, at 10:17 PM, Derrick Guan guanyonghu...@gmail.com wrote: Dear R-help mailing list, I have a drawing problem with R: I need to draw an

Re: [R] A drawing problem with R

2012-08-13 Thread R. Michael Weylandt michael.weyla...@gmail.com
And I changed the R Console to English by adding language=English to R properties-Target 2012/8/14 R. Michael Weylandt michael.weyla...@gmail.com michael.weyla...@gmail.com What's your sessionInfo()? And how did you Change the locale? And what was your actual plot command and graphics

Re: [R] R-help question

2012-08-13 Thread R. Michael Weylandt
On Sun, Aug 12, 2012 at 10:58 PM, Louise Cowpertwait louisecowpertw...@gmail.com wrote: Hi there, I have subscribed to R-help but am not sure how to view or post questions? I think this is the right way. Indeed! I am planning on doing a multivariate regression investigating the

Re: [R] one problem

2012-08-13 Thread R. Michael Weylandt
Hi Nooshin, It's a common enough request, but it's simply not a well defined problem so unless you specify further, we can't help you. (I.e., the information you give doesn't uniquely parameterize a multivariate distribution) With that said, you may want to look at ?sample for basic resampling.

Re: [R] dimnames in an array(I'll be grateful if this message will be passed to all list users)

2012-08-13 Thread R. Michael Weylandt
On Mon, Aug 13, 2012 at 5:10 AM, aleksandr russell sss...@gmail.com wrote: Hello, I'm hoping someone with a wide experience with R may be able to see what the program is trying to tell me. I've got an array: y1=rnorm(41,0.2) y2=rnorm(41,0.2) y3=rbind(y1,y2) data11-array(0,c(41,2,2))

Re: [R] length of variable in mlogit

2012-08-12 Thread R. Michael Weylandt
Hi Lee, I've finally had time to look at this: If you look at ?mlogit.data you'll see that choice must be the variable indicating the choice made: it can be either a logical vector, a numerical vector with 0 where the alternative is not chosen, a factor with level 'yes' when the alternative is

Re: [R] Problem when creating matrix of values based on covariance matrix

2012-08-12 Thread R. Michael Weylandt
On Sun, Aug 12, 2012 at 1:46 PM, Boel Brynedal bryne...@gmail.com wrote: A clarification - yes, calculating the pearson covariance does give the expected results. I dont fully understand why yet, but many thanks for this help! I'm not sure that the spearman correlation is an appropriate

Re: [R] if else elseif for data frames

2012-08-12 Thread R. Michael Weylandt
On Sun, Aug 12, 2012 at 8:07 PM, Sachinthaka Abeywardana sachin.abeyward...@gmail.com wrote: The thing is I have about 10 cases. I saw the ifelse statement Note that there is no ifelse statement: there is only nested if/else of forms if else if else if else

Re: [R] named character question

2012-08-12 Thread R. Michael Weylandt
It's best if you make these things available to us using dput() in the future. You're probably looking for the substr() function. Since _strings_ (not characters) in R are primitive (Not in the primitive/internal sense: just in the primordial sense) you can't subset them with the brackets

Re: [R] Problem when creating matrix of values based on covariance matrix

2012-08-12 Thread R. Michael Weylandt
On Sun, Aug 12, 2012 at 7:52 PM, R. Michael Weylandt michael.weyla...@gmail.com wrote: I am not sure if this is a general/fixed bias in the spearman estimator or if it's just a function of the covMat I randomly chose. Prof. Dalgaard and many others on this list must know. To somewhat answer

Re: [R] Trouble with Spatial Data Example Script

2012-08-11 Thread R. Michael Weylandt
I have no experience with spplot() or maps in general, but might this be more or less tied to R FAQ 7.22? Michael On Sat, Aug 11, 2012 at 12:00 PM, Lorenzo Isella lorenzo.ise...@gmail.com wrote: Hello, The situation is a bit odd. If I open an R session and I paste there the script, then it

Re: [R] Zoo object problem: Find the column name of a univariate zoo object

2012-08-10 Thread R. Michael Weylandt
(NULL, EUR), index = structure(c(1980.25, 1980.5, 1980.75, 1981), class = yearqtr), class = zoo) which has names and colnames equal (And changing one changes the other) because drop = FALSE preserves the dimensionality even in this one column case. Michael 2012/8/10 R. Michael Weylandt

Re: [R] Olympics: 200m Men Final

2012-08-10 Thread R. Michael Weylandt
Continuing on with fun, if silly, analyses: a little voice in my head suggests a time series model and, rather than putting any thought into, I'll use some R-goodness. Setting up the data as Rui provided, we need to add some NA's to account for WWII: library(zoo) golddata.ts -

Re: [R] POSIXct to ts

2012-08-10 Thread R. Michael Weylandt
is ultimately what I need, however, that isn't solid justification for choosing that calculation. Any pointers appreciated. Cheers, Mary Ann From: R. Michael Weylandt michael.weyla...@gmail.com To: Mary Ann Middleton mab...@sfu.ca Cc: r-help@r-project.org

Re: [R] Simple question about formulae in R!?

2012-08-10 Thread R. Michael Weylandt
On Fri, Aug 10, 2012 at 7:36 AM, ONKELINX, Thierry thierry.onkel...@inbo.be wrote: Dear Johan, Why should it be complicated? You have a very simple model, thus a very simple formula. Isn't that great? Your formula matches the model. Though Trust~Culture + Structure * Speed_of_Integration

Re: [R] any recommendation for software about prediction analysis of gene expression data

2012-08-09 Thread R. Michael Weylandt
I might suggest you move this question to the Bioconductor help list. (And look into bioconductor more generally) Best, Michael On Thu, Aug 9, 2012 at 10:26 AM, Dai, Hongying, h...@cmh.edu wrote: Dear R users, I have a microRNA (similar to microarray) data set with gene expressions and

Re: [R] correlating rows of two differently-sized data frames in R

2012-08-09 Thread R. Michael Weylandt
Perhaps load them both and ?merge can show you the way. Michael On Thu, Aug 9, 2012 at 9:54 AM, JenniferH jenacho...@gmail.com wrote: Hello everyone, I have two sets of data, with the following structure: DataSet1 Location PartSample 1 Sample 2 A 1

Re: [R] correlating rows of two differently-sized data frames in R

2012-08-09 Thread R. Michael Weylandt
On Thu, Aug 9, 2012 at 5:28 PM, R. Michael Weylandt michael.weyla...@gmail.com wrote: Perhaps load them both and ?merge can show you the way. Michael On Thu, Aug 9, 2012 at 9:54 AM, JenniferH jenacho...@gmail.com wrote: Hello everyone, I have two sets of data, with the following

Re: [R] Question about R and multiple CPU's

2012-08-09 Thread R. Michael Weylandt
On Wed, Aug 8, 2012 at 6:18 PM, Eberle, Anthony ae...@allstate.com wrote: I have a question about multiple cores and CPU's for running R. I've been running various tests on different types of hardware and operating systems (64 bit, 32 bit, Solaris, Linux, Windows, RV.10, .12, .15, .15.1.)

Re: [R] sapply and matrix command

2012-08-09 Thread R. Michael Weylandt
On Wed, Aug 8, 2012 at 10:37 AM, alijk1989 [via R] ml-node+s789695n4639622...@n4.nabble.com wrote: Hi Michael, Thanks for your response. Here is a simple example of what I am trying to do: w=rep(0.02,10) Q=rep(0.02,10) rho=matrix(0.5,nrow=10,ncol=10) m=10 LGD=0.45 M1=sum(sapply(1:m,

Re: [R] POSIXct to ts

2012-08-09 Thread R. Michael Weylandt
On Thu, Aug 9, 2012 at 3:30 PM, Mary Ann Middleton mab...@sfu.ca wrote: Hi, I have a dataframe (try.1) with date/time and temperature columns, and the date/time is in POSIXct fomat. Sample included below. I would like to to try decompose () or stl() to look at the trends and seasonality

Re: [R] indexing in data frames

2012-08-09 Thread R. Michael Weylandt
On Thu, Aug 9, 2012 at 5:30 PM, arun smartpink...@yahoo.com wrote: lapply(1:length(a$c),function(x) a$b[x]-a$c[[x]]) Arun, I've seen you use this idiom a few times lately and I'd just like to note that seq_along() is an (underutilized) primitive and a safer and faster alternative (avoiding

Re: [R] Zoo object problem: Find the column name of a univariate zoo object

2012-08-09 Thread R. Michael Weylandt michael.weyla...@gmail.com
On Aug 9, 2012, at 8:32 PM, jpm miao miao...@gmail.com wrote: Hi everyone and Achim, Achim, I appreciate your help about the function NCOL. When I use NCOL instead of ncol, I can find out the number of columns (number of time series) in the presence of only one time series (one

Re: [R] debug vs regular mode

2012-08-09 Thread R. Michael Weylandt michael.weyla...@gmail.com
On Aug 9, 2012, at 9:14 PM, David Winsemius dwinsem...@comcast.net wrote: On Aug 9, 2012, at 4:56 PM, Zhang, Peng wrote: Dear all, I had a R segmentation fault, and then invoked debug mode and ran step by step. 2. Why does the same function behave differently under debug and

Re: [R] Vector size limit for table() in R-2.15.1

2012-08-09 Thread R. Michael Weylandt michael.weyla...@gmail.com
On Aug 9, 2012, at 7:29 PM, Sean Ruddy srudd...@gmail.com wrote: Hi, First, thanks in advance. Some useful info: version platform x86_64-unknown-linux-gnu arch x86_64 os linux-gnu system x86_64, linux-gnu version.string R version 2.15.1

Re: [R] sapply and matrix command

2012-08-08 Thread R. Michael Weylandt
On Wed, Aug 8, 2012 at 9:17 AM, alijk1989 [via R] ml-node+s789695n4639595...@n4.nabble.com wrote: Hi, I have made some progress speeding up my code. This is what I have at the moment: M1=sum(sapply(1:m, function(k){sum(sapply(1:m,function(j){w[k]*w[j]*LGD^2

Re: [R] time series, uneven length

2012-08-08 Thread R. Michael Weylandt
On Wed, Aug 8, 2012 at 7:53 AM, joel.green joel.gr...@live.co.uk wrote: I have 4 univariate time series that I believe have correlation between them, I want to create a VAR model between them all. However I have an issue as 3 of them are the same length, however the 4th is smaller. meaning

Re: [R] help, please! matrix operations inside 3 nested loops

2012-08-08 Thread R. Michael Weylandt
On Wed, Aug 8, 2012 at 9:06 AM, Fridolin smells_like_r...@gmx.net wrote: hello, this is my script: #1) read in data: daten-read.table('K:/Analysen/STRUCTURE/input_STRUCTURE_tab_excl_5_282_559.txt', header=TRUE, sep=\t) daten-as.matrix(daten) #2) create empty matrix:

Re: [R] Advice: How to best ensure column values match in different vectors?

2012-08-08 Thread R. Michael Weylandt
On Wed, Aug 8, 2012 at 10:58 AM, DG Christensen d...@enservio.com wrote: Hello all, I would like some advice on how to order elements in a vector. Background: my company is running a k-means clustering model on our historical data warehouse of products, which will produce a matrix of cluster

Re: [R] Sum of vector elements

2012-08-07 Thread R. Michael Weylandt
I'd do something like this: x - sample(seq(-10, 10)) sum(x[seq_len(which.max(x 0)]) Though others might have more direct solutions. which.max() gets you the index of the first time x 0 -- seq_len gives you numbers 1 to that index -- then just subset and sum like normal. Best, Michael On

Re: [R] Unable to download R package

2012-08-07 Thread R. Michael Weylandt
I can access the Mac tree of the ICL repos and it seems unlikely that both ICL and Prof Ripley's site would be down at the same time. OP: are you having firewall issues? Michael On Tue, Aug 7, 2012 at 10:58 AM, Jeff Newmiller jdnew...@dcn.davis.ca.us wrote: Try a different repository?

Re: [R] Rcolorbrewer Package

2012-08-07 Thread R. Michael Weylandt
The link works just fine for me and I can download the package if I take out one of the repeated slashes. Best, Michael On Tue, Aug 7, 2012 at 12:08 PM, li li hannah@gmail.com wrote: Hi all, I am trying to download the Rcolorbrewer package from Cran

Re: [R] NADA Package: Referencing Data Frame Columns

2012-08-07 Thread R. Michael Weylandt
On Tue, Aug 7, 2012 at 11:26 AM, Rich Shepard rshep...@appl-ecosys.com wrote: The sample data sets that come with the NADA package are limited to one or two variables and a censored measurement indicator column. I try to mimic examples using my data but keep missing the target. My water

Re: [R] Problem with global variable building a package

2012-08-07 Thread R. Michael Weylandt
On Tue, Aug 7, 2012 at 2:09 AM, Eva Prieto Castro evapcas...@yahoo.es wrote: Hi, My name is Eva and this is my first message here. My English is not very good, but I hope you can understand my question, in the context of an academic project. I have developed several functions in R

Re: [R] Error with convUL (PBSmapping)

2012-08-07 Thread R. Michael Weylandt
This looks like a fairly low level problem that you might need the maintainer to look at. To get contact information, type maintainer(PBSmapping) at the R prompt. Best, Michael On Tue, Aug 7, 2012 at 7:21 AM, niandra rmaill...@yahoo.it wrote: Hi all, I'm trying to use the function convUL

Re: [R] Hist function

2012-08-07 Thread R. Michael Weylandt
On Tue, Aug 7, 2012 at 8:05 AM, Dominic Roye dominic.r...@gmail.com wrote: Hello everyone, First i explain my aim. I would like to calculate the frecuency of temperature (datos.mx1, columns 3-6) for each month with the thresholds of table lf.med and lc.med. numero1 -

Re: [R] summing and combining rows

2012-08-07 Thread R. Michael Weylandt
On Tue, Aug 7, 2012 at 12:47 PM, Christopher R. Dolanc crdol...@ucdavis.edu wrote: Hello, I have a data set that needs to be combined so that rows are summed by a group based on a certain variable. I'm pretty sure rowsum() or rowsums() can do this but it's difficult for me to figure out how

Re: [R] test if elements of a character vector contain letters

2012-08-07 Thread R. Michael Weylandt
On Tue, Aug 7, 2012 at 4:28 AM, Liviu Andronic landronim...@gmail.com wrote: On Mon, Aug 6, 2012 at 7:35 PM, Marc Schwartz marc_schwa...@me.com wrote: is.letter - function(x) grepl([[:alpha:]], x) is.number - function(x) grepl([[:digit:]], x) Quick follow-up question. I'm always reluctant

Re: [R] Execution of a function

2012-08-07 Thread R. Michael Weylandt
On Tue, Aug 7, 2012 at 11:26 AM, hafida hafida...@hotmail.fr wrote: Hi i have aproblem withe execution of my function first, i wrote my function in the script of R nom_fonction - function(arg1[=expr1], arg2[=expr2], ...){ bloc d'instructions } when i want to have the result i mean the

Re: [R] Decimal number

2012-08-07 Thread R. Michael Weylandt
On Tue, Aug 7, 2012 at 11:47 AM, hafida hafida...@hotmail.fr wrote: HI i have a little problem please help me to solve it this is the code in R: beta0 [1] 64.90614 beta1 [1] 17.7025 beta [1] 17 64 her beta- c(beta0, beta1) thank you in advance hafida Are you looking for the round()

Re: [R] Decimal number

2012-08-07 Thread R. Michael Weylandt
Are you simply looking for c() then? I'm afraid I simply don't understand your question: R b1 - 64.90614 R b2 - 17.7025 R c(b1, b2) [1] 64.90614 17.70250 Perhaps you need to adjust options()$digits For me (and I believe by default) it is 7, but you can change it with a command such as

Re: [R] What is this called? lapply(datum,[[,ColumnName)

2012-08-07 Thread R. Michael Weylandt
On Tue, Aug 7, 2012 at 2:06 PM, Kevin Chang kchan...@uoguelph.ca wrote: Hello R users I recently learned how to use this command: lapply(datum,[[,ColumnName) Unfortunately, I don't know how exactly it works, what it's called (in particular the [[ part], and what other things you can

Re: [R] Execution of a function

2012-08-07 Thread R. Michael Weylandt
Please do keep your replies on the R help list. On Tue, Aug 7, 2012 at 4:17 PM, hafida goual hafida...@hotmail.fr wrote: HI I know my questions are debile, but please I'm debutante. source(functionaj) Error in file(filename, r, encoding = encoding) : cannot open the connection In

Re: [R] r-forge down?

2012-08-07 Thread R. Michael Weylandt michael.weyla...@gmail.com
Entirely different project. (confusingly similar name though) M On Aug 7, 2012, at 5:29 PM, Roy Mendelssohn roy.mendelss...@noaa.gov wrote: http://www.rforge.net -Roy On Aug 7, 2012, at 3:25 PM, Alexander Shenkin wrote: Hi Folks, I've looked around, haven't found anything, and I'm

Re: [R] Setting Number of Displayed Digits

2012-08-07 Thread R. Michael Weylandt
Can you provide a reproducible example: see, e.g., this site for how to do so: http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example Incidentally, I don't believe I can replicate your problem: x - data.frame(conc = sample(c(100, 1,2,3, 0.005, 0.0005, 0.2),

Re: [R] reshape2's dcast() Adds NAs to Data Frame

2012-08-07 Thread R. Michael Weylandt
Can you provide a reproducible example? See, e.g., http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example for information on how to do so. My entirely unjustified guess is that the NAs appear for combinations of factor levels that don't exist. Michael On Tue,

Re: [R] Repeated Aggregation with data.table

2012-08-07 Thread R. Michael Weylandt
On Tue, Aug 7, 2012 at 4:36 PM, Elliot Joel Bernstein elliot.bernst...@fdopartners.com wrote: I have been using ddply to do aggregation, and I frequently define a single aggregation function that I use to aggregate over different groups. For example, require(plyr) dat - data.frame(x =

Re: [R] issue with nzchar() ?

2012-08-06 Thread R. Michael Weylandt
On Mon, Aug 6, 2012 at 9:53 AM, Liviu Andronic landronim...@gmail.com wrote: On Mon, Aug 6, 2012 at 4:48 PM, Liviu Andronic landronim...@gmail.com wrote: string, something that I find strange. At best NA is the equivalent of an empty string. Certainly not to my mind, unless you think that zero

Re: [R] Overlay Histogram

2012-08-06 Thread R. Michael Weylandt
See example(layout) for one idea. I think you might also want to look into rug plots. Best, Michael On Mon, Aug 6, 2012 at 2:40 PM, li li hannah@gmail.com wrote: Dear all, For two sets of random variables, say, x - rnorm(1000, 10, 10) and y - rnorm(1000. 3, 20). Is there any way to

Re: [R] cannot find function simpleRDA2

2012-08-06 Thread R. Michael Weylandt
Hi, simpleRDA2 is still in the vegan package, but it is not exported. I.e., the author only intends it for internal use and he doesn't make it available to end users directly. If you need to get at it, you can use getAnywhere(simpleRDA2) which will show it. If you need to make it available to

Re: [R] R: Help xts object Subset Date by Day of the Week

2012-08-06 Thread R. Michael Weylandt
On Sun, Aug 5, 2012 at 4:49 PM, Douglas Karabasz doug...@sigmamonster.com wrote: I have a xts object made of daily closing prices I have acquired using quantmod. Here is my code: library(xts) library(quantmod) library(lubridate) # Gets SPY data getSymbols(SPY) # Subset Prices

Re: [R] R: Help xts object Subset Date by Day of the Week

2012-08-06 Thread R. Michael Weylandt
On Mon, Aug 6, 2012 at 4:30 PM, R. Michael Weylandt michael.weyla...@gmail.com wrote: On Sun, Aug 5, 2012 at 4:49 PM, Douglas Karabasz doug...@sigmamonster.com wrote: I have a xts object made of daily closing prices I have acquired using quantmod. Here is my code: library(xts) library

Re: [R] Force evaluation of a symbol when a function is created

2012-08-06 Thread R. Michael Weylandt
On Mon, Aug 6, 2012 at 9:03 PM, Schoenfeld, David Alan,Ph.D.,Biostatistics dschoenf...@partners.org wrote: Thank you both, this was very helpful. I need to study environments more. Do either of you know a good source? Disclaimer: I really have no idea what I'm talking about. They are a

Re: [R] Questionnaire Analysis virtually without continuous Variables

2012-08-04 Thread R. Michael Weylandt
On Sat, Aug 4, 2012 at 9:12 AM, Sacha Viquerat dawa.ya.m...@googlemail.com wrote: Hello! I am doing an analysis on a questionnaire of hunters taken in 4 different districts of some mysterious foreign country. The aim of the study was to gather info on the factors that determine the hunting

Re: [R] sapply and matrix command

2012-08-04 Thread R. Michael Weylandt michael.weyla...@gmail.com
Take a look at ?expand.grid Michael On Aug 4, 2012, at 5:03 PM, alijk1989 [via R] ml-node+s789695n463919...@n4.nabble.com wrote: Thanks again for the help looks like this will be useful for what I'm doing. Is there any way to use combn to return combinations of values with themselves:

Re: [R] length of variable in mlogit

2012-08-03 Thread R. Michael Weylandt
On Fri, Aug 3, 2012 at 4:27 AM, Lee van Cleef l.van.cl...@gmx.net wrote: Ingmar, many thanks for your answer. I give you a smaller version of my program with the isolated strange variable, which I used when trying to elaborate the problem . [Start of R-Editor quote] library(foreign)

Re: [R] Can't Run Conjoint Package - Could not find function caFactorialDesign?

2012-08-03 Thread R. Michael Weylandt
With conjoint_1.33 and rather up to date dependencies, I don't see caFactorialDesign and neither does getAnywhere(). Vik, do you have a citation that suggests this function exists? The closest I find is gen.factorial() in the AlgDesign package. The findFn function in the sos library might also

Re: [R] Recursive function calls

2012-08-03 Thread R. Michael Weylandt
Note that this is a common enough case that Hadley provides for it with the str_trim() function in his stringr package. Best, Michael On Fri, Aug 3, 2012 at 12:02 PM, Bert Gunter gunter.ber...@gene.com wrote: Recursively loop over an object is a pretty meaningless phrase, since it depends

Re: [R] length of variable in mlogit

2012-08-03 Thread R. Michael Weylandt
On Fri, Aug 3, 2012 at 11:49 AM, Lee van Cleef l.van.cl...@gmx.net wrote: Hi Michael, many thanks for your comment. Below the original data as imported from Stata format. Hi Lee, I apologize for being intransigent (well, no -- I actually don't) but could you provide your data using dput()

Re: [R] how to get a date variable from a dataset

2012-08-03 Thread R. Michael Weylandt
Hi arunkumar, I've asked you many times to work on providing reproducible examples -- I'll direct you to this page again which describes how to do so: http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example without one, there's not much anyone can do, but

Re: [R] Can't Run Conjoint Package - Could not find function caFactorialDesign?

2012-08-03 Thread R. Michael Weylandt
On Fri, Aug 3, 2012 at 1:34 PM, Sarah Goslee sarah.gos...@gmail.com wrote: On Fri, Aug 3, 2012 at 2:23 PM, R. Michael Weylandt michael.weyla...@gmail.com wrote: With conjoint_1.33 and rather up to date dependencies, I don't see caFactorialDesign and neither does getAnywhere(). The function

Re: [R] Correlating different sets of variables?

2012-08-03 Thread R. Michael Weylandt
That's really not what my previous post asked for (nor does it look like R at all in your photo!) All I can suggest is you put your data in some sort of matrix structure and look at the ?cor and ?cor.test functions. Note that summary count statistics are often not enough to discern correlation

Re: [R] optim() for ordered logit model with parallel regression assumption

2012-08-03 Thread R. Michael Weylandt
On Wed, Aug 1, 2012 at 4:34 PM, Xu Jun junx...@gmail.com wrote: Thanks Michael. Now I switched my approach after doing some google. Following are my new codes: ### library(foreign) readin - read.dta(ordfile.dta, convert.factors=FALSE)

Re: [R] Printing a summary

2012-08-03 Thread R. Michael Weylandt
On Fri, Aug 3, 2012 at 3:34 PM, darnold dwarnol...@suddenlink.net wrote: All, Is this typical of how people will print a summary of results? CoinTosses - function(n) { x - sample(c(0,1), n, replace=TRUE) y - x y[y==0] - T y[y==1] - H numHeads - sum(x) numTails - n-sum(x)

Re: [R] Printing contents of a variable

2012-08-03 Thread R. Michael Weylandt
On Fri, Aug 3, 2012 at 3:39 PM, darnold dwarnol...@suddenlink.net wrote: All, Can someone explain why this does not print the contents of x when I source this file? CoinTosses - function(n,print=TRUE) { x - sample(c(0,1), n, replace=TRUE) y - x y[y==0] - T y[y==1] - H p -

<    1   2   3   4   5   6   7   8   9   10   >