[R] plot symbol "+", but with variable bar lenghts

2010-09-08 Thread Rainer Machne
Hi, does anybody know of some plotting function or an easy way to generate "+" symbols with individually settable bar lengths? I tried just combining "|" and "-" as pch and setting the size via cex, but that doesn't really work since the two symbols have different default lengths. Is there a h

Re: [R] lattice: layout and number of pages

2010-09-08 Thread Deepayan Sarkar
On Wed, Sep 8, 2010 at 5:49 AM, Philipp Pagel wrote: > >        Dear expeRts, > > ?xyplot says: "In general, giving a high value of ‘layout[3]’ is not > wasteful because blank pages are never created." > > But the following example does generate blank pages - well except for > the ylab: > > data(b

Re: [R] Reproducible research

2010-09-08 Thread Peng, C
FYI: If you use LaTex, you can work out on something between R and LaTex. -- View this message in context: http://r.789695.n4.nabble.com/Reproducible-research-tp2532353p2532361.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-

[R] Reproducible research

2010-09-08 Thread David Scott
I am investigating some approaches to reproducible research. I need in the end to produce .html or .doc or .docx. I have used hwriter in the past but have had some problems with verbatim output from R. Tables are also not particularly convenient. I am interested in R2HTML and R2wd in particu

[R] Calculating with tolerances

2010-09-08 Thread Jan private
Dear list, I am from an engineering background, accustomed to work with tolerances. For example, I have measured Q = 0.15 +- 0.01 m^3/s H = 10 +- 0.1 m and now I want to calculate P = 5 * Q * H and get a value with a tolerance +- What is the elegant way of doing this in R? Thank you,

Re: [R] "try-error" can not be test. Why?

2010-09-08 Thread David Winsemius
On Sep 8, 2010, at 11:46 PM, Philippe Grosjean wrote: On 08/09/10 19:25, David Winsemius wrote: On Sep 8, 2010, at 1:18 PM, telm8 wrote: Hi, I am having some strange problem with detecting "try-error". From what I have read so far the following statement: try( log("a") ) == "try-erro

[R] Error in normalizePath(path) : with McAfee

2010-09-08 Thread Erin Hodgess
Dear R People: I keep getting the "Error in normalizePath(path) :" while trying to obtain the necessary packages to use with the "Applied Spatial Statistics with R" book. I turned off the Firewall (from McAfee) but am still getting the same message. Does anyone have any idea on a solution pleas

Re: [R] "try-error" can not be test. Why?

2010-09-08 Thread Philippe Grosjean
On 08/09/10 19:25, David Winsemius wrote: On Sep 8, 2010, at 1:18 PM, telm8 wrote: Hi, I am having some strange problem with detecting "try-error". From what I have read so far the following statement: try( log("a") ) == "try-error" should yield TRUE, however, it yields FALSE. I can not

Re: [R] regression function for categorical predictor data

2010-09-08 Thread Peng, C
Sorry, result is not the same, since our datasets are different. I also run lm() based on the dataset that used in glm(). THe results are exactly the same: > summary(lm(Y ~ X + F)) Call: lm(formula = Y ~ X + F) Residuals: Min 1Q Median 3Q Max -0.53796 -0.16201 -0.08087

Re: [R] regression function for categorical predictor data

2010-09-08 Thread Peng, C
glm() is another choice. Using glm(), you response variable can be a discrete random bariable, however, you need to specify the distribution in the argument: family = " distriubtion name" Use Teds simulated data and glm(), you get the same result as that produced in lm(): > summary(glm(Y ~ X + F

Re: [R] coxph and ordinal variables?

2010-09-08 Thread Peng, C
I look at this question in a different angle. My understanding is: 1. If treat tumor_grade as a numerical variable, you assume the hazard ratio is invariant between any two adjacent levels of the tumor grade (assuming invariant covariate patterns of other risks); 2. If you treat the tumor_grade a

Re: [R] on error execute:

2010-09-08 Thread David Winsemius
On Sep 8, 2010, at 7:37 PM, jcress410 wrote: So, i've been writing code in R interfacing with mysql, its been fun and the documentation has been useful, learning quite a bit. the only annoying thing i've been encountering is while coding/ debugging, my session gets clogged, especially wit

[R] Fast / dependable way to "stack together" data frames from a list

2010-09-08 Thread Paul Johnson
Hi, everybody: I asked about this in r-help last week and promised a summary of answers. Special thanks to the folks that helped me understand do.call and pointed me toward plyr. We face this problem all the time. A procedure generates a list of data frames. How to stack them together? The short

Re: [R] Feature selection via glmnet package (LASSO)

2010-09-08 Thread jjenkner
Hello Lai! You can try the elastic net which is a mixture of lasso and ridge regression. Setting the parameter alpha to less than one will provide you with more coefficients different from zero. I am not sure about the R implementation. You have to search for it on your own. Johannes -- View th

Re: [R] coxph and ordinal variables?

2010-09-08 Thread Paul Johnson
run it with factor() instead of ordered(). You don't want the "orthogonal polynomial" contrasts that result from ordered if you need to compare against Stata. I attach an R program that I wrote to explore ordered factors a while agol I believe this will clear everything up if you study the exampl

[R] on error execute:

2010-09-08 Thread jcress410
So, i've been writing code in R interfacing with mysql, its been fun and the documentation has been useful, learning quite a bit. the only annoying thing i've been encountering is while coding/debugging, my session gets clogged, especially with sql connections. At the end of the code i dbDiscon

Re: [R] problem with outer

2010-09-08 Thread David Winsemius
On Sep 8, 2010, at 6:59 PM, tuggi wrote: hello, tank you very very much. it solves my first problem. i hope you can help me also with the second problem. it was like this. p_11=seq(0,1,0.1) p_12=seq(0,1,0.1) then i get also this error message: Error in rmultinom(n - q + 1, size = 1, prob

Re: [R] Correlation question

2010-09-08 Thread Stephane Vaucher
Hi everyone, First of all, thanks for the quick responses. I appreciate the help. Before answering questions, I wanted to mention that I tested this behaviour on 2.3.1 and 2.10.1 on a x86_64 linux arch, and on version 2.9.0 on a 32 bit arch. Now for the answers (batch version): 1/ I receive

Re: [R] problem with outer

2010-09-08 Thread Peng, C
The defintion of the sequency of probability was wrong! > p_11=seq(0,1,0.1) > p_12=seq(0,1,0.1) Since your multinomial distribution requires P_11, P_12, P13=1-P_11-P12 be greater than or equal to zero and P_11+P_12+P_13 = 1. In your above definition of P_11[6] =P_12[6]= 0.6, P_11[7] = P_12[7] =

[R] multistate multiple failure times

2010-09-08 Thread tdenes
Dear List, I would greatly appreciate if you could give us advice how to analyze multistate multiple failure times in R. We treated event type as an independent variable in the survreg model, but this is clearly not the best solution... If you are more interested, see the details below: First I

Re: [R] problem with outer

2010-09-08 Thread tuggi
hello, i hope anyone can help me until tomorow, because i must give me bachelor theses on friday the prof. thanks tuggi -- View this message in context: http://r.789695.n4.nabble.com/problem-with-outer-tp2532074p2532262.html Sent from the R help mailing list archive at Nabble.com. ___

[R] calling Rf_initEmbeddedR error

2010-09-08 Thread 나여나
Hi all, I have a problem of Rf_initEmbeddedR function. I've tried with: try { int Argc1 = 1; char *Argv1[] = {"Rtest_1"}; int Argc2 = 1; char *Argv2[] = {"Rtest_2"}; // Init R(first) Rf_initEmbeddedR(Argc1, Argv1); // R package load SEX

Re: [R] Newbie cross tabulation issue

2010-09-08 Thread David Winsemius
On Sep 8, 2010, at 7:32 PM, Jonathan Finlay wrote: Thanks David, gmodels::Crosstable partially work because can show only 1 x 1 tablen CrossTable(x,y,...) I need something how can process at less 1 variable in X an 10 in Y. I hope you mean only two factors and an n x m table. Thanks for

[R] Wiki entries on "package development process" and "software repository"

2010-09-08 Thread Spencer Graves
I hereby invite anyone to make or suggest improvements to the Wikipedia entries on "package development process" and "software repository". Parts of these entries were created by Sundar Dorai-Raj and me: We believe that the procedures of the R community in these areas provide p

Re: [R] Newbie cross tabulation issue

2010-09-08 Thread Gabor Grothendieck
On Wed, Sep 8, 2010 at 6:40 PM, Jonathan Finlay wrote: > hi, i'm new in R and i need some help. Please, żdo you know a function how > can process cross tables for many variables and show the result in one table > who look like this?: > > ++ > |--

Re: [R] adding list to data.frame iteratively

2010-09-08 Thread Hadley Wickham
Why don't you read the answers to your stackoverflow question? http://stackoverflow.com/questions/3665885/adding-a-list-of-vectors-to-a-data-frame-in-r/3667753 Hadley On Wed, Sep 8, 2010 at 1:17 AM, raje...@cse.iitm.ac.in wrote: > > Hi, > > I have a preallocated dataframe to which I have to add

Re: [R] Newbie cross tabulation issue

2010-09-08 Thread Jonathan Finlay
Thanks David, gmodels::Crosstable partially work because can show only 1 x 1 tablen CrossTable(x,y,...) I need something how can process at less 1 variable in X an 10 in Y. Thanks for your help. -- Jonathan. [[alternative HTML version deleted]] _

Re: [R] adding list to data.frame iteratively

2010-09-08 Thread Joshua Wiley
Hi, This is not exactly the same, but there was a recent thread on rbind()ing dataframes from a list: http://r.789695.n4.nabble.com/Please-explain-do-call-in-this-context-or-critique-to-stack-this-list-faster-td2526908.html Given that, I wonder if this would work for you: ll <- list(c("1","2","

Re: [R] coxph and ordinal variables?

2010-09-08 Thread David Winsemius
On Sep 8, 2010, at 6:43 PM, Min-Han Tan wrote: Dear R-help members, Apologies - I am posting on behalf of a colleague, who is a little puzzled as STATA and R seem to be yielding different survival estimates for the same dataset when treating a variable as ordinal. Ordered() is used to r

Re: [R] readShapeSpatial error with 2.11.1

2010-09-08 Thread Michael Sumner
This is the wrong forum for this question. Please contact the authors or use the R-Sig-Geo mailing list. Please provide example code as per the posting guide, and it might be necessary to provide your dbf file if possible. Cheers, Mike. On Thu, Sep 9, 2010 at 7:46 AM, LCOG1 wrote: > > Anyone en

Re: [R] problem with outer

2010-09-08 Thread tuggi
hello, tank you very very much. it solves my first problem. i hope you can help me also with the second problem. it was like this. p_11=seq(0,1,0.1) p_12=seq(0,1,0.1) then i get also this error message: Error in rmultinom(n - q + 1, size = 1, prob = rbind(p_11, p_12, (1 - : non-positive

Re: [R] Newbie cross tabulation issue

2010-09-08 Thread David Winsemius
On Sep 8, 2010, at 6:40 PM, Jonathan Finlay wrote: hi, i'm new in R and i need some help. Please, ¿do you know a function how can process cross tables for many variables and show the result in one table who look like this?: ++ |--

Re: [R] adding list to data.frame iteratively

2010-09-08 Thread fishkbob
> ll<-list(c("1","2","3"),c("2","3","4")) > ll [[1]] [1] "1" "2" "3" [[2]] [1] "2" "3" "4" > dd<-data.frame(matrix(nrow=10,ncol=3)) > dd X1 X2 X3 1 NA NA NA 2 NA NA NA 3 NA NA NA 4 NA NA NA 5 NA NA NA 6 NA NA NA 7 NA NA NA 8 NA NA NA 9 NA NA NA 10 NA NA NA > dd[1,]<-ll[[1]] > dd

Re: [R] problem with outer

2010-09-08 Thread Joshua Wiley
Great, that helps. With all those variables, your function worked for me. I did slightly edit it for testing, mostly just adding spaces to make it easier for me to read. N <- 10; q <- 8; k <- q-2; L <- 5; n <- 2 * k + L + 1 p_0 <- c(0.2, 0.4, 0.4) f_1 <- qf(0.05, 2, 2) f_2 <- qf(0.95, 2, 2) p_1

Re: [R] Correlation question

2010-09-08 Thread Joshua Wiley
Hi, Does your data have missing values? I am not sure it would change anything, but perhaps try adding: cor(test2, method = "spearman", use = "pairwise.complete.obs") or something of the like. I am not sure what R does by default. My reasoning stems from this particular passage in the documen

[R] coxph and ordinal variables?

2010-09-08 Thread Min-Han Tan
Dear R-help members, Apologies - I am posting on behalf of a colleague, who is a little puzzled as STATA and R seem to be yielding different survival estimates for the same dataset when treating a variable as ordinal. Ordered() is used to represent an ordinal variable) I understand that R's coxph

[R] Newbie cross tabulation issue

2010-09-08 Thread Jonathan Finlay
hi, i'm new in R and i need some help. Please, ¿do you know a function how can process cross tables for many variables and show the result in one table who look like this?: ++ |-- |X variable | |-

Re: [R] regression function for categorical predictor data

2010-09-08 Thread Ted Harding
On 08-Sep-10 21:11:27, karena wrote: > Hi, do you guys know what function in R handles the multiple regression > on categorical predictor data. i.e, 'lm' is used to handle continuous > predictor data. > > thanks, > karena Karena, lm() also handles categorical data, provided these are presented as

Re: [R] problem with outer

2010-09-08 Thread Phil Spector
Does outer(p_11,p_12,Vectorize(guete)) do what you want? - Phil Spector Statistical Computing Facility Department of Statistics UC

Re: [R] problem with outer

2010-09-08 Thread tuggi
hello, thank you for your answer. here the parameter N=10 q=8 k=q-2 L=5 n=2*k+L+1 p_0=c(0.2,0.4,0.4) f_1=qf(0.05,2,2) f_2=qf(0.95,2,2) tuggi -- View this message in context: http://r.789695.n4.nabble.com/problem-with-outer-tp2532074p2532132.html Sent from the

Re: [R] a question about replacing the value in the data.frame

2010-09-08 Thread Joshua Wiley
Hello Karena, dat <- as.data.frame(matrix(sample(0:2, 400, replace = TRUE), ncol = 4000)) # if it is a data frame and has to stay that way # the option that comes to mind is apply() apply(dat, 2, function(x) {ifelse(x==2, 1, x)}) # if it can be or can be converted to a matrix dat2 <- as.matr

Re: [R] problem with outer

2010-09-08 Thread Joshua Wiley
On Wed, Sep 8, 2010 at 2:33 PM, tuggi wrote: > > Hello, > > i wrote this function guete and now i want to plot it: but i get this error > message. i hope someone can help me. > > Error in dim(robj) <- c(dX, dY) : >  dims [product 16] do not match the length of object [1] > > p_11=seq(0,0.3,0.1) >

Re: [R] subbing a string vector for another string vector

2010-09-08 Thread Phil Spector
One way to do it is with mapply: mydf = data.frame(image=c('http://$IMAGE_ID$','$IMAGE_ID$'),pattern=c('www.url.com/image.jpg','http://www.blah.com/image.gif')) mydf$url = mapply(sub,"\\$IMAGE_ID\\$",mydf$pattern,mydf$image) mydf image pattern

Re: [R] 'par mfrow' and not filling horizontally

2010-09-08 Thread jim holtman
remove your asp=1 and try again to see if that is what you want. On Wed, Sep 8, 2010 at 3:01 PM, Ted Harding wrote: > Greetings, Folks. > I'd appreciate being shown the way out of this one! > I've been round the documentation in ever-drecreasing > circles, and along other paths, without stumbling

[R] regression function for categorical predictor data

2010-09-08 Thread karena
Hi, do you guys know what function in R handles the multiple regression on categorical predictor data. i.e, 'lm' is used to handle continuous predictor data. thanks, karena -- View this message in context: http://r.789695.n4.nabble.com/regression-function-for-categorical-predictor-data-tp25320

[R] a question about replacing the value in the data.frame

2010-09-08 Thread karena
I have a data.frame as follows: v1 v2 v3 v4 v5.v100 1 1 0 0 12 2 1 2 1 01 1 1 1 2 10 ... . .. ... . .. 1 2

[R] readShapeSpatial error with 2.11.1

2010-09-08 Thread LCOG1
Anyone encounter an issue with using the readShapeSpatial function from maptools in the latest version of R. I get a simple "Error in read.dbf(filen) : unable to open DBF file" but when i run the exact scrip in 2.10.0 the script produces the map just fine. Sorry for no code but i figured this ma

[R] problem with outer

2010-09-08 Thread tuggi
Hello, i wrote this function guete and now i want to plot it: but i get this error message. i hope someone can help me. Error in dim(robj) <- c(dX, dY) : dims [product 16] do not match the length of object [1] p_11=seq(0,0.3,0.1) p_12=seq(0.1,0.4,0.1) guete = function(p_11,p_12) { set.seed(

Re: [R] question on "optim"

2010-09-08 Thread Ravi Varadhan
The windows build is not on CRAN at the moment. It might be there in a few days. In the meanwhile you can get the windows binary from the "optimizer" project on r-forge: https://r-forge.r-project.org/R/?group_id=395 Ravi. -Original Message- From: Paulo Barata [mailto:pbar...@infolink.co

Re: [R] subbing a string vector for another string vector

2010-09-08 Thread David Winsemius
On Sep 8, 2010, at 4:45 PM, jlemaitre wrote: I have a data frame with two columns: url.img patt.url 1http://$IMAGE_ID$www.url.com/image.jpg 2$IMAGE_ID$ http://www.blah.com/image.gif ... I want to replace "$IMAGE_ID$"

[R] subbing a string vector for another string vector

2010-09-08 Thread jlemaitre
I have a data frame with two columns: image pattern 1http://$IMAGE_ID$www.url.com/image.jpg 2$IMAGE_ID$ http://www.blah.com/image.gif ... I want to replace "$IMAGE_ID$" with the corresponding entry in the pattern column

Re: [R] 'par mfrow' and not filling horizontally

2010-09-08 Thread Ted Harding
On 08-Sep-10 19:16:15, Bert Gunter wrote: > Ted: > ?layout > > Is this close to what you want? > > layout(matrix(1:2, nrow=2),wid=1,heigh=c(1,1), resp= TRUE) > set.seed(54321) > X0 <- rnorm(50) ; Y0 <- rnorm(50) > plot(X0,Y0,pch="+",col="blue",xlim=c(-3,3),ylim=c(-3,3), > xlab="X",ylab="Y",ma

Re: [R] large files produced from image plots?

2010-09-08 Thread baptiste auguie
Hi, I get the same crash with x11() with sessionInfo() R version 2.11.1 (2010-05-31) x86_64-apple-darwin9.8.0 locale: [1] en_GB.UTF-8/en_GB.UTF-8/C/C/en_GB.UTF-8/en_GB.UTF-8 attached base packages: [1] grid stats graphics grDevices utils datasets methods [8] base However it works

Re: [R] large files produced from image plots?

2010-09-08 Thread Stephen T.
Hi Baptiste,Thanks for your suggestion. I have to look into this further, but anything I try with rasterImage() gives me this type of error (below is from running the example in the help file). This is with R 2.11.1 on OS X 10.5 - *** caught bus error ***address 0x24, cause 'non-existent physi

Re: [R] question on "optim"

2010-09-08 Thread Paulo Barata
Dear R-list members, I am using R 2.11.1 on Windows XP. When I try to install package "optimx" through the GUI menu Packages / Install packages, this package does not appear in the list that opens up (chosen from the Austria CRAN site). The package is listed on Austria's CRAN web page, but today

Re: [R] Replace NAs in one column with data from another column

2010-09-08 Thread Joshua Wiley
On Wed, Sep 8, 2010 at 12:02 PM, David Winsemius wrote: > > On Sep 8, 2010, at 2:24 PM, Joshua Wiley wrote: > >> Hi Jakob, >> >> You can use is.na() to create an index of which rows in column 3 are >> missing data, and then select these from column 1.  Here is a simple >> example: >> >> dat <- dat

Re: [R] Replace NAs in one column with data from another column

2010-09-08 Thread Bert Gunter
with() would seem to be useful here: m$z <- with(m,ifelse(is.na(z), x, z)) (I believe the timing is similar, but haven't checked) -- Bert On Wed, Sep 8, 2010 at 11:22 AM, Dimitris Rizopoulos wrote: > one way is the following: > > m <- data.frame(x = rnorm(100), y = rnorm(100), z = rnorm(100))

[R] Correlation question

2010-09-08 Thread Stephane Vaucher
Hi everyone, I'm observing what I believe is weird behaviour when attempting to do something very simple. I want a correlation matrix, but my matrix seems to contain correlation values that are not found when executed on pairs: test2$P2 [1] 2 2 4 4 1 3 2 4 3 3 2 3 4 1 2 2 4 3 4 1 2 3 2 1 3

Re: [R] 'par mfrow' and not filling horizontally

2010-09-08 Thread Bert Gunter
Ted: ?layout Is this close to what you want? layout(matrix(1:2, nrow=2),wid=1,heigh=c(1,1), resp= TRUE) set.seed(54321) X0 <- rnorm(50) ; Y0 <- rnorm(50) plot(X0,Y0,pch="+",col="blue",xlim=c(-3,3),ylim=c(-3,3), xlab="X",ylab="Y",main="My Plot",asp=1) plot(X0,Y0,pch="+",col="blue",xlim=c(

Re: [R] 'par mfrow' and not filling horizontally

2010-09-08 Thread Marc Schwartz
On Sep 8, 2010, at 2:01 PM, Ted Harding wrote: > Greetings, Folks. > I'd appreciate being shown the way out of this one! > I've been round the documentation in ever-drecreasing > circles, and along other paths, without stumbling on > the answer. > > The background to the question can be exemplifi

Re: [R] 'par mfrow' and not filling horizontally

2010-09-08 Thread William Dunlap
Try par(pty="s"). Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com > -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of > ted.hard...@manchester.ac.uk > Sent: Wednesday, September 08, 2010 12:01 PM > To: r-h...@stat.math.

Re: [R] 'par mfrow' and not filling horizontally

2010-09-08 Thread Greg Snow
Look at the squishplot function in the TeachingDemos package. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On Behalf Of

Re: [R] Replace NAs in one column with data from another column

2010-09-08 Thread David Winsemius
On Sep 8, 2010, at 2:24 PM, Joshua Wiley wrote: Hi Jakob, You can use is.na() to create an index of which rows in column 3 are missing data, and then select these from column 1. Here is a simple example: dat <- data.frame(V1 = 1:5, V3 = c(1, NA, 3, 4, NA)) dat$new <- dat$V3 my.na <- is.na(d

[R] 'par mfrow' and not filling horizontally

2010-09-08 Thread Ted Harding
Greetings, Folks. I'd appreciate being shown the way out of this one! I've been round the documentation in ever-drecreasing circles, and along other paths, without stumbling on the answer. The background to the question can be exemplified by the example (no graphics window open to start with):

Re: [R] Saving/loading custom R scripts

2010-09-08 Thread Peter Ehlers
One comment on the function: I see that it uses T/F instead of TRUE/FALSE in a number of places. You'll save yourself some headaches if you replace those 'T/F's. -Peter Ehlers On 2010-09-08 1:25, DrCJones wrote: Hi, How does R automatically load functions so that they are available from the

Re: [R] circular data

2010-09-08 Thread Ben Bolker
Karen Sargsyan ibms.sinica.edu.tw> writes: > > Is there any package for clustering of circular data? > install.packages("sos") library(sos) findFn("circular clustering") See first row ... cheers Ben Bolker __ R-help@r-project.org mailing l

Re: [R] Replace NAs in one column with data from another column

2010-09-08 Thread Joshua Wiley
Hi Jakob, You can use is.na() to create an index of which rows in column 3 are missing data, and then select these from column 1. Here is a simple example: dat <- data.frame(V1 = 1:5, V3 = c(1, NA, 3, 4, NA)) dat$new <- dat$V3 my.na <- is.na(dat$V3) dat$new[my.na] <- dat$V1[my.na] dat This sh

Re: [R] Replace NAs in one column with data from another column

2010-09-08 Thread jim holtman
?ifelse df$newCol <- ifelse(is.na(df$col3), df$col1, df$col3) On Wed, Sep 8, 2010 at 2:17 PM, Jakob Hedegaard wrote: > Hi list, > > I have a data frame (m) with 169221 rows and 10 columns and would like to > make a new column containing the content of column 3 but replace the NAs in > column 3

Re: [R] Replace NAs in one column with data from another column

2010-09-08 Thread Dimitris Rizopoulos
one way is the following: m <- data.frame(x = rnorm(100), y = rnorm(100), z = rnorm(100)) m$z[sample(100, 20)] <- NA m$z.new <- ifelse(is.na(m$z), m$x, m$z) I hope it helps. Best, Dimitris On 9/8/2010 8:17 PM, Jakob Hedegaard wrote: Hi list, I have a data frame (m) with 169221 rows and 10

[R] Replace NAs in one column with data from another column

2010-09-08 Thread Jakob Hedegaard
Hi list, I have a data frame (m) with 169221 rows and 10 columns and would like to make a new column containing the content of column 3 but replace the NAs in column 3 with the data in column 1 (from the same row as the NA in column 3). Column 1 has data in all rows. My first attempt was: for

Re: [R] "try-error" can not be test. Why?

2010-09-08 Thread Ben Bolker
telm8 postgrad.manchester.ac.uk> writes: > > > Thank worked! Thank you so much!!! in general it is safer (I think) to test inherits(try(log("a")),"try-error") which takes care of the case when class(try(log("a"))) has length > 1 __ R-help@r-p

Re: [R] multiple graphs

2010-09-08 Thread moleps
Problem solved.. My bad. No prb with cdplot or graphics-part. The problem was the a<-list.. command which resulted in all three levels of bar$h.r in a[[1]]. Skipping the list function sorted it out. par(mfrow=c(2,2)) a<-levels(bar$h.r)[c(1,3,6)] print(a) lapply(a,function(x){ a<-subset

Re: [R] optimized value worse than starting Value

2010-09-08 Thread Michael Bernsteiner
@Barry: Yes it is the Rosenbrock Function. I'm trying out some thing I found here: http://math.fullerton.edu/mathews/n2003/PowellMethodMod.html @Ravi: Thanks for your help. I will have a closer look at the BB package. Am I right, that the optimx package is ofline atm? (Windows) Michael > Fr

Re: [R] "try-error" can not be test. Why?

2010-09-08 Thread telm8
Thank worked! Thank you so much!!! -- View this message in context: http://r.789695.n4.nabble.com/try-error-can-not-be-test-Why-tp2531675p2531726.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https:

Re: [R] large files produced from image plots?

2010-09-08 Thread baptiste Auguié
Hi, Have you tried the recent rasterImage() function? HTH, baptiste On Sep 8, 2010, at 7:30 PM, Stephen T. wrote: > > Hi list, > I wonder if anyone has thoughts on making image plots in R [using image() or > image.plot(), or filled.contour()]- I've made quite a bit now, but they seem

[R] large files produced from image plots?

2010-09-08 Thread Stephen T.
Hi list, I wonder if anyone has thoughts on making image plots in R [using image() or image.plot(), or filled.contour()]- I've made quite a bit now, but they seem quite large in size when exported to pdf file format (even after compressing with pdftk or ghostscript, which I regularly do). I kno

Re: [R] pairs and panel.smooth for two groups

2010-09-08 Thread Greg Snow
This is fairly simple using lattice graphics: USJudgeRatings <- USJudgeRatings[,1:4] USJudgeRatings$group <- factor(c(rep(1, 22), rep(0, 21))) library(lattice) splom( ~USJudgeRatings[,1:4], groups=group, data=USJudgeRatings, type=c('p','smooth')) The ggplot2 package probably makes this

Re: [R] "try-error" can not be test. Why?

2010-09-08 Thread David Winsemius
On Sep 8, 2010, at 1:18 PM, telm8 wrote: Hi, I am having some strange problem with detecting "try-error". From what I have read so far the following statement: try( log("a") ) == "try-error" should yield TRUE, however, it yields FALSE. I can not figure out why. Can someone help?

[R] "try-error" can not be test. Why?

2010-09-08 Thread telm8
Hi, I am having some strange problem with detecting "try-error". From what I have read so far the following statement: try( log("a") ) == "try-error" should yield TRUE, however, it yields FALSE. I can not figure out why. Can someone help? Many thanks -- View this message in context: http:/

Re: [R] XML getNodeSet syntax for PUBMED XML export

2010-09-08 Thread Duncan Temple Lang
Hi Rob doc = xmlParse("url for document") dn = getNodeSet(doc, "//descriptorna...@majortopic = 'Y']") will do what you want, I believe. XPath - a language for expressing such queries - is quite simple and based on a few simple primitive concepts from which one can create complex compound q

Re: [R] big data

2010-09-08 Thread Greg Snow
In addition to Dirks advice about the biglm package, you may also want to look at the RSQLite and SQLiteDF packages which may make dealing with the large dataset faster and easier, especially for passing the chunks to bigglm. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain

Re: [R] Matrixes inside matrixes

2010-09-08 Thread Patrick Burns
To add to Erik's answer: You can use a three dimensional array if all of your data for one cell is the same type -- numeric presumably. If the data were different types (numeric and character, say), you could have a matrix of mode list to do that. However, that's unlikely to be worth the hassle

Re: [R] Change plot order in lattice xyplot

2010-09-08 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Sam Albers > Sent: Wednesday, September 08, 2010 9:42 AM > To: r-help@r-project.org > Subject: Re: [R] Change plot order in lattice xyplot > > > Prior to creating a plot I usual

[R] question on "optim"

2010-09-08 Thread nashjc
Ben and Ravi have already pointed out that you have a problem with a non-computable (e.g., divide by zero or similar) objective function. This is common. optim() has mostly unconstrained optimizers. L-BFGS-B does handle box or bounds constraints. There is also Rvmmin, which is supposedly the same

Re: [R] how to you output a vector to a column in excel?

2010-09-08 Thread Greg Snow
If you have Excel running with the sheet that you want to use open, then in R you can just do: > write.table( 1:10, 'clipboard', sep='\t', row.names=FALSE, col.names=FALSE ) > (replace 1:10 with your vector) Then go to excel, right click on the cell where you want the first number to be, and

Re: [R] forecasting with non-linear models

2010-09-08 Thread Dennis Murphy
Hi: You're fitting y as a function of x; as in any regression model, the x's are assumed to be conditionally fixed. If you want to model x as a function of y, that's a calibration problem. There are several issues at play: 1. In the model, you have assumed x is fixed, but afterward, you want to

Re: [R] Change plot order in lattice xyplot

2010-09-08 Thread Sam Albers
Prior to creating a plot I usually just order the factor levels to the order I want them in. So for your example I would do: #Create some data library(lattice) x <- runif(100, 0, 20) df <- data.frame(x) df$y <- (1:10) df$Month <- c("October", "September", "August", "July","June") #Plot the f

Re: [R] two questions

2010-09-08 Thread Greg Snow
Have you considered doing a permutation test on the interaction? Here is an article that gives the general procedure for a couple of algorithms and a comparison of how well they do: Anderson, Marti J and Legendre, Pierre; An Empirical Comparison of Permutation Methods for Tests of Partial Regre

[R] 3d plot layout?

2010-09-08 Thread Martin Ivanov
Hello! I would like to ask if R can solve the following problem. I need to produce two 3d plots on a single page, that is to arrange them one above the other. Also, I need to visualize points by means of spheres, pyramids and cubes in the 3d space. Also, I would like to fill these symbols with

Re: [R] Checking if the distribution follow a power law

2010-09-08 Thread David Winsemius
On Sep 8, 2010, at 10:34 AM, NatsumiYotsumoto wrote: Dear all. I'm using igraph package, and do a research about network analysis. With power.law.fit from igraph package, it seems that we can fit a power law distribution to some data. But, I want to know how to judge whether the network

[R] XML getNodeSet syntax for PUBMED XML export

2010-09-08 Thread Rob James
I am looking for the syntax to capture XML tags marked with /DescriptorName MajorTopicYN="Y"/ , but the combination of the internal space (between "Name" and "Major" and the embedded quote marks are defeating me. I can get all the "DescriptorName" tags, but these include both MajroTopicYN

Re: [R] optimized value worse than starting Value

2010-09-08 Thread Ravi Varadhan
"Numerical optimisations are best done using as many methods as possible" See the "optimx" package: http://cran.r-project.org/web/packages/optimx/index.html Ravi. -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Barry Rowlingson Se

Re: [R] saving heatmaps in graphical format that can be edited in graphic editor tool

2010-09-08 Thread BD
Thanks! I will try it now. I am using linux too! Bhakti On Wed, Sep 8, 2010 at 11:54 AM, Barry Rowlingson [via R] < ml-node+2531559-939380251-160...@n4.nabble.com > wrote: > On Wed, Sep 8, 2010 at 4:32 PM, BD <[hidden > email]> > wrote: >

Re: [R] saving heatmaps in graphical format that can be edited in graphic editor tool

2010-09-08 Thread Barry Rowlingson
On Wed, Sep 8, 2010 at 4:32 PM, BD wrote: > > I generated a heatmap in R using the following commands: > >> mydata <- read.csv(file="Data.csv", header=TRUE, sep=",") >> mydata <- mydata[rowSums(mydata[,-1]^2) >0, ] >> rownames(mydata)=mydata$Name >> mydata <- mydata[,2:253] >> mydatamatrix <- data

Re: [R] Saving/loading custom R scripts

2010-09-08 Thread Bert Gunter
.. Not quite. ?Startup provides details, but note the comment about only the base package being loaded and the need to use somepackage::somefunction() or to explicitly first load a package whose functions are used in .Profile. Note also that .First could also be used instead of putting the code

[R] Change plot order in lattice xyplot

2010-09-08 Thread Paul Simonin
Greetings, I am writing with a question regarding plotting using the xyplot command in lattice. I currently have the commands shown below, but I need to produce a plot that orders the Month variable differently. I was told to use the lattice.options command (shown below) to change the plot orde

Re: [R] saving heatmaps in graphical format that can be edited in graphic editor tools

2010-09-08 Thread Joshua Wiley
Side note, since Nabble posts to R-help also, you only need to use Nabble or email, not both. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html a

Re: [R] Matrixes inside matrixes

2010-09-08 Thread baptiste auguie
Hi, You can have each cell of a matrix contain a matrix, but for a reason that is just not clear to me the matrices are wrapped in a list, m = matrix(replicate(4,matrix(1:9,3,3),simplify=FALSE), 2,2) m[1,2][[1]] str(m) and even more surprising to me, m itself has become a list for some reason.

[R] How to get OR and CI from GEE R package

2010-09-08 Thread PZ HU
Hi, I am fitting a GEE model using gee R package, but I am not sure how to get OR and its CI? Could anyone give me some hints? Here are some output: > gee.obj <- gee(Affection~Sibsex+Probandsex,id = FAMID,family = > binomial,corstr = "independence",data =seldata) Beginning Cgee S-fu

Re: [R] saving heatmaps in graphical format that can be edited in graphic editor tools

2010-09-08 Thread Joshua Wiley
Hi, Without your data, we cannot actually reproduce your plot; however, if you cannot read labels, there are generally three options. 1) Make the labels smaller (I have not used the function you used, so I'm not sure exactly how one would) 2) Use fewer labels (if you need them all, this is a part

  1   2   >