[R] help in dbWriteTable

2011-12-01 Thread arunkumar1111
hi I need some help in dbWriteTable. I'm not able to insert the rows in the table if the column order are not same in the database and in the dataframe which i'm inserting. Also facing issue if the table is already created externally and inserting it thru dbWrite. is there some way that we can

[R] R2Cuba package, failed with message ‘Dimension out of range’

2011-12-01 Thread Sachinthaka Abeywardana
Hi All, I get the message failed with message ‘Dimension out of range’ when using cuhre in package R2Cuba. Does anyone know what this mean? Or would I need to email the package author? The funny thing is it does give a result and comparing it to "adaptIntegrate" in package cubature, the two numbe

Re: [R] Assign name to object for each iteration in a loop.

2011-12-01 Thread David Winsemius
On Dec 1, 2011, at 1:13 PM, lglew wrote: Hi R-users, I'm trying to produce decompositions of a multiple time-series, grouped by a factor (called "area"). I'm modifying the code in the STLperArea function of package ndvits, as this function only plots produces stl plots, it does not retu

Re: [R] simple lm question

2011-12-01 Thread David Winsemius
On Dec 1, 2011, at 10:50 PM, Worik R wrote: I really would like to be able to read about this in a document but I cannot find my way around the documentation properly Given the code... M <- matrix(runif(5*20), nrow=20) colnames(M) <- c('a', 'b', 'c', 'd', 'e') ind <- c(1,2,3,4) dep <- 5 I ca

Re: [R] Counting the occurences of a charater within a string

2011-12-01 Thread David Winsemius
On Dec 1, 2011, at 11:11 PM, Bert Gunter wrote: strsplit is certainly an alternative, but your approach is unnecessarily complicated and inefficient. Do this, instead: sapply(strsplit(x,"/"),length)-1 Definitely more compact that the regex alternates I came up with, but one of these still

Re: [R] Counting the occurences of a charater within a string

2011-12-01 Thread Florent D.
Inefficient, maybe, but what you suggest does not work if a string starts or ends with a slash. On Thu, Dec 1, 2011 at 11:11 PM, Bert Gunter wrote: > strsplit is certainly an alternative, but your approach is > unnecessarily complicated and inefficient. Do this, instead: > > sapply(strsplit(x,"/"

Re: [R] Plot coordinates with gradien colour according to a different column

2011-12-01 Thread Peter Alspach
Tena koe Lara If I understand your question correctly, I use the colorspace package for that sort of thing, but you could also use the built-in colour palettes such as rainbow and topo.colors HTH Peter Alspach > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-he

Re: [R] Counting the occurences of a charater within a string

2011-12-01 Thread Bert Gunter
strsplit is certainly an alternative, but your approach is unnecessarily complicated and inefficient. Do this, instead: sapply(strsplit(x,"/"),length)-1 Cheers, Bert On Thu, Dec 1, 2011 at 7:44 PM, Florent D. wrote: > Resending my code, not sure why the linebreaks got eaten: > >> x <- data.fram

Re: [R] Summarizing elements of a list

2011-12-01 Thread R. Michael Weylandt
Similarly, this might work: unlist(lapply(Version1_, `[`,"First")) Michael On Thu, Dec 1, 2011 at 9:41 PM, Sarah Goslee wrote: > How about: > > lapply(Version1_, subset, subset=c(TRUE, FALSE)) > or sapply() depending on what you want the result to look like. > > Thanks for the reproducible exam

Re: [R] transform data.frame holding answers --> data.frame holding logicals

2011-12-01 Thread Florent D.
I have this. I have modified your input structure to be a matrix. I think it is generally recommended to use matrices over data.frames when your data allows it, i.e., when you only have one type of data, here character(). Matrices are easier to work with. x <- matrix(  c('BMW', '', '',    'Mercedes

[R] simple lm question

2011-12-01 Thread Worik R
I really would like to be able to read about this in a document but I cannot find my way around the documentation properly Given the code... M <- matrix(runif(5*20), nrow=20) colnames(M) <- c('a', 'b', 'c', 'd', 'e') ind <- c(1,2,3,4) dep <- 5 I can then do... l2 <- lm(M[,dep]~M[,ind]) ## Clearl

Re: [R] Counting the occurences of a charater within a string

2011-12-01 Thread Florent D.
Resending my code, not sure why the linebreaks got eaten: > x <- data.frame(Col1 = c("abc/def", "ghi/jkl/mno"), stringsAsFactors = FALSE) > count.slashes <- function(string)sum(unlist(strsplit(string, NULL)) == "/") > within(x, Col2 <- vapply(Col1, count.slashes, 1)) Col1 Col2 1 abc/d

Re: [R] Counting the occurences of a charater within a string

2011-12-01 Thread Florent D.
I used within and vapply: x <- data.frame(Col1 = c("abc/def", "ghi/jkl/mno"), stringsAsFactors = FALSE) count.slashes <- function(string)sum(unlist(strsplit(string, NULL)) == "/")within(x, Col2 <- vapply(Col1, count.slashes, 1))          Col1 Col21     abc/def    12 ghi/jkl/mno    2 On Thu, Dec 1

Re: [R] Summarizing elements of a list

2011-12-01 Thread Sarah Goslee
How about: lapply(Version1_, subset, subset=c(TRUE, FALSE)) or sapply() depending on what you want the result to look like. Thanks for the reproducible example. Sarah On Thu, Dec 1, 2011 at 5:17 PM, LCOG1 wrote: > Hi everyone, >   I looked around the list for a while but couldn't find a soluti

[R] Summarizing elements of a list

2011-12-01 Thread LCOG1
Hi everyone, I looked around the list for a while but couldn't find a solution to my problem. I am storing some results to a simulation in a list and for each element i have two separate vectors(is that what they are called, correct my vocab if necessary). See below Version1_<-list() for(i in

Re: [R] Assign name to object for each iteration in a loop.

2011-12-01 Thread lglew
Thanks Michael! Yeah, that dealt with one of the problems. I still get the following error message: Error in cat(list(...), file, sep, fill, labels, append) : argument 1 (type 'list') cannot be handled by 'cat' I know that this has something to do with writing the names of the output file, an

[R] Plot coordinates with gradien colour according to a different column

2011-12-01 Thread lara
Hi everyone, I'm having problems with plotting my data. I have a set of positions with different attributes and I'm wondering if I can plot it, as x,y plot, with gradient colours according to a 3rd factor. Is it possible to show gradient segments between postions and not one-coloured segment betwe

Re: [R] strange row numbering after rbind-ing a list

2011-12-01 Thread Carl Witthoft
Sorry -- I meant to write 'row names,' but the question specifically is where those unlikely numbers come from. So I guess it comes down to why, when 'bar' is the first item, the row name is assigned '2' rather than '1' . On 12/1/11 6:26 PM, Sarah Goslee wrote: Those are row *names*, not r

Re: [R] Moving column averaging

2011-12-01 Thread B77S
Sorry for that, and thanks Gabor, I could have sworn that it wouldn't. Gabor Grothendieck wrote > > On Thu, Dec 1, 2011 at 7:13 PM, B77S wrote: >> # need zoo to use rollapply() >> >> # your data (I called df) >> df <- structure(list(a = 1:2, b = 2:3, c = c(5L, 9L), d = c(9L, 6L), >>

Re: [R] Moving column averaging

2011-12-01 Thread Gabor Grothendieck
On Thu, Dec 1, 2011 at 7:13 PM, B77S wrote: > # need zoo to use rollapply() > > # your data (I called df) > df <- structure(list(a = 1:2, b = 2:3, c = c(5L, 9L), d = c(9L, 6L), >    e = c(1L, 5L), f = c(4, 7)), .Names = c("a", "b", "c", "d", > "e", "f"), class = "data.frame", row.names = c(NA, -2L

Re: [R] calculate mean of multiple rows in a data frame

2011-12-01 Thread B77S
-- View this message in context: http://r.789695.n4.nabble.com/calculate-mean-of-multiple-rows-in-a-data-frame-tp4130468p4143875.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/ma

Re: [R] legend, "lheight", and alignment

2011-12-01 Thread Peter Ehlers
On 2011-12-01 08:54, emorway wrote: Hello, A bit of fairly simple code, yet I don't seem to be able to manipulate it quite as much as I would like: 1) It would be nice if the objects appearing in the legend were aligned, and by aligned I mean the boxes are centered over the lines. Do I need t

Re: [R] logistic regression - glm.fit: fitted probabilities numerically 0 or 1 occurred

2011-12-01 Thread Ben quant
Thank you so much for your help. The data I am using is the last file called l_yx.RData at this link (the second file contains the plots from earlier): http://scientia.crescat.net/static/ben/ Seems like the warning went away with pmin(x,1) but now the OR is over 15k. If I multiple my x's by 1000

Re: [R] Moving column averaging

2011-12-01 Thread B77S
# need zoo to use rollapply() # your data (I called df) df <- structure(list(a = 1:2, b = 2:3, c = c(5L, 9L), d = c(9L, 6L), e = c(1L, 5L), f = c(4, 7)), .Names = c("a", "b", "c", "d", "e", "f"), class = "data.frame", row.names = c(NA, -2L)) # transpose and make a zoo object df2 <- zoo(t(df

Re: [R] logistic regression - glm.fit: fitted probabilities numerically 0 or 1 occurred

2011-12-01 Thread peter dalgaard
On Dec 1, 2011, at 23:43 , Ben quant wrote: > I'm not proposing this as a permanent solution, just investigating the > warning. I zeroed out the three outliers and received no warning. Can someone > tell me why I am getting no warning now? It's easier to explain why you got the warning before.

Re: [R] strange row numbering after rbind-ing a list

2011-12-01 Thread Sarah Goslee
Those are row *names*, not row *numbers*. It's just that if you don't specify, numbers are assigned by default when creating a data frame. Your rbind() statements are implicitly creating a data frame, so the likely information is in ?data.frame: check.names: logical. If ‘TRUE’ then the names of

Re: [R] Summarizing elements of a list

2011-12-01 Thread B77S
Someone is bound to know a better way, but... subset(unlist(Version1_), subset=names(unlist(Version1_))=="First") LCOG1 wrote > > Hi everyone, >I looked around the list for a while but couldn't find a solution to my > problem. I am storing some results to a simulation in a list and fo

[R] strange row numbering after rbind-ing a list

2011-12-01 Thread Carl Witthoft
"Not that it really matters, but" Can someone explain how the row numbers get assigned in the following sequence? It looks like something funky happens when rbind() coerces 'bar' into a dataframe. In either sequence of rbind below, once you get past the first two rows, the row numbers count nor

Re: [R] logistic regression - glm.fit: fitted probabilities numerically 0 or 1 occurred

2011-12-01 Thread Ben quant
I'm not proposing this as a permanent solution, just investigating the warning. I zeroed out the three outliers and received no warning. Can someone tell me why I am getting no warning now? I did this 3 times to get rid of the 3 outliers: mx_dims = arrayInd(which.max(l_yx), dim(l_yx)) l_yx[mx_dims

Re: [R] logistic regression - glm.fit: fitted probabilities numerically 0 or 1 occurred

2011-12-01 Thread Ben quant
Oops! Please ignore my last post. I mistakenly gave you different data I was testing with. This is the correct data: Here you go: > attach(as.data.frame(l_yx)) > range(x[y==0]) [1] 0.0 14.66518 > range(x[y==1]) [1] 0.0 13.49791 How do I know what is acceptable? Also, here are the scr

Re: [R] logistic regression - glm.fit: fitted probabilities numerically 0 or 1 occurred

2011-12-01 Thread Ben quant
Here you go: > attach(as.data.frame(l_yx)) > range(x[y==1]) [1] -22500.746. > range(x[y==0]) [1] -10076.5303653.0228 How do I know what is acceptable? Also, here are the screen shots of my data that I tried to send earlier (two screen shots, two pages): http://scientia.crescat.n

[R] Error message: object 'A' not found

2011-12-01 Thread stephg0809
I ran the following code: And I run into problems with the last line of code (when it says hn<-..). I keep getting an error code: Error in distsamp(~hab ~ 1, peldist, keyfun = "halfnorm", output = "density", : object 'A' not found I would appreciate any and all help. rm(list=ls(all

[R] mixed effect model (multilevel)

2011-12-01 Thread franco salerno
Hi, I have a problem with mixed effect model (multilevel). My model that is written in following formulation using the lme4 package and Zelig package: mylogit<- lmer(OVERFLOW ~ ALTEZZA + INTENSITA + ( 1 | CODICE), family= binomial(link = "probit"),data = dati) OVERFLOW can be 0 or 1 and represen

[R] pb with 4D dicom data and oro.dicom

2011-12-01 Thread jean-paul.vallee
Hello, I have the following problem. After a PACS upgrade in our hospital, the dynamic 3D images acquired after contrast media injection with a 3T Philips MRI are all saved in a single 4D file instead of a series of 2D images containing multiple 3D images over time. I used to convert this serie

Re: [R] Writing a function, want a string argument to define the name of the excel sheet to be called

2011-12-01 Thread AOLeary
Thanks Michael, I'll keep that in mind if I want to do anything more complicated. -- View this message in context: http://r.789695.n4.nabble.com/Writing-a-function-want-a-string-argument-to-define-the-name-of-the-excel-sheet-to-be-called-tp4128384p4130233.html Sent from the R help mailing list ar

Re: [R] legend, "lheight", and alignment

2011-12-01 Thread Gabor Grothendieck
On Thu, Dec 1, 2011 at 11:54 AM, emorway wrote: > Hello, > > A bit of fairly simple code, yet I don't seem to be able to manipulate it > quite as much as I would like: > > 1)  It would be nice if the objects appearing in the legend were aligned, > and by aligned I mean the boxes are centered over

[R] [R-pkgs] RSQLite 0.11.0

2011-12-01 Thread Seth Falcon
A new version of RSQLite has been uploaded to CRAN. Details on the enhancements and fixes are below. Please direct questions to the R-sig-db mailing list. Version 0.11.0 - Enhance type detection in sqliteDataType (dbDataType). The storage mode of a data.frame column is now used as part of the

[R] MCMCglmm error with multinomial distribution

2011-12-01 Thread Håvard Wahl Kongsgård
With binomial/binary responses (0|1) running MCMCglmm with family="multinomial" terminates with Error in if (nJ < 1) { : missing value where TRUE/FALSE needed with family="categorical" there are no errors I have not looked in the code, do I need format the responses TRUE/FALSE , or is this just

Re: [R] logistic regression - glm.fit: fitted probabilities numerically 0 or 1 occurred

2011-12-01 Thread peter dalgaard
On Dec 1, 2011, at 21:32 , Ben quant wrote: > Thank you for the feedback, but my data looks fine to me. Please tell me if > I'm not understanding. Hum, then maybe it really is a case of a transition region being short relative to the range of your data. Notice that the warning is just that: a

[R] Fw: calculate mean of multiple rows in a data frame

2011-12-01 Thread Jabez Wilson
NAME ID a b c d 1 Control_1 probe~B01R01C01 381 213 345 653 2 Control_2 probe~B01R01C02 574 629 563 783 3 Control_1 probe~B01R09C01 673 511 521 967 4 Control_3 probe~B01R09C02 53 809 999 50 5 MM0289~RFU:11810.15 probe~B29R13C06 681 34 115 587 6 MM0289~RFU:9238.41 probe~B29R13C05 784 443 20

Re: [R] combining arima and ar function

2011-12-01 Thread R. Michael Weylandt
I think your attachment got scrubbed so I can't verify this, but i think the difficulty is that the "inner" apply returns a whole set of orders, instead of just one and that throws arima off: would this work? getOrder <- function(x) ar(na.omit(x), method = "mle")$order all.equal(apply(TSX, 2, get

[R] calculate mean of multiple rows in a data frame

2011-12-01 Thread Jabez Wilson
Dear all, I have a data frame (DF) in the following format: NAME ID a b c d 1 Control_1 probe~B01R01C01 381 213 345 653 2 Control_2 probe~B01R01C02 574 629 563 783 3 Control_1 probe~B01R09C01 673 511 521 967 4 Control_3 probe~B01R09C02 53 809 999 50 5 MM0289~RFU:11810.15 probe~B29R13

Re: [R] logistic regression - glm.fit: fitted probabilities numerically 0 or 1 occurred

2011-12-01 Thread Ben quant
Thank you for the feedback, but my data looks fine to me. Please tell me if I'm not understanding. I followed your instructions and here is a sample of the first 500 values : (info on 'd' is below that) > d <- as.data.frame(l_yx) > x = with(d, y[order(x)]) > x[1:500] # I have 1's and 0's dispers

Re: [R] vector

2011-12-01 Thread Sarah Goslee
On Thu, Dec 1, 2011 at 3:11 PM, " Majid " wrote: > Hi, > yes, It is homework, Then ask your TA/instructor for help. > > These are 2 command: > first for generating data: > (1:10) > that output is 1 2 310 > ok ? > second is : > a1<-c( 1:10) > what is the output ?I didnot see any thing. Exact

Re: [R] What's the baseline model when using coxph with factor variables?

2011-12-01 Thread David Winsemius
On Dec 1, 2011, at 1:00 PM, William Dunlap wrote: Terry will correct me if I'm wrong, but I don't think the answer to this question is specific to the coxph function. It depends on our interpretation of the questioner's intent. My answer was predicated on the assumption that the phrase "bas

Re: [R] vector

2011-12-01 Thread Sarah Goslee
Hi, On Thu, Dec 1, 2011 at 2:43 PM, " Majid " wrote: > Dear Sarah. > Thanks so much,Really I am new in this software,I am wrking to learn the > software. First, you should always send your replies to the list. That way information can help others, and more people are available to provide advice.

Re: [R] transform data.frame holding answers --> data.frame holding logicals

2011-12-01 Thread Jean V Adams
saschaview wrote on 12/01/2011 12:30:18 PM: > Hello > > I have a data frame, x, holding 5 persons answering the question which > cars they have used: > > # the data frame > x <- as.data.frame( >matrix( > c('BMW', '', '', >'Mercedes', 'VW', '', >'Skoda', 'VW', 'BMW', >

Re: [R] Change the limits of a plot "a posteriori"

2011-12-01 Thread Duncan Murdoch
On 01/12/2011 1:12 PM, jcano wrote: Hi all How can I change the limits (xlim or ylim) in a plot that has been already created? You can't, if you're using classic R graphics. They use an "ink on paper" model of graphics. If you want to change what you've drawn, you get a new piece of paper.

Re: [R] Assign name to object for each iteration in a loop.

2011-12-01 Thread R. Michael Weylandt
I think part of your problem is the loop: you probably mean for(i in unique(area)) Michael On Thu, Dec 1, 2011 at 1:13 PM, lglew wrote: > Hi R-users, > > I'm trying to produce decompositions of a multiple time-series, grouped by a > factor (called "area"). I'm modifying the code in the STLperA

Re: [R] how to get inflection point in binomial glm

2011-12-01 Thread René Mayer
Thanks David and Rubén! @David: indeed 15 betas I forgot the interaction terms, thanks for correcting! @Rubén: the re-parameterize would be done within nls()? how to do this practically with including the factor predictor? and yes, we can solve within each group for Y=0 getting 0=b0+b1*X |

Re: [R] Change the limits of a plot "a posteriori"

2011-12-01 Thread Jean V Adams
jcano wrote on 12/01/2011 12:12:03 PM: > Hi all > > How can I change the limits (xlim or ylim) in a plot that has been already > created? > > For example, consider this naive example > curve(dbeta(x,2,4)) > curve(dbeta(x,8,13),add=T,col=2) > > When adding the second curve, it goes off the ori

[R] question about plsr() results

2011-12-01 Thread Vytautas Rakeviius
Hi, With some help I learned how to use plsr(Y~x, 2, data=my) function in R (and build "my" from vector "Y" and matrix "x"). But still I have question about results interpretation. In the end I want to construct prediction function in form: Y=a1x1+a2x2 But I do not understand how to do it. Docu

[R] nested random effects with lmer

2011-12-01 Thread Charles Li
Hi, I have a multilevel situation where subjects are nested within clinics, and each subject has multiple measurements. For simplicity, suppose there 4 clinics, 3 subjects per clinic, and each subject has 3 repeated measures. Outcome is continuous. I am trying to implement this model with lme

[R] Assign name to object for each iteration in a loop.

2011-12-01 Thread lglew
Hi R-users, I'm trying to produce decompositions of a multiple time-series, grouped by a factor (called "area"). I'm modifying the code in the STLperArea function of package ndvits, as this function only plots produces stl plots, it does not return the underlying data. I want to extract the tren

[R] Change the limits of a plot "a posteriori"

2011-12-01 Thread jcano
Hi all How can I change the limits (xlim or ylim) in a plot that has been already created? For example, consider this naive example curve(dbeta(x,2,4)) curve(dbeta(x,8,13),add=T,col=2) When adding the second curve, it goes off the original limits computed by R for the first graph, which are rou

Re: [R] logistic regression - glm.fit: fitted probabilities numerically 0 or 1 occurred

2011-12-01 Thread peter dalgaard
On Dec 1, 2011, at 18:54 , Ben quant wrote: > Sorry if this is a duplicate: This is a re-post because the pdf's mentioned > below did not go through. Still not there. Sometimes it's because your mailer doesn't label them with the appropriate mime-type (e.g. as application/octet-stream, which is

Re: [R] Replace columns in a data.frame randomly splitted

2011-12-01 Thread R. Michael Weylandt
I repeat myself: Any more automated solution will depend on whether your data has rownames or not. [...] create a plain text representation of R data using the dput() command. Another way that might make more sense is to cbind() the data you need later on before the split and then it will be carr

[R] transform data.frame holding answers --> data.frame holding logicals

2011-12-01 Thread saschaview
Hello Hello I have a data frame, x, holding 5 persons answering the question which cars they have used: # the data frame x <- as.data.frame( matrix( c('BMW', '', '', 'Mercedes', 'VW', '', 'Skoda', 'VW', 'BMW', '', '', '', 'VW', 'Skoda', '' ), ncol=3,

Re: [R] Writing a function, want a string argument to define the name of the excel sheet to be called

2011-12-01 Thread R. Michael Weylandt
Just a heads up -- I don't think your code will work with an actual .xls(x) file, only .txt, .csv, etc (aka, plain text files). I may be wrong about that, but if you actually need to work with Excel files directly you will need an additional package. Michael On Thu, Dec 1, 2011 at 9:10 AM, AOLear

Re: [R] Counting the occurences of a charater within a string

2011-12-01 Thread Bert Gunter
## It's not a data frame -- it's just a vector. > x [1] "abc/def" "ghi/jkl/mno" > gsub("[^/]","",x) [1] "/" "//" > nchar(gsub("[^/]","",x)) [1] 1 2 > ?gsub ?nchar -- Bert On Thu, Dec 1, 2011 at 8:32 AM, Douglas Esneault wrote: > I am new to R but am experienced SAS user and I was hoping t

Re: [R] What's the baseline model when using coxph with factor variables?

2011-12-01 Thread William Dunlap
Terry will correct me if I'm wrong, but I don't think the answer to this question is specific to the coxph function. For all the [well-written] formula-based modelling functions (essentially, those that call model.frame and model.matrix to interpret the formula) the option "contrasts" controls how

[R] logistic regression - glm.fit: fitted probabilities numerically 0 or 1 occurred

2011-12-01 Thread Ben quant
Sorry if this is a duplicate: This is a re-post because the pdf's mentioned below did not go through. Hello, I'm new'ish to R, and very new to glm. I've read a lot about my issue: Warning message: glm.fit: fitted probabilities numerically 0 or 1 occurred ...including: http://tolstoy.newcastle.e

Re: [R] What's the baseline model when using coxph with factor variables?

2011-12-01 Thread David Winsemius
On Dec 1, 2011, at 12:00 PM, Andreas Schlicker wrote: Hi all, I'm trying to fit a Cox regression model with two factor variables but have some problems with the interpretation of the results. Considering the following model, where var1 and var2 can assume value 0 and 1: coxph(Surv(time

Re: [R] bigmemory on Solaris

2011-12-01 Thread RogerP
Thanks again for your help. I've been able to add several packages, bigmemory seems to be the only one to fail and it fails on isinf. Is there a way I can download the code and change it to include a ininf function or definition? I'm using the GNU compiler; should I have been using the SUN St

[R] Estimation of AR(1) Model with Markov Switching

2011-12-01 Thread napps22
Dear R users, I have been trying to obtain the MLE of the following model state 0: y_t = 2 + 0.5 * y_{t-1} + e_t state 1: y_t = 0.5 + 0.9 * y_{t-1} + e_t where e_t ~ iidN(0,1) transition probability between states is 0.2 I've generated some fake data and tried to estimate the parameters using

[R] Counting the occurences of a charater within a string

2011-12-01 Thread Douglas Esneault
I am new to R but am experienced SAS user and I was hoping to get some help on counting the occurrences of a character within a string at a row level. My dataframe, x, is structured as below: Col1 abc/def ghi/jkl/mno I found this code on the board but it counts all occurrences of "/" in the d

Re: [R] References for book "R In Action" by Kabacoff (Uwe Ligges)

2011-12-01 Thread Pablo Domínguez Vaselli
The references are here: http://manning.com/kabacoff/excerpt_references.pdf (they will be included on the next printing too, got omitted by mistake) regards, Pablo [[alternative HTML version deleted]] __ R-help@r-project.org mailing list http

[R] What's the baseline model when using coxph with factor variables?

2011-12-01 Thread Andreas Schlicker
Hi all, I'm trying to fit a Cox regression model with two factor variables but have some problems with the interpretation of the results. Considering the following model, where var1 and var2 can assume value 0 and 1: coxph(Surv(time, cens) ~ factor(var1) * factor(var2), data=temp) What is t

Re: [R] vector

2011-12-01 Thread Sarah Goslee
Hi, On Thu, Dec 1, 2011 at 10:35 AM, " Majid " wrote: > Hi. > Can you please answer to my questions about R ? > 1.how can I write command for vector ? > > for exaple in this sample : > I have this : > a1 <- c (1:10) > now how can I put in the vector ? I'm afraid I don't understand your question.

[R] R package source branching

2011-12-01 Thread Mehmet Suzen
Dear List, I was wondering if any of you worked on an R package which has many branches on a repository i.e. SVN. Is it recommended to branch an R package source tree based on a specific project? I know it depends on project but it would be great to hear opinions from R community. Best, M

Re: [R] R, PostgresSQL and poor performance

2011-12-01 Thread Gabor Grothendieck
On Thu, Dec 1, 2011 at 10:02 AM, Berry, David I. wrote: > Hi List > > Apologies if this isn't the correct place for this query (I've tried a search > of the mail archives but not had much joy). > > I'm running R (2.14.0)  on a Mac (OSX v 10.5.8, 2.66GHz, 4GB memory) and am > having a few perform

Re: [R] FIML with missing data in sem package

2011-12-01 Thread yrosseel
On 12/01/2011 05:25 PM, Dustin Fife wrote: What is your goal? I have used and like mice pretty well, but using mice + sem to try to address missingness seems like more work than using FIML in OpenMx or lavaan to try to address it. Is there a reason you want to use the sem package or a reason y

[R] legend, "lheight", and alignment

2011-12-01 Thread emorway
Hello, A bit of fairly simple code, yet I don't seem to be able to manipulate it quite as much as I would like: 1) It would be nice if the objects appearing in the legend were aligned, and by aligned I mean the boxes are centered over the lines. Do I need to adjust the use of "NA" in the code b

Re: [R] Resampling with replacement on a binary (0, 1) dataset to get Cis

2011-12-01 Thread David Winsemius
On Dec 1, 2011, at 10:49 AM, lincoln wrote: Thanks. So, suppose for one specific year (first year over 10) the percentage of successes deriving from 100 trials with 38 successes (and 62 failures), its value would be 38/100=0.38. I could calculate its confidence intervals this way: succes

Re: [R] How to do Hotelling's t2 test?

2011-12-01 Thread S Ellison
> Hi, I want to do a 2 sample hotelling's test but i can't > figure out how. When i type T2.test it says there is no such > test and when i tried library(rrcov) it says there is no such > program. Have you installed rrcov using install.packages? S Ellison**

Re: [R] how to get inflection point in binomial glm

2011-12-01 Thread David Winsemius
On Dec 1, 2011, at 8:24 AM, René Mayer wrote: Dear All, I have a binomial response with one continuous predictor (d) and one factor (g) (8 levels dummy-coded). glm(resp~d*g, data, family=binomial) Y=b0+b1*X1+b2*X2 ... b7*X7 Dear Dr Mayer; I think it might be a bit more complex than tha

Re: [R] round to specific intervals

2011-12-01 Thread Michael Kao
Thanks for all the response, I manage to write a small function to complete what I want based on the wonderful helps. iround <- function(x, interval){ ## Round numbers to desired interval ## ## Args: ## x:Numeric vector to be rounded ## interval: The interval th

Re: [R] How to speed up int2bin conversion?

2011-12-01 Thread Jeff Newmiller
You might be interested in package "bit". --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live Go... Live: OO#.. Dea

Re: [R] Random Forests in R

2011-12-01 Thread Liaw, Andy
The first version of the package was created by re-writing the main program in the original Fortran as C, and calls other Fortran subroutines that were mostly untouched, so dynamic memory allocation can be done. Later versions have most of the Fortran code translated/re-written in C. Currently

Re: [R] round to specific intervals

2011-12-01 Thread Duncan Murdoch
On 01/12/2011 10:55 AM, Michael Kao wrote: Dear R users/helpers, I am wondering is there an existing function in which you can round numbers to a set of values. I know you can use 5 * round(x/5) for rounding to the nearest 5 or so, but what if the interval size is not constant. For example: ##

Re: [R] Nomogram with stratified cph in rms package, how to get failure probability

2011-12-01 Thread min
Got it. Thank you so much for the help! Min Yi MD, PhD Department of Surgical Oncology - Unit 1484 1400 Pressler Street, #FCT17.6061 University of Texas M.D. Anderson Cancer Center P.O. Box 301402 Houston, TX 77230-1402 Phone: 713-563-1874 Fax: 713-792-4689 From: Frank Harrell [via R] [mailto:

[R] vector

2011-12-01 Thread " Majid "
Hi. Can you please answer to my questions about R ? 1.how can I write command for vector ? for exaple in this sample : I have this : a1 <- c (1:10) now how can I put in the vector ? bye for now, Thanks a lot. Majid. [[alternative HTML version deleted]] _

Re: [R] FIML with missing data in sem package

2011-12-01 Thread Dustin Fife
> > What is your goal? I have used and like mice pretty well, but using > mice + sem to try to address missingness seems like more work than > using FIML in OpenMx or lavaan to try to address it. Is there a > reason you want to use the sem package or a reason you do not want to > use the others?

Re: [R] How to speed up int2bin conversion?

2011-12-01 Thread Jonas Jägermeyr
On 12/01/2011 02:46 PM, jim holtman wrote: If we assume that you are just convert 8 bits, here is one way with a table lookup. If more than 8 bits, just partition the data and repeat. This sets up a mapping table one time for the lookup. Does 1M in 0.3 seconds on my computer; is this fast enou

Re: [R] Resampling with replacement on a binary (0, 1) dataset to get Cis

2011-12-01 Thread lincoln
Thanks. So, suppose for one specific year (first year over 10) the percentage of successes deriving from 100 trials with 38 successes (and 62 failures), its value would be 38/100=0.38. I could calculate its confidence intervals this way: > success<-38 > total<-100 > prop.test(success,total,p=0.5,a

[R] How to do Hotelling's t2 test?

2011-12-01 Thread jpquinn91
Hi, I want to do a 2 sample hotelling's test but i can't figure out how. When i type T2.test it says there is no such test and when i tried library(rrcov) it says there is no such program. Cheers. -- View this message in context: http://r.789695.n4.nabble.com/How-to-do-Hotelling-s-t2-test-tp41287

[R] R, PostgresSQL and poor performance

2011-12-01 Thread Berry, David I.
Hi List Apologies if this isn't the correct place for this query (I've tried a search of the mail archives but not had much joy). I'm running R (2.14.0) on a Mac (OSX v 10.5.8, 2.66GHz, 4GB memory) and am having a few performance issues with reading data in from a Postres database (using RPos

Re: [R] Writing a function, want a string argument to define the name of the excel sheet to be called

2011-12-01 Thread AOLeary
Thank you very much, that does exactly what I want it to! :) Aodhán -- View this message in context: http://r.789695.n4.nabble.com/Writing-a-function-want-a-string-argument-to-define-the-name-of-the-excel-sheet-to-be-called-tp4128384p4128495.html Sent from the R help mailing list archive at Nabb

Re: [R] round to specific intervals

2011-12-01 Thread Bert Gunter
?findInterval .. would get you the endpoints and then you could determine which is nearer. Of course in your "example", everything would get "rounded" to 1. -- Bert On Thu, Dec 1, 2011 at 7:55 AM, Michael Kao wrote: > Dear R users/helpers, > > I am wondering is there an existing function in whi

Re: [R] Nomogram with stratified cph in rms package, how to get failure probability

2011-12-01 Thread Frank Harrell
Hazard() is not implemented except for parametric survival models. You are not calling nomogram() correctly; in rms the plotting step is separated from the nomogram computations. To plot cumulative event rates do something like: mort10 <- function(lp) 1 - surv(10,lp) and tell nomogram about mor

[R] round to specific intervals

2011-12-01 Thread Michael Kao
Dear R users/helpers, I am wondering is there an existing function in which you can round numbers to a set of values. I know you can use 5 * round(x/5) for rounding to the nearest 5 or so, but what if the interval size is not constant. For example: ## Not run test <- rnorm(100) round(test, c

Re: [R] efficient ways to dynamically grow a dataframe

2011-12-01 Thread R. Michael Weylandt
I'd also suggest you read circle 2 of the "R inferno" (just google it) which has some helpful tips on how to deal with these sorts of problems. Also, did you know that matrices can have column names and that rbind() preserves them? E.g., m <- matrix(1:6, 3); colnames(m) <- letters[1:2] print(m)

Re: [R] hi all.regarding quantile regression results..

2011-12-01 Thread R. Michael Weylandt
This really isn't the appropriate forum for most of your questions: I'd suggest you work through the Wikipedia article on quantiles regression and direct follow up to stats.stackexchange.com. As to the R question: use the predict() function. Michael On Dec 1, 2011, at 8:12 AM, narendarreddy

Re: [R] x, y for point of intersection

2011-12-01 Thread Monica Pisica
Hi everybody, Thanks for checking my code, Hans, it help to see where my initial mistake was. I am sorry i assumed that there was a minimization problem. In short i had 2 "wavy" lines (left and right) that didn't intersect and lots of straight parallel lines that intersect the first 2 lines.

Re: [R] how to get inflection point in binomial glm

2011-12-01 Thread Rubén Roa
Assuming a logistic model, for each group solve for d at Y=0, or solve for d at p=0.5, where d is your continuous predictor, Y is the logit score, and p is the probability of success in the binomial model. After that you can get the standard error of the inflection point by Taylor series (aka de

Re: [R] FIML with missing data in sem package

2011-12-01 Thread Dustin Fife
Good idea. I'll give it a try. Thanks! On Thu, Dec 1, 2011 at 6:18 AM, John Fox wrote: > Dear Dustin, > > > -Original Message- > > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > > project.org] On Behalf Of Dustin Fife > > Sent: November-30-11 9:51 PM > > To: r-help@r-proj

Re: [R] R logo in eps formt

2011-12-01 Thread Matt Shotwell
See this earlier post for SVG logos: http://tolstoy.newcastle.edu.au/R/e12/devel/10/10/0112.html Using Image Magick, do something like convert logo.svg logo.eps On Thu, 2011-12-01 at 10:56 +0700, Ben Madin wrote: > G'day all, > > Sorry if this message has been posted before, but searching fo

Re: [R] Raster manipulation in R

2011-12-01 Thread jon . skoien
Hi, Alternatively you could have a look at the function "terrain" in the raster package, it can calculate the slope for you using different algorithms, not sure if the one below is included though. For typical spatial requests like this, you could also use the mailing-list r-sig-geo. Cheer

Re: [R] ordinal data simulation

2011-12-01 Thread David Winsemius
On Dec 1, 2011, at 2:06 AM, yuying shi wrote: Dear all, I am doing an ordinal data simulation. I have a question regarding the cut off values between categories. Suppose I have three categories, if I do regression, there should be two cut off values. I find some simulation code for the

Re: [R] efficient ways to dynamically grow a dataframe

2011-12-01 Thread jim holtman
First, dataframes can be much slower than matrices, for example, if you are changing/accessing values a lot. I would suggest that you use a matrix since is seems that all your values are numeric. Allocate a large empty matrix to start (hopefully as large as you need). If you exceed this, you hav

  1   2   >