Re: [R] Is 'history' recorded in Rscript?

2009-09-05 Thread David Winsemius
You should be looking for .Rhistory Some OSes make that task difficult. savehistory is not the file name but rather the name of the function that performs that operation. Try savehistory(file=text.Rhistory) and see if the history file is easier to find. Should be in your working directory.

[R] R2WinBUGS question from beginner

2009-09-05 Thread michael curran
Hi R Users, I have--what I think--is a very basic question. I'm trying to use R2WinBUGS and am having difficulty setting up the data properly for repeated measures data in a hierarchical model. First, I know that it is me...not the package, as I sucessfully used R2WinBUGS to run a basic

Re: [R] Problems with Boxplot

2009-09-05 Thread gug
Hi Petr, Thanks for these comments. I'm sorry that my post was not clear. I was referring to the questions in my original post/code/file uploads, but I had forgotten to include an updated file (now attached http://www.nabble.com/file/p25304663/Post%2Btrial%2Bdata.csv Post+trial+data.csv ) to

Re: [R] Problem with xtabs(), exclude=NULL, and counting NA's

2009-09-05 Thread Webb Sprague
xtabs(~wkhp, x, exclude=NULL, na.action=na.pass) wkhp  20   30   40   45   60 NA   1    1   10    1    3    4 Thanks! I must say that this is slightly odd behavior to require both na.action= AND exclude=. Does anyone know of a justification? Shouldn't it be changed? vent Ah well, if R were

Re: [R] Running R on read-only file system, without temporary directory

2009-09-05 Thread Gábor Csárdi
Thanks for all the answers. I have made some quick and dirty modifications to make it start without a temporary directory and so far it runs OK. Obviously, I cannot do help(), example(), install.packages() and Rprof() and maybe many more, but this is not an interactive machine, but an Rserve

Re: [R] Problem with xtabs(), exclude=NULL, and counting NA's

2009-09-05 Thread Mark Difford
I must say that this is slightly odd behavior to require both na.action= AND exclude=. Does anyone know of a justification? Not strange at all. ?options na.action, sub head Options set in package stats. You need to override the default setting. ws-7 wrote: xtabs(~wkhp, x, exclude=NULL,

Re: [R] What is the difference between read.delim and read.delim2?

2009-09-05 Thread Gabor Grothendieck
In some countries a decimal comma is the norm. On Fri, Sep 4, 2009 at 6:16 PM, David Winsemiusdwinsem...@comcast.net wrote: It's pretty subtle, I will admit, but look more carefully at the dec= parameter in the help page. Kind of like the historical battles between between the Liebnizians and

Re: [R] How can I appoint a small part of the whole data

2009-09-05 Thread Yichih Hsieh
Dear Petr, your suggestion is useful many thanks for your help ! best, Yichih 2009/9/3 Petr PIKAL petr.pi...@precheza.cz Hi use any of suitable selection ways that are in R. E.g. data[data$gender==1, ] selects only female values data$wage[(data$gender==1) (data$race=1)] selects

Re: [R] Problem accessing functions in package 'roxygen'

2009-09-05 Thread Uwe Ligges
Robert A LaBudde wrote: Thanks, Uwe. Unfortunately, that doesn't work either: library('roxygen') Warning message: package 'roxygen' was built under R version 2.9.1 roxygen::trim(' 1234 ') You need three colons as indicated in my previous answer! Uwe Error: 'trim' is not an exported

[R] Color index in image function

2009-09-05 Thread FMH
Dear All, I was looking for the color index in image function, such as from topo.colors(n) and etc. but still never found it. For instance, from the help menu. ### # Volcano data visualized as matrix. Need to transpose and flip # matrix horizontally.

[R] Color index in image function

2009-09-05 Thread FMH
Dear All, I was looking for the color index in image function, such as from topo.colors(n) and etc. but still never found it. For instance, from the help menu. ### # Volcano data visualized as matrix. Need to transpose and flip # matrix horizontally.

[R] several questions about R graphic properties

2009-09-05 Thread Антон Морковин
I have a several questions about R graphic properties. I use a barplot2 function for creating plots with error bars. My data include species' names in first column, and I need make plots for each species. I know how to select species for each plot: D-read.table(FD_R.txt, h=T)

Re: [R] several questions about R graphic properties

2009-09-05 Thread jim holtman
SOmething like this should work where you 'split' you data frame by the contents of the first column and then plot the data: Dens - split(D, D[,1]) for (i in Dens){ # process each species jpeg(paste(i[1,1], '.jpg', sep='') # create file with species name plot(., main=i[1,1])

Re: [R] How can I appoint a small part of the whole data

2009-09-05 Thread Yichih Hsieh
Dear all, I got another problem: if education have five levels edu=1 edu=2 edu=3 edu=4 edu=5 If I want to appoint y=edu2~4 in 1990 which programs is correct? I tried this two programs, they both work, but two results is different. 1. fig2b-reldist(y=mu1990$wage[mu1990$edu==2|3|4],..) 2.

Re: [R] How can I appoint a small part of the whole data

2009-09-05 Thread baptiste auguie
Hi, you have two problems in your first scenario, 1- Wrong operator precedence. For example, 1 == 2 | 3 [1] TRUE where 1==2 is tested as FALSE, but 1 is not tested against 3 for equality as it would be using, 1 == 2 | 1 == 3 [1] FALSE or using %in% 2:3 Instead, R evaluates FALSE | 3, and

Re: [R] How can I appoint a small part of the whole data

2009-09-05 Thread Mark Difford
Yichih, Answer 2 is correct, because your indexing specification for 1 is wrong. You also seem to have left out a comma. ## mu1990$wage[mu1990$edu==2|mu1990$edu==3|mu1990$edu==4, ] ## like this mu1990$wage[mu1990$edu%in%2:4, ] You really could have worked this out for yourself by looking at

Re: [R] help with functions

2009-09-05 Thread jonas garcia
Thanks Baptiste On Fri, Sep 4, 2009 at 5:13 PM, baptiste auguie baptiste.aug...@googlemail.com wrote: Hi, I think you've got a problem with environments, testA-function(input=1) { dat - data.frame(A=seq(input,5), B=seq(6,10)) vec.names- c(a, b) env - new.env()

Re: [R] 0 x 0 matrix

2009-09-05 Thread Markku Karhunen
On 04-Sep-09 10:45:27, Markku Karhunen wrote: True. Should have read ?diag. However, this provokes a more general question: Is there some way I can declare some scalar and _all its functions_ as matrices? For instance, I would like to A = as.matrix(0.98) B = function(A) C = diag(sqrt(B))

[R] Running two R instances at the same time

2009-09-05 Thread Peter Juhasz
Dear R experts, please excuse me for writing to the mailing list without subscribing. I have a somewhat urgent problem that relates to R. I have to process large amounts of data with R - I'm in an international collaboration and the data processing protocol is fixed, that is a specific set of R

Re: [R] Is 'history' recorded in Rscript?

2009-09-05 Thread Peng Yu
Hi, I got the following error. Does it mean that the files in the save session will not be saved in history in Rscript? $ Rscript savehistory.R f=tempfile() f [1] /tmp/RtmpMEGKVq/file327b23c6 savehistory(f) Error in savehistory(file) : no history available to save Execution halted Regards,

Re: [R] Is 'history' recorded in Rscript?

2009-09-05 Thread David Winsemius
You did not make it clear (to me anyway) what computing environment the Rscript command was issued from. I assumed probably incorrectly that you were doing this from inside an R session and did not understand that Rscript was an external program. If I was wrong about that, then you are

[R] How to 'apply' on multiple arguments?

2009-09-05 Thread Peng Yu
Hi, I am wonder if there is a function similar 'apply' but it could accept multiple arguments? For example, I have the following matrix. x=matrix(1:6,nr=2) y=matrix(1:6,nr=2) I want to find a function that can be used to compute the linear regression for each pair of rows in the two matrices?

Re: [R] Is 'history' recorded in Rscript?

2009-09-05 Thread Peng Yu
Hi, I run Rscript from the command line (bash). My OS is the following $ cat /etc/redhat-release CentOS release 5 (Final) $ uname -a Linux selenium.cluster 2.6.18-53.1.13.el5 #1 SMP Tue Feb 12 13:02:30 EST 2008 x86_64 GNU/Linux $ dmesg | grep gcc Linux version 2.6.18-53.1.13.el5

Re: [R] Running two R instances at the same time

2009-09-05 Thread Jim Holtman
if I look at your output, the single thread is using almost 100% of the two cpus (3:49 real, 5:49 user or something close to that). for the two thread case it is close to the same with the user now something like 6:15. I would like to see what the contribution of each of the processes

[R] linear regression between two lists of vectors?

2009-09-05 Thread Peng Yu
Hi, I am not familiar enough with statistics yet. Please excuse me if my question is wrong. In the simplest form of linear regression, the data points are two list of scalars x_1, ..., x_n and y_1, ..., y_n. I am wondering if there is a linear regression for two lists of vectors X_1, ..., X_n

Re: [R] Running two R instances at the same time

2009-09-05 Thread Mario Valle
Why instead you don't explore packages 'multicore' or 'snow+showfall (using sockets)'? Ciao! mario Peter Juhasz wrote: Dear R experts, please excuse me for writing to the mailing list without subscribing. I have a somewhat urgent problem that relates to R. I have to process

[R] Selecting biological data

2009-09-05 Thread John Casey
Hello all, I am new to R but have some experience with MATLAB and am trying to make the switch. I generally find the two languages easy to adapt but there are a few routine tasks which I would like to run smoother in R and I am having trouble finding a help resource. Could someone suggest

Re: [R] How to 'apply' on multiple arguments?

2009-09-05 Thread Henrique Dallazuanna
Yes, see mapply. On Sat, Sep 5, 2009 at 12:18 PM, Peng Yu pengyu...@gmail.com wrote: Hi, I am wonder if there is a function similar 'apply' but it could accept multiple arguments? For example, I have the following matrix. x=matrix(1:6,nr=2) y=matrix(1:6,nr=2) I want to find a function

Re: [R] Selecting biological data

2009-09-05 Thread Jim Holtman
subset(data1,cast==33(depth %in% c(1,20,100)) Sent from my iPhone On Sep 5, 2009, at 11:58, John Casey johnrca...@hotmail.com wrote: Hello all, I am new to R but have some experience with MATLAB and am trying to make the switch. I generally find the two languages easy to adapt but

Re: [R] Selecting biological data

2009-09-05 Thread David Winsemius
On Sep 5, 2009, at 11:58 AM, John Casey wrote: Hello all, I am new to R but have some experience with MATLAB and am trying to make the switch. I generally find the two languages easy to adapt but there are a few routine tasks which I would like to run smoother in R and I am having

Re: [R] How to 'apply' on multiple arguments?

2009-09-05 Thread Peng Yu
Hi, I tried the following code. For example, I want to add the corresponding rows of x and y. I expect that the result be a matrix of the same size. But the actual result is different from what I expect. Would you please let me know what the correct command should be? Regards, Peng

[R] Convert dataframe to array of records

2009-09-05 Thread Jeroen Ooms
I would like to convert a dataframe to an array of lists, one for every record. A natural choide is apply as.list to the rows. However, as it seems, as.list() automatically converts all list elements to the same datatype. Eg: myData - data.frame(a=foo,b=as.logical(rbinom(10,1,.5)));

Re: [R] Selecting biological data

2009-09-05 Thread David Winsemius
On Sep 5, 2009, at 12:13 PM, David Winsemius wrote: On Sep 5, 2009, at 11:58 AM, John Casey wrote: Hello all, I am new to R but have some experience with MATLAB and am trying to make the switch. snipped specifics And of course: Sorry: got distracted and forgot to append the

Re: [R] How to 'apply' on multiple arguments?

2009-09-05 Thread Jorge Ivan Velez
Hi Peng, Here is a suugestion using lapply(): res - lapply(1:2, function(i) lm( x[i, ] ~ y[i, ]) ) names(res) - c('row1','row2') res # The summaries for each regression lapply(res, summary) # for the coefficients only lapply(res, coef) # ANOVAs lapply(res, anova) HTH, Jorge On Sat, Sep 5,

Re: [R] How to 'apply' on multiple arguments?

2009-09-05 Thread Henrique Dallazuanna
HI, Try this: mapply(`+`, as.data.frame(x), as.data.frame(y)) You are using matrices, which are vectors with dim attributes, then you need convert to data.frame On Sat, Sep 5, 2009 at 1:16 PM, Peng Yu pengyu...@gmail.com wrote: Hi, I tried the following code. For example, I want to add the

Re: [R] Calling R from a Perl script: much slower?

2009-09-05 Thread Jim Holtman
you might also look at the output of 'ps' to see how much time each process is using. also instrument your R script to collect the cpu time. Sent from my iPhone On Sep 4, 2009, at 11:34, j.delashe...@ed.ac.uk wrote: Ah! sorted! it was NOT running the same code. We're making a GUI

Re: [R] Convert dataframe to array of records

2009-09-05 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Jeroen Ooms Sent: Saturday, September 05, 2009 9:20 AM To: r-help@r-project.org Subject: [R] Convert dataframe to array of records I would like to convert a dataframe to an

Re: [R] extract and replace columns of matrices stored in a list

2009-09-05 Thread Henrique Dallazuanna
Try this: my.array - replicate(10, data.frame(matrix(sample(9), 3)), simplify = FALSE) #2 lapply(my.array, replace, list = 3, values = newThirdColumn) The solution was for matrices, the above works with data.frames. On Thu, Sep 3, 2009 at 5:03 PM, Carlos Hernandez carlos.u...@gmail.comwrote:

Re: [R] Is 'history' recorded in Rscript?

2009-09-05 Thread Duncan Murdoch
On 05/09/2009 2:21 PM, David Winsemius wrote: I get the same error in a bash session on a Mac. My assumption at this point is is that the authors of Rscript decided that you should already know what is in the input file and so left out that feature of the console program. Mavbe if you

Re: [R] Is 'history' recorded in Rscript?

2009-09-05 Thread David Winsemius
I get the same error in a bash session on a Mac. My assumption at this point is is that the authors of Rscript decided that you should already know what is in the input file and so left out that feature of the console program. Mavbe if you explained why you wanted what would generally be a

Re: [R] help with functions

2009-09-05 Thread jim holtman
Try this variation; might have something to do with scope: testA-function(input) { dat- data.frame(A=seq(input,5), B=seq(6,10)) vec.names- c(a, b) for(i in 1:ncol(dat)) { tab- dat[,i]-1 assign(vec.names[i], tab) } do.call(rbind,

[R] save image from R to database server in binary format

2009-09-05 Thread Harsh
Hello, I would appreciate help regarding converting an image (jpeg, bmp) in R and saving it to a postgresql database server. Does the writeBin function provide any support for image to binary conversion? Once converted, how can I use the packages DBI and RPostgreSQL to send such data into the

[R] Anova over a list of models

2009-09-05 Thread Jeroen Ooms
I have a list object, in which I have stored n lme4-models. For example: library(lme4); myModels - list(); myModels[1] - lmer(Reaction ~ Days + (Days|Subject), sleepstudy) myModels[2] - lmer(Reaction ~ Days + (1|Subject) + (0+Days|Subject), sleepstudy) Now I would like to perform an anova over

Re: [R] 0 x 0 matrix

2009-09-05 Thread Ted Harding
On 05-Sep-09 10:00:26, Markku Karhunen wrote: On 04-Sep-09 10:45:27, Markku Karhunen wrote: True. Should have read ?diag. However, this provokes a more general question: Is there some way I can declare some scalar and _all its functions_ as matrices? For instance, I would like to A =

Re: [R] Anova over a list of models

2009-09-05 Thread Henrique Dallazuanna
Try this: 1) anova(myModels[[1]],myModels[[2]]) 2) do.call(anova, myModels) On Sat, Sep 5, 2009 at 5:18 PM, Jeroen Ooms j.c.l.o...@uu.nl wrote: I have a list object, in which I have stored n lme4-models. For example: library(lme4); myModels - list(); myModels[1] - lmer(Reaction ~ Days +

Re: [R] Anova over a list of models

2009-09-05 Thread Jeroen Ooms
2009/9/5 Henrique Dallazuanna www...@gmail.com Try this: anova(myModels[[1]],myModels[[2]]) do.call(anova, myModels) Does this work for you? Both functions are failing here: anova(myModels[[1]],myModels[[2]]) Error in names(mods) - sapply(as.list(mCall)[c(FALSE, TRUE, modp)], as.character)

Re: [R] How to or or and all the values in a logical vector?

2009-09-05 Thread Chi Yau
Try this: # Use cummin for 'and' x - c(TRUE, TRUE, FALSE, TRUE) cummin(x) == TRUE# the last element below is the result you want [1] TRUE TRUE FALSE FALSE # Use cummax for 'or' y - c(FALSE, FALSE, TRUE, FALSE) cummax(y) == TRUE# the last element below is the result you want [1]

Re: [R] Easy way to get top 2 items from vector

2009-09-05 Thread jim holtman
Tyr this: system.time(sort(x, partial=c(99,100))) user system elapsed 0.120.000.14 On Fri, Sep 4, 2009 at 3:53 AM, ONKELINX, Thierrythierry.onkel...@inbo.be wrote: Using tail() for the selection is more elegant and slightly faster. N- 100 x - runif(N)

Re: [R] Creating mixed line and point graphs with xyplot

2009-09-05 Thread jim holtman
I would use the base plot routine plot(x,c, type='l', ylim=range(a,c)) points(x,a) park(new=TRUE) plot(x,d,type='l', ylim=range(b,d), axes=FALSE,ylab='', xlab='') pints(x,b) axis(4) On Fri, Sep 4, 2009 at 11:28 AM, Paul Sweetingm...@paulsweeting.co.uk wrote: Hi Well, I think the title says it

[R] ggplot2::qplot() -- arbitary transformations of coordinate system?

2009-09-05 Thread Michael Kubovy
Hi, Does anyone know how to do a coord_trans() in which the y-axis is tranformed into (for example) -1000/y? Thanks, _ Professor Michael Kubovy University of Virginia Department of Psychology USPS: P.O.Box 400400Charlottesville, VA 22904-4400 Parcels:

[R] Video Analysis?

2009-09-05 Thread spencerg
What software exists for digitizing video to quantify the motion of specific features in the image? I might be willing to use something that's NOT in R, though I'd prefer something in R (or at least with an R intereface). Thanks, Spencer Graves

Re: [R] ggplot2::qplot() -- arbitary transformations of coordinate system?

2009-09-05 Thread stephen sefick
why not transform the y-data? On Sat, Sep 5, 2009 at 8:03 PM, Michael Kubovykub...@virginia.edu wrote: Hi, Does anyone know how to do a coord_trans() in which the y-axis is tranformed into (for example) -1000/y? Thanks, _ Professor Michael Kubovy University of

Re: [R] Regarding SVM using R

2009-09-05 Thread Steve Lianoglou
Hi Abbas, Before I try to give you answers, I just want to mention that you should send R related reqests to the R-help list, and not me personally because (i) there's a greater likelihood that it will get answered in a timely manner, and (ii) people who might have a similar problem down the road

Re: [R] Video Analysis?

2009-09-05 Thread Kevin Middleton
On Sep 5, 2009, at 5:07 PM, spencerg wrote: What software exists for digitizing video to quantify the motion of specific features in the image? I might be willing to use something that's NOT in R, though I'd prefer something in R (or at least with an R intereface). A few options

[R] Matrix as input to xyplot {lattice} - proper extended formula syntax

2009-09-05 Thread Bryan Hanson
Hello R Folks... I have a list with the following structure: str(df) List of 3 $ y: num [1:4, 1:1242] -0.005379 0.029874 -0.023274 0.000655 -0.004537 .. $ x: num [1:1242] 501 503 505 507 509 ... $ names: Factor w/ 4 levels PC Loading 1,..: 1 2 3 4 I want to plot each row of df$y

Re: [R] Matrix as input to xyplot {lattice} - proper extended formula syntax

2009-09-05 Thread David Winsemius
I'm not exactly sure what structure df has. Here's my effort to duplicate it: df - data.frame(y=matrix(rnorm(24), nrow=6), x=1:6) df y.1y.2y.3y.4 x 1 0.1734636 0.2348417 -1.2375648 -1.3246439 1 2 1.9551669 -1.1027262 -0.7307332 0.3953752 2 3 -0.7645778

[R] About BIC

2009-09-05 Thread dan . zhao
Hello, I am working on getting optimal lags by using BIC, But I don't know how to calculate BIC. Is there any code or useful function for it? Thanks and regards, Dan Zhao __ R-help@r-project.org mailing list

Re: [R] Matrix as input to xyplot {lattice} - proper extended formula syntax

2009-09-05 Thread Bryan Hanson
Thanks David, your way of constructing df is much more compact than what I was using, so I've incorporated it. I also had my rows and columns transposed relative to how xyplot wanted them (though I had tested for that, other problems interfered). In my case, I may have varying numbers of y