Re: [R] Matrix manipulation

2011-04-02 Thread andrija djurovic
HI, here is another solution: int - sample(1:20,10) int [1] 10 4 5 2 14 17 9 11 16 13 mat-matrix(11:30,ncol=4) mat [,1] [,2] [,3] [,4] [1,] 11 16 21 26 [2,] 12 17 22 27 [3,] 13 18 23 28 [4,] 14 19 24 29 [5,] 15 20 25 30 mat[apply(mat,1,

Re: [R] Putting a loop in a function

2011-04-02 Thread Berend Hasselman
Ben Hunter wrote: I'm stuck here. The following code works great if I just use it on the command line in a 'for' loop. Once I try to define it as a function as seen below, I get bad results. I'm trying to return a vector of column indices based on a short string that is contained in a

[R] R gui on windows how to force to always show the last line of output

2011-04-02 Thread stan zimine
Hi. Googled but did not found the answer for the following little issue. how to force R gui on windows (maybe a specific setting) to always show the last line of output in the window console. My program in R makes measurements every 5 mins in indefinite loop and prints results in the

Re: [R] fonts in mosaic

2011-04-02 Thread Erich Neuwirth
The problem of changing the default font used fpr the windows graphics device seems to be quite complicated. As I wrote already windowsFonts(myfont=Consolas) par(family=myfont) will make the windows graphics device use Consolas as the defaut font for labels. Therefore, a function call like

Re: [R] R gui on windows how to force to always show the last line of output

2011-04-02 Thread Jannis
If I were you, I would use another GUI. The standart GUI (to mee) seems to be very basic and lacks many handy features (e.g. autosave etc). I am not sure which GUI does what you want, but just try a few (list is sorted from intuitive to more complicated): -RStudio (still in Beta but very

[R] uniroot speed and vectorization?

2011-04-02 Thread ivo welch
curiosity---given that vector operations are so much faster than scalar operations, would it make sense to make uniroot vectorized? if I read the uniroot docs correctly, uniroot() calls an external C routine which seems to be a scalar function. that must be slow. I am thinking a vectorized

Re: [R] R gui on windows how to force to always show the last line of output

2011-04-02 Thread David Winsemius
On Apr 2, 2011, at 4:21 AM, stan zimine wrote: Hi. Googled but did not found the answer for the following little issue. how to force R gui on windows (maybe a specific setting) to always show the last line of output in the window console. My program in R makes measurements every 5 mins in

Re: [R] Lattice wireframe or cloud plot with different colours by a group

2011-04-02 Thread David Winsemius
On Apr 1, 2011, at 7:46 PM, David Winsemius wrote: On Apr 1, 2011, at 6:21 PM, Pam Allen wrote: I have a question about wireframe 3-D plots and how to apply colors. I have a large dataset of river flow (m^3/s) over time, and I have coded these flows based on their height. I would like

Re: [R] how to do t-test in r for difference of mean

2011-04-02 Thread John Kane
http://www.gardenersown.co.uk/Education/Lectures/R/basics.htm#t_test --- On Thu, 3/31/11, arkajyoti jana arkajyo...@gmail.com wrote: From: arkajyoti jana arkajyo...@gmail.com Subject: [R] how to do t-test in r for difference of mean To: r-help@r-project.org Received: Thursday, March 31,

Re: [R] fonts in mosaic

2011-04-02 Thread David Winsemius
On Apr 2, 2011, at 6:02 AM, Erich Neuwirth wrote: The problem of changing the default font used fpr the windows graphics device seems to be quite complicated. As I wrote already windowsFonts(myfont=Consolas) par(family=myfont) will make the windows graphics device use Consolas as the defaut

[R] recommendation on r scripting tutorial?

2011-04-02 Thread Wensui Liu
Good morning, dear listers I am wondering if you could recommend a good tutorial / book for r scripting. thank you so much in advance! WenSui Liu Credit Risk Manager, 53 Bancorp wensui@53.com 513-295-4370 __ R-help@r-project.org mailing list

Re: [R] recommendation on r scripting tutorial?

2011-04-02 Thread Thomas . Adams
Wensui, use google and search for r stats scripts and find among others: http://cran.r-project.org/doc/contrib/Lemon-kickstart/kr_scrpt.html Tom - Original Message - From: Wensui Liu liuwen...@gmail.com Date: Saturday, April 2, 2011 11:22 am Subject: [R] recommendation on r scripting

[R] truncated distributions

2011-04-02 Thread statfan
I am sampling from the truncated multivariate student t distribution rtmvt in the package {tmvtnorm}. My question is about the mean vector. Is it possible to define a mean vector outside of the truncated region? Thank you in advance for any help. -- View this message in context:

Re: [R] truncated distributions

2011-04-02 Thread David Winsemius
On Apr 2, 2011, at 11:06 AM, statfan wrote: I am sampling from the truncated multivariate student t distribution rtmvt in the package {tmvtnorm}. My question is about the mean vector. Is it possible to define a mean vector outside of the truncated region? Thank you in advance for any

Re: [R] Putting a loop in a function

2011-04-02 Thread Ben Hunter
Thanks so much Josh. That absolutely does help. I was just stuck on the function regexpr and didn't consider how handy the other string handling functions would be. As far as attaching 'i' to 'vector', that was indeed a typo. As I was going through my code to make it more readable (at least that

Re: [R] fonts in mosaic

2011-04-02 Thread David Winsemius
On Apr 2, 2011, at 11:16 AM, David Winsemius wrote: On Apr 2, 2011, at 6:02 AM, Erich Neuwirth wrote: The problem of changing the default font used fpr the windows graphics device seems to be quite complicated. As I wrote already windowsFonts(myfont=Consolas) par(family=myfont) will

[R] (no subject)

2011-04-02 Thread Asan Ramzan
Take care about your security http://users5.nofeehost.com/fohadim/wovifuhu.html Love- ItSee msToMeA Dream There are times when all you need is a touch; __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read

Re: [R] cumsum while maintaining NA

2011-04-02 Thread Pete Brecknock
Here's one way . Lines-x1 x2 x3 x4 x5 x6 NA NA 3 4 NA NA 5 3 4 NA NA NA 7 3 4 4 NA NA 11 3 4 5 NA NA 67 4 4 NA NA NA d - read.table(textConnection(Lines), header = TRUE, colClasses=c(integer)) closeAllConnections() res = t(apply(d, 1, function(x) ave(x,is.na(x),FUN=cumsum))) print(res)

Re: [R] truncated distributions

2011-04-02 Thread statfan
The definition of the mean vector is essentially what my question boils down to. In the functions details, the author states We sample x ~ T(mean, Sigma, df) subject to the rectangular truncation lower = x = upper. Currently, two random number generation methods are implemented: rejection

[R] help

2011-04-02 Thread Vijayan Padmanabhan
Dear R Help group I need to run a command line script from within R session. I am not clear how i can acheive this. I tried shell and system function, but i am missing something critical.can someone provide help? My intention is to create a pdf file of a plot in R and then attach existing files

[R] Plotting MDS (multidimensional scaling)

2011-04-02 Thread Daniel Malter
Hi, I just encountered what I thought was strange behavior in MDS. However, it turned out that the mistake was mine. The lesson learned from my mistake is that one should plot on a square pane when plotting results of an MDS. Not doing so can be very misleading. Follow the example of an

Re: [R] truncated distributions

2011-04-02 Thread David Winsemius
On Apr 2, 2011, at 1:15 PM, statfan wrote: The definition of the mean vector is essentially what my question boils down to. In the functions details, the author states We sample x ~ T(mean, Sigma, df) subject to the rectangular truncation lower = x = upper. Currently, two random number

Re: [R] help

2011-04-02 Thread nandan amar
One way that u might have thought of is to create plot in PDF in R and the use pdftools. Additionally one can also think of running R script using R CMD and then using pdftools in a .sh script file if u r in linux. I am not aware of pdftools capability in R. On 2 April 2011 23:01, Vijayan

[R] I think I just broke R

2011-04-02 Thread Alexander Engelhardt
I swear, I didn't touch it! I can't fit GLM's anymore, and I can't make it talk english (for googling the error messages) anymore. y - c(1,1,0,1,0,1) x - c(2,7,3,5,2,4) glm(y~x, binomial) Fehler in runif(length(pi)) : Element 1 ist leer; Der Teil der Argumentliste 'length' der berechnet

Re: [R] uniroot speed and vectorization?

2011-04-02 Thread Petr Savicky
On Sat, Apr 02, 2011 at 08:24:07AM -0400, ivo welch wrote: curiosity---given that vector operations are so much faster than scalar operations, would it make sense to make uniroot vectorized? if I read the uniroot docs correctly, uniroot() calls an external C routine which seems to be a scalar

Re: [R] lattice: wireframe eats up points; how to make points on wireframe visible?

2011-04-02 Thread Marius Hofert
Dear Deepayan, thank you very much, this works great. Cheers, Marius On 2011-04-01, at 13:58 , Deepayan Sarkar wrote: On Thu, Mar 31, 2011 at 3:26 AM, Marius Hofert m_hof...@web.de wrote: Dear Deepayan, thanks for answering. It's never too late to be useful. I see your point in the

[R] [w32] Bug? When trying to auto-complete, rest of the input from cursor is wiped out.

2011-04-02 Thread Yue Wu
Hi, list, I'm using Rterm on windows, I find that when I try to complete the code with tab, the rest of the input from cursor will be wiped out. How to reproduce(`|' means the cursor position): write.table(file='foo',fileEn|=) Then hit tab, R will try to complete the code, but the rest is

[R] Discretizing data rows into regular intervals

2011-04-02 Thread Linh Tran
Hi guys, I'd like to thank you ahead of time for any help that you can offer me. I'm kind of stuck trying to do this. I have a data frame with dates and values (note: only two columns shown): head(test) date value stop 1 01/02/05 100 12/01/07 2 07/16/05

Re: [R] Help with filled.contour()

2011-04-02 Thread emorway
Michael, Although this is a rather old post I'm responding to, I recently came across it and have a suggestions for getting rid of the legend. Simply modify the code associated with the function and stuff it into a new function, edm-function (x = seq(0, 1, length.out = nrow(z)), y = seq(0, 1,

Re: [R] I think I just broke R

2011-04-02 Thread Daniel Malter
Check whether x, y, or glm have been redefined. If not, restart R. D. -- View this message in context: http://r.789695.n4.nabble.com/I-think-I-just-broke-R-tp3422737p3422932.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] Discretizing data rows into regular intervals

2011-04-02 Thread Daniel Malter
The ?cut function should work for that. Have you tried? D. -- View this message in context: http://r.789695.n4.nabble.com/Discretizing-data-rows-into-regular-intervals-tp3422921p3422933.html Sent from the R help mailing list archive at Nabble.com. __

[R] conditionally weighted mean with NAs

2011-04-02 Thread Joshua Wiley
Dear List, I am trying to take the weighted average of two numbers (visual acuity measures from the left and right eye). For each row, the lowest value should get a weight of .75, and the highest a weight of .25. My problem is, if one value is missing (NA), the remaining one should get a

[R] How can I generate a random correlation matrix with some off-diagonal elements being zero

2011-04-02 Thread Xing Yuan
Hi, How can I generate a random correlation matrix, R={r_ij}, where some off-diagonal elements being zero? Thanks in advance. Joe [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

Re: [R] conditionally weighted mean with NAs

2011-04-02 Thread David Winsemius
On Apr 2, 2011, at 10:20 PM, Joshua Wiley wrote: Dear List, I am trying to take the weighted average of two numbers (visual acuity measures from the left and right eye). For each row, the lowest value should get a weight of .75, and the highest a weight of .25. My problem is, if one value

Re: [R] Discretizing data rows into regular intervals

2011-04-02 Thread Daniel Malter
Sorry, I did not get the question because I read it too sloppily. I hope this is not homework. You can proceed along this example: set.seed(32345) #Value of observation value=rpois(60,100) #Day of observation day=sample(1:1080,50,replace=F) day=sort(day) #Assume 3 years #Assume months have all

Re: [R] conditionally weighted mean with NAs

2011-04-02 Thread Joshua Wiley
On Sat, Apr 2, 2011 at 7:59 PM, David Winsemius dwinsem...@comcast.net wrote: On Apr 2, 2011, at 10:20 PM, Joshua Wiley wrote: VA - cbind(OS = c(.2, 0, 1, -.1, NA, 3, NA),  OD = c(.3, -.1, .2, -.1, NA, 0, .1),  Desired = c(0.225, -0.075, 0.4, -0.1, NA, 0.75, 0.1))  VA - cbind(VA,

Re: [R] Create Variable names dynamically

2011-04-02 Thread David Winsemius
On Mar 31, 2011, at 3:46 PM, Henrique Dallazuanna wrote: Take a look in ?assign On Thu, Mar 31, 2011 at 5:42 PM, Noah Silverman n...@smartmediacorp.com wrote: Hi, I want to create variable names from within my code, but can't find any documentation for this. An example is probably the

Re: [R] Plotting MDS (multidimensional scaling)

2011-04-02 Thread Mario Valle
Also try the asp parameter in plot. plot(fit2$points, xlab=Coordinate 1, ylab=Coordinate 2,main=Metric MDS,type='n',asp=1) text(fit2$points, labels = c('A','B','C','D'), cex=1) Hope it helps mario On 02-Apr-11 22:07, Daniel Malter wrote: Hi, I just