Re: [R] Ceiling function gives me wrong answer

2012-11-28 Thread Berend Hasselman
On 29-11-2012, at 03:10, Ying Zheng wrote: > Hi all, > > I have a very simple code, but gives a wrong answer. > > a=1000 > b=1000^(1/3) > c=ceiling(a/b) > > then c=101, > > if change the code to be > a=1000 > b=10 > c=ceiling(a/b) > > then c=100 is fine. See R FAQ 7.31 "Why doesn't R think

Re: [R] Ceiling function gives me wrong answer

2012-11-28 Thread Anthony Damico
not sure ceiling() is behaving inappropriately.. > b <- 1000^( 1/3 ) > b [1] 10 > options( digits = 22 ) > b [1] 9.998223643 check out http://blog.revolutionanalytics.com/2009/11/floatingpoint-errors-explained.htmlfor more detail On Wed, Nov 28, 2012 at 9:10 PM, Ying Zheng wro

Re: [R] Ceiling function gives me wrong answer

2012-11-28 Thread Daniel Nordlund
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of Ying Zheng > Sent: Wednesday, November 28, 2012 6:11 PM > To: r-help@r-project.org > Subject: [R] Ceiling function gives me wrong answer > > Hi all, > > I have a very simple code

[R] constrOptim

2012-11-28 Thread songm4
Dear R users, I am using the function "constrOptim" to minimize the -1*log-likelihood where \beta_i>=0 i=1,...,p and \beta_0 is unconstrained. I construct u_i as 000 ... 0 010 ... 0 001 ... 0 .

[R] Ceiling function gives me wrong answer

2012-11-28 Thread Ying Zheng
Hi all, I have a very simple code, but gives a wrong answer. a=1000 b=1000^(1/3) c=ceiling(a/b) then c=101, if change the code to be a=1000 b=10 c=ceiling(a/b) then c=100 is fine. Thank you for the help. [[alternative HTML version deleted]] __

[R] Error 0ps.factor: level sets of factors are different

2012-11-28 Thread lind35
I have two data sets: "new" and "combo". Within both data set, each row pertains to a unique individual. The "combo" data set is a subset of the "new" data set, meaning that all individuals within "combo" are within "new" but not all individuals within "new" are within "combo". Thus, nrow(new) > nr

Re: [R] what's this character?

2012-11-28 Thread John
On Wed, 28 Nov 2012 16:44:59 -0800 (PST) "Shi, Tao" wrote: > Hi list, > > I've encounter this problem (see below).  I know it's particularly > R-related and it's easy to get by but it still bothers me a lot.  > > > It looks the last character of "N.C. " is a space to me, but it's > clearly no

Re: [R] Can you turn a string into a (working) symbol?

2012-11-28 Thread Andrew Hoerner
Thanks so much Greg! I'm going to take all these suggestions -- yours, jim holtman's, Michael Weylandt's, and several others, and spend a couple of days trying them out to see if I can make them work. I'll report back. I'm going to have to look especially closely at loglin -- not primarily becaus

Re: [R] Speeding reading of large file

2012-11-28 Thread Nordlund, Dan (DSHS/RDA)
Jim, My original file used Dennis' script, so it was 1 lines. I created a 100,000 line file and the relative results were the same. I ran your code on the file and your second and third approaches did not produce correct results. It may be because the original data example had 2 header l

Re: [R] what's this character?

2012-11-28 Thread Peter Langfelder
On Wed, Nov 28, 2012 at 4:44 PM, Shi, Tao wrote: > Hi list, > > I've encounter this problem (see below). I know it's particularly R-related > and it's easy to get by but it still bothers me a lot. > > > It looks the last character of "N.C. " is a space to me, but it's clearly > not. Can someon

Re: [R] Speeding reading of large file

2012-11-28 Thread jim holtman
How long was the file that you tested? Here is a test with a file that is 110400 lines long with 4416 replicated headers that will have to be removed. Using 'text=' or textConnection is very slow for these operations. Writing to a temporary file can be faster for especially large files. Notice t

Re: [R] error, R commends cannot show the expected output

2012-11-28 Thread Jeff Newmiller
You are making it difficult to help you. You have already asked essentially the same question under a different subject heading, and have not responded to requests for more specific information about your problem. Note that the problems you describe are not common, so you may have to be very de

Re: [R] error, R commends cannot show the expected output

2012-11-28 Thread Jack Bryan
I run > cars <- c(1, 3, 6, 4, 9) > plot(cars) No graph pops up. Any help will be appreciated. > Date: Wed, 28 Nov 2012 12:35:39 +0900 > From: kri...@ymail.com > To: dtustud...@hotmail.com > CC: r-help@r-project.org > Subject: Re: [R] error, R commends cannot show the expected output > > Hell

Re: [R] error, R commends cannot show the expected output

2012-11-28 Thread Jack Bryan
Hi, The problem comes up again. This time, sink() does not work. Any help will be appreciated. Thanks > CC: r-help@r-project.org > From: michael.weyla...@gmail.com > Subject: Re: [R] error, R commends cannot show the expected output > Date: Wed, 28 Nov 2012 08:09:38 + > To: dtustud...@

Re: [R] what's this character?

2012-11-28 Thread jim holtman
Use 'charToRaw' to see what the bytes making up the string are: > charToRaw('N.C. ') [1] 4e 2e 43 2e 20 On Wed, Nov 28, 2012 at 7:44 PM, Shi, Tao wrote: > Hi list, > > I've encounter this problem (see below). I know it's particularly R-related > and it's easy to get by but it still bothers m

[R] what's this character?

2012-11-28 Thread Shi, Tao
Hi list, I've encounter this problem (see below).  I know it's particularly R-related and it's easy to get by but it still bothers me a lot.  It looks the last character of "N.C. " is a space to me, but it's clearly not.  Can someone tell me a way to figure out what character is in the last p

Re: [R] Confidence intervals for estimates of all independent variables in WLS regression

2012-11-28 Thread Jeff Newmiller
?summary.lm --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Eng

Re: [R] Plot with residuals in mgcv

2012-11-28 Thread William Dunlap
> > fit29<- > > gam(IV~s(G3)+s(V3)+factor(AAR)+s(D3)+s(RUTE,bs="re"),data=subsf,gamma=1.4,method > > ="ML") > > plot(fit29,residuals=T) > > Error in X[, first:last] %*% object$coefficients[first:last] : > > non-conformable arguments Those errors often come from omitting the drop=FALSE argument

[R] Confidence intervals for estimates of all independent variables in WLS regression

2012-11-28 Thread Torvon
I would like to obtain Confidence Intervals for the estimates (unstandardized beta weights) of each predictor in a WLS regression: m1 = lm(x~ x1+x2+x3, weights=W, data=D) SPSS offers that output by default, and I am not able to find a way to do this in R. I read through predict.lm, but I do not f

Re: [R] Speeding reading of large file

2012-11-28 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Fisher Dennis > Sent: Wednesday, November 28, 2012 11:42 AM > To: dcarl...@tamu.edu > Cc: r-help@r-project.org > Subject: Re: [R] Speeding reading of large file > > An interestin

[R] Weight matrix in linear regression

2012-11-28 Thread Emese Vágó
Hi all, I would like to do a weighted linear regression, when the error of the dependent variable is correlated. So I have a weighting (covariance) matrix instead of a vector. As I understood the „weights” argument in the lm function should be a vector and not a matrix. Can anyone suggest m

[R] GSEA package error

2012-11-28 Thread Seb
Dear R gurus I’m trying to use the GSCA package to a series of microarray data (prostate cancer normal vs tumor (29 vs 29 paired)) but I’m running into some problems. I have a matrix (named /data_final/) with 11k rows(genes) and 60 cols (58 samples (29N vs 29T), GO IDs, KEGG IDs). I also have a

Re: [R] Fitting and plotting a coxph with survfit, package(surv)

2012-11-28 Thread David Winsemius
On Nov 28, 2012, at 2:49 PM, Maziar Mohaddes wrote: > The nice thing with R (in contrary to point and click statistical > software) and this community is that you learn alot. Well u are forced to > in order ro be able to ask the question :-) > I am not only refering to codes provided helping me

Re: [R] Fitting and plotting a coxph with survfit, package(surv)

2012-11-28 Thread Maziar Mohaddes
The nice thing with R (in contrary to point and click statistical software) and this community is that you learn alot. Well u are forced to in order ro be able to ask the question :-) I am not only refering to codes provided helping me in the analysis but also pure statistical learning. What I am

[R] Windows 8 stability

2012-11-28 Thread Nelson Chen
My version of R (2.15.2), 64 bit version, has been crashing sporadically running under newly upgraded Windows 8. I suspect it may be some sort of memory allocation issue. Does anyone know of ways one can diagnose and fix this problem? Thanks. Nelson Chen Sent from my iPad

Re: [R] how to keep all zeros in 1st row (not NA)

2012-11-28 Thread Thomas Stewart
Irucka- I got the following, which seems to be what you want. Perhaps you could provide reproducible code. -tgs > as.matrix(data) Time.day X1 X2 X3 X4 [1,]0 0.0 0.0 0.0 0.0 [2,]1 0.16387 0.60612 0.87705 0.83798 [3,]2 0.32774 1.212

Re: [R] Can R be embedded in html?

2012-11-28 Thread Michael Weylandt
Google for the new Shiny package from RStudio. Michael On Nov 28, 2012, at 3:04 PM, chawla wrote: > Hi > I have previously used PHP script in HTML to connect website with the > database and do analysis. > Is it also possible to execute R scripts within HTML files? > Basically I want to create

Re: [R] How to change smoothing constant selection procedure for Winters Exponential Smoothing models?

2012-11-28 Thread Thomas Stewart
Jonathan- First, consider starting the algorithm at this alternative solution. You do this with the optim.start option. HoltWinters( , optim.start = c(alpha = 0.99, beta = 0.001, gamma = 0.001)) If this solution is indeed better, the function should not converge to the old solution. If i

Re: [R] hhmm time format, strptime and %k

2012-11-28 Thread arun
Hi, You could also use: x$Time<-sprintf("%04d",x$Time)  res<-xts(x[,-c(1,2)],order.by=as.POSIXct(paste(x[,1],x[,2],sep=" "),format="%m/%d/%Y %H%M")) res #  Open   High    Low  Close  Up    Down  Volume #2012-11-19 09:35:00 137.89 138.06 137.82 138.05 3202541 3013215   0

[R] dealing with different kinds of environmental data in one matrix

2012-11-28 Thread Maria Kernecker
Hi, I have done a CCA with an environmental data matrix including both relative abundance of plant species, soil properties (continuous, with different units of concentrations), and factors that should explain my species matrix. Only after running the analysis have I realized that I should have d

Re: [R] Predict function in Raster package

2012-11-28 Thread megmurr
I recieved this response from the package authors: This warning comes from the dismo package (predict with Mahanalobis object). You can ignore it. It will go away with the next version of dismo (you can get it from R-Forge). So the problem is in dismo which has not been updated since raster has

Re: [R] hhmm time format, strptime and %k

2012-11-28 Thread arun
Hi, Try this: dat<-read.table(text="     Date Time  Open  High    Low  Close  Up    Down  Volume 1 11/19/2012  935 137.89 138.06 137.82 138.05 3202541 3013215  0 2 11/19/2012  940 138.04 138.40 138.02 138.38 2549660 2107595 4657255 3 11/19/2012  945 138.38 138.40 138.18 138.19 1627379 1

[R] How to change smoothing constant selection procedure for Winters Exponential Smoothing models?

2012-11-28 Thread Jonathan Seaver
Hello all, I am looking for some help in understanding how to change the way R optimizes the smoothing constant selection process for the HoltWinters function. I'm a SAS veteran but very new to R and still learning my way around. Here is some sample data and the current HoltWinters code I'm usin

Re: [R] Order function

2012-11-28 Thread maths123
And yes I want the variable 1 to have the identifier 1 etc. And I need to call this variable "order" so I can use it to create an anova table. -- View this message in context: http://r.789695.n4.nabble.com/Order-function-tp4651022p4651198.html Sent from the R help mailing list archive at Nabbl

[R] genomewide linkage plot?

2012-11-28 Thread leenong75cn
Could anyone recommend some packages for drawing a genomewide linkage plot. the line type. and x-axes in propotion to chromsome length. thanks -- View this message in context: http://r.789695.n4.nabble.com/genomewide-linkage-plot-tp4651202.html Sent from the R help mailing list archive at Nabbl

Re: [R] hhmm time format, strptime and %k

2012-11-28 Thread jim holtman
Try this (prepend leading zero in some cases) > x <- read.table(text = " Date Time Open HighLow Close Up > Down Volume + 1 11/19/2012 935 137.89 138.06 137.82 138.05 3202541 3013215 0 + 2 11/19/2012 940 138.04 138.40 138.02 138.38 2549660 2107595 4657255 + 3 11/19

Re: [R] Can you turn a string into a (working) symbol?

2012-11-28 Thread Greg Snow
In addition, if you go the route of a data frame then the functions to look at are tapply, aggregate, and ave. On Wed, Nov 28, 2012 at 2:02 PM, Greg Snow <538...@gmail.com> wrote: > Yes, I meant FAQ 7.21, must have stuttered in typing, but it is always > good to read other FAQs while looking for

Re: [R] Error message R2Jags

2012-11-28 Thread alexB
Thanks a lot for your quick reply ilai-2! Ok! Sorry for my mistake concerning the list. Thanks again for your answer, aB -- View this message in context: http://r.789695.n4.nabble.com/Error-message-R2Jags-tp4651178p4651209.html Sent from the R help mailing list archive at Nabble.com. _

[R] hhmm time format, strptime and %k

2012-11-28 Thread Costas Vorlow
Hello, I am having trouble with the conversion specifications as described in the strptime help page. > head(dat) Date Time Open HighLow Close UpDown Volume 1 11/19/2012 935 137.89 138.06 137.82 138.05 3202541 3013215 0 2 11/19/2012 940 138.04 138.40 138.02 138.

Re: [R] Can you turn a string into a (working) symbol?

2012-11-28 Thread Greg Snow
Yes, I meant FAQ 7.21, must have stuttered in typing, but it is always good to read other FAQs while looking for a specific one. I did read your full description, though whether I fully understand or not is yet to be seen. It seems like a lot of what you want to do could be simplified by using th

Re: [R] Conditional model in R

2012-11-28 Thread Jagat.K.Sheth
Sounds like a finite mixture model. I haven't read your references but an overall model for such an approach could be f(Y=0; pi, kappa) = 1- pi + pi*f(Y=0|Z=1; kappa) where pi=Pr(Z=1) is the probability of an event, z, and y is the value observed when the event occurs and f is the probability

[R] in Rd documentation, line breaks in code blocks?

2012-11-28 Thread Ulrich Staudinger
Hi everyone, following the gentle advice from this list, I write a package description Rd file. I have a section in there. In this section, I have a subsection. In this subsection, I want to have a code fragment. This code fragment should include several commands, spanning several lines. Example

Re: [R] Plot with residuals in mgcv

2012-11-28 Thread Peter Ehlers
On 2012-11-28 05:02, silje skår wrote: Hi, I am using the mgcv package (version 1.7-22.) running the model works fine, but when I want to have a plot with residuals I get an error. fit29<-gam(IV~s(G3)+s(V3)+factor(AAR)+s(D3)+s(RUTE,bs="re"),data=subsf,gamma=1.4,method="ML") plot(fit29,residua

Re: [R] Speeding reading of large file

2012-11-28 Thread David L Carlson
Once you've read the data with readLines() head(raw) gets you the first 6 lines or head(nchar(raw)) the lengths of those lines Once you know which row has the headers (here it is 2), just use names(dta) <- read.table(text=raw[2], stringsAsFactors=FALSE) to add column names to the data frame. -

Re: [R] Installing R under Redhat el6

2012-11-28 Thread Marc Schwartz
On Nov 28, 2012, at 12:05 PM, Tony Paredes wrote: > Hi, > > I'm having a very difficult time installing R under redhat el6 (64 bit), > and I wanted to ask if there are any lesson learned that someone will like > to share with me about the process of installing R under redhat. > > thank you ver

Re: [R] Error message R2Jags

2012-11-28 Thread ilai
On Wed, Nov 28, 2012 at 11:37 AM, alexB wrote: The error was generated by jags not R or R2Jags (wrong list). Regardless, your problem is the prior loop is only 1:6 > > > for (i in 1:6) { b[i] ~ dnorm(0.0, 0.01) > # b[i] ~ dunif(-20, +20) > So the error is literally b[

Re: [R] Speeding reading of large file

2012-11-28 Thread Fisher Dennis
An interesting approach -- I lose the column names (which I need) but I could get them with something cute such as: 1. read the first few lines only with readLines(FILENAME, n=10) 2. use your approach to read.table -- this will grab the column names 3. replace the header

Re: [R] Plot 3d density

2012-11-28 Thread David L Carlson
Is this what you are trying to do? x <- rnorm(25) y <- rnorm(25) xd <- density(x, n=25, from=-3.5, to=3.5) yd <- density(x, n=25, from=-3.5, to=3.5) z <- outer(xd$y, yd$y) persp(xd$x, yd$x, z) The density function gives x values at which the density is estimated, so that gives you the axes for t

Re: [R] Stuck trying to modify a function

2012-11-28 Thread Benjamin Ward (ENV)
Jean, Thank you for your suggestion it has really helped a lot. I ended up changing the expression system in my model, since I realised that if the "genome" has extensive duplication, i.e. same values, which my organism of interest is know to evolve, then because of the ux <- unique(c(x, y))par

Re: [R] Problems with nls

2012-11-28 Thread Prof J C Nash (U30A)
The problem is badly scaled -- parameters from very small to very big. nlmrt package manages a bit better, but scaling would likely make it and nls both happier. nlxb insists on having its data in a data frame. Here's my code rm(list=ls()) Laptop_sale <- c(1405, 1863,2027,2669,2938,5275,6595,

Re: [R] Speeding reading of large file

2012-11-28 Thread David L Carlson
Using your first approach, this should be faster raw <- readLines(con=filename) dta <- read.table(text=raw[!grepl("[A:DF:Z]" ,raw)], header=FALSE) -- David L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77843-435

Re: [R] data frame: adding columns from data and file title

2012-11-28 Thread jim holtman
Here is how to get the information from the file name that you want: > # let's assume you have the filename > fileName <- "G7_pig328_unit328_Site141_30MAR2012_RNo4_SitNo1.csv" > # parse it for the group and bird names > group <- sub("^G([0-9]+).*", "\\1", fileName) > bird <- sub(".*pig([0-9]+).*",

[R] Conditional model in R

2012-11-28 Thread Kirsten Martin
Hello all, I have a data set where the response variable is the percent cover of a specific plant (represented in cover classes 0,1,2,3,4,5, or 6). This data set has a lot of zeros (plots where the plant was not present). I am trying to model cover class of the plant as a function of both total

[R] Stripchart colors don't vary after I sort a data frame

2012-11-28 Thread Thomas Levine
# Hi, # This plot has two colors. overflow <- read.csv('http://chainsaw.thomaslevine.com/overflow.csv', stringsAsFactors = F) png('original.png') stripchart(overflow$precipi ~ overflow$after.9.am, method='stack', pch = 22, bg = overflow$overflow + 1, vertical = T, col = 0) dev.off() # I wan

[R] Installing R under Redhat el6

2012-11-28 Thread Tony Paredes
Hi, I'm having a very difficult time installing R under redhat el6 (64 bit), and I wanted to ask if there are any lesson learned that someone will like to share with me about the process of installing R under redhat. thank you very much and have a wonderful afternoon/evening/morning. Tony

[R] Plot 3d density

2012-11-28 Thread Maximilian Lklweryc
I want to create a 3d plot with densities. I use the function density to first create a 2d dimensional plot for specific x values, the function then creates the density and puts them into a y variable. Now I have a second set of x values and put it again into the density function and I get a secon

Re: [R] Accessing List within a List in a for Loop

2012-11-28 Thread m.dr
Thanks Gerritt. That really helped. I needed the second subscript. And yes I will make my posts simpler next time. -- View this message in context: http://r.789695.n4.nabble.com/Accessing-List-within-a-List-in-a-for-Loop-tp4651086p4651170.html Sent from the R help mailing list archive at Nab

Re: [R] R strange behaviour when building huge concatenation

2012-11-28 Thread Jagat.K.Sheth
The buffer limit is an X11/xterm issue, not an R problem. Regarding your main motivation to read data from a db, several options exist for communication between R and relational database management systems - RODBC, RJDBC, RMySQL, ROracle, RPostgreSQL, RSQLite, RMonetDB, ... In the R Data Import

Re: [R] write out list of lists with names

2012-11-28 Thread Jagat.K.Sheth
Here is one way using capture.output and regular expressions > cc <- capture.output(ll) ## ll is your list object > kk <- cc[cc!= ""] ## remove blank lines > kk <- gsub("\\$", "", kk) ## remove '$' from names > writeLines(kk) MU10 MU.16 MU.19 MU.21 meansd 0.8052791 0.4350

[R] Can R be embedded in html?

2012-11-28 Thread chawla
Hi I have previously used PHP script in HTML to connect website with the database and do analysis. Is it also possible to execute R scripts within HTML files? Basically I want to create an application where user can input data such as gene list and their expression values, which can be processe

[R] Error message R2Jags

2012-11-28 Thread alexB
Hi, I'm trying to generate a GLMM for Y following a negative binomial distribution. The first step I'm taking as a beginner in the use of R2Jags is to generate a GLM for Y following a Poisson distribution (I heard it's good in order to get used to the coding language), so here I am and here I fac

[R] How to impute MNAR by using ML

2012-11-28 Thread Kamontip Srihaset
Dear all, I generate complete data under Item Response Theory model (3-PL model). Then, I treat missing data depent on motivation variable; # generate response data (3PL model) p<-matrix(nrow=n,ncol=I) y<-matrix(nrow=n,ncol=I) for (i in 1:n) { for (j in 1:I) { p[i,j]<-c[j]+(1-c[j])/(1+exp(-

Re: [R] Order function

2012-11-28 Thread maths123
I have one text file with all the data on there. So 20 rows of data. And 3 columns: numbers 1-20, size, time. I need to create a variable called 'order' as I need to use it for something in the next part. I am very confused as to how to do this. -- View this message in context: http://r

Re: [R] data frame: adding columns from data and file title

2012-11-28 Thread arun
Hi, TRy this: dat1 <- read.table(text=" Date_ Time_ Speed  Course  Type_  Distance 30/03/2012  11:15:05  108  121  -2 0 30/03/2012  11:15:06    0  79  0 0 30/03/2012  11:15:07    0  76  0 1 30/03/2012  11:15:08    0  86  0 2 30/03/2012  11:15:09    0  77  0 3 ", header = TRUE, stringsAsFactors = FA

Re: [R] Predict function in Raster package

2012-11-28 Thread megmurr
Thank you. Yes I have raised this question with the authors. -- View this message in context: http://r.789695.n4.nabble.com/Predict-function-in-Raster-package-tp4651027p4651143.html Sent from the R help mailing list archive at Nabble.com. __ R-help@

[R] how to keep all zeros in 1st row (not NA)

2012-11-28 Thread iembry
Hi, let me correct my previous post ("zeros in double matrix rather than character matrix"). I have included entries from the .csv file that has 4 columns of 1000 columns and 101 rows. The first column with the "Time (day)" will not be removed, but the row headers are the numbers 1 to 1000 and the

Re: [R] write out list of lists with names

2012-11-28 Thread arun
Hi, Try this: #x- data  invisible(sapply(names(x),function(y) {cat(y,"\n");print(x[[y]]);cat("xxx","\n")})) MU10     MU.16 MU.19 MU.21  mean    sd 0.8052791 0.4350489 0.4551954 0.5651744 0.2081806 xx

Re: [R] in par(mfrow=c(1, 2)), how to keep one half plot static and the other half changing

2012-11-28 Thread Greg Snow
Duncan showed the way to do it in 1 plotting device, but it may be easier to just open 2 graphics devices, arrange them side by side, then set up the code to let you select in one, then switch to the other to do the plotting. See ?dev.new and ?dev.set. On Tue, Nov 27, 2012 at 8:46 AM, Baoqiang C

Re: [R] Problems with weight

2012-11-28 Thread Milan Bouchet-Valat
Le mercredi 28 novembre 2012 à 14:20 -0300, Pablo Menese a écrit : > Dear Milan... are you serious? > Did you read this? No, I had not read this message when I wrote the mail because you sent two completely different messages in two different threads at about the same time. As you can see, I was r

Re: [R] Speeding reading of large file

2012-11-28 Thread Rui Barradas
Hello, Try to convert back to numeric with TEMP[] <- lapply(TEMP, as.numeric) In a small df (1e6 rows, 2 cols) it's 3 times faster than the for loop. Hope this helps, Rui Barradas Em 28-11-2012 17:42, Fisher Dennis escreveu: R 2.15.1 OS X and Windows Colleagues, I have a file that looks t

Re: [R] problem with svyglm

2012-11-28 Thread Pablo Menese
I achive something diferent, I replicated the t value, the std. error and the hypothesis test but differents betas. But, you are right, the thing is, I detach the dataset, but even with it, I couldn't. I going to describe all because perhaps I omitted something important. I have this vector for th

[R] Speeding reading of large file

2012-11-28 Thread Fisher Dennis
R 2.15.1 OS X and Windows Colleagues, I have a file that looks that this: TABLE NO. 1 PTIDTIMEAMT FORMPERIOD IPRED CWRES EVIDCP PREDRES WRES 2.0010E+03 3.9375E-01 5.E+03 2.E+00 0.E+00 0.E+0

Re: [R] Problems with weight

2012-11-28 Thread Pablo Menese
Dear Milan... are you serious? Did you read this? I have this problem. test <- svydesign(id=~1,weights=~peso) logit <- svyglm(bach ~ job2 + mujer + egp4 + programa + delay + mdeo + str + evprivate, family=binomial,design=test) then appear: Error in svyglm.survey.design(bach ~ job2 + mujer + eg

Re: [R] wrong data interpretation in R

2012-11-28 Thread Greg Snow
How to change a factor to numeric is FAQ 7.10 Also look at the `colClasses` argument to read.table/read.csv for a way to specify the type of the column when you are reading it in. On Mon, Nov 26, 2012 at 8:59 AM, EcoFranc wrote: > Hi, > > maybe somebody would be kind enough to help a bloody an

Re: [R] remove NA or 0 values

2012-11-28 Thread Rui Barradas
Hello, You should keep this in the list, the odds of getting more and better answers are bigger. As for your dataset, it doesn't have the same structure as your previous example. If you want a list with all zeros and NAs removed you can try (assuming it's named 'dat') lapply(dat, function(x)

Re: [R] reclassification function

2012-11-28 Thread David Winsemius
On Nov 26, 2012, at 9:25 AM, Joele wrote: Hi everyone, I have tried to produce a table with reclassification (continuous NRI, p value) using the reclassification() function in the PredictABEL package. My problem is that I can only get the results printed on the screen, rather than stor

Re: [R] write out list of lists with names

2012-11-28 Thread jim holtman
try this: > x <- structure(list(MU10 = structure(c(0.80527905920989, 0.4350488707836, + 0.455195366623, 0.565174432205497, 0.208180556861924), .Names = c("MU.16", + "MU.19", "MU.21", "mean", "sd")), MU11 = structure(c(0.56061565798878, + 0.65200918021661, 0.606312419102695, 0.0646249793238221), .N

Re: [R] zeros in double matrix rather than character matrix

2012-11-28 Thread Irucka Embry
Hi Jean, the code changes that you provided below give me the double matrix that I was seeking. Thank-you again! Irucka <-Original Message-> >From: Jean V Adams [jvad...@usgs.gov] >Sent: 11/28/2012 9:47:46 AM >To: iruc...@mail2world.com >Cc: r-help@r-project.org >Subject: Re: [R] zero

Re: [R] zeros in double matrix rather than character matrix

2012-11-28 Thread Irucka Embry
Hi David, thank-you very much for the suggestion! The separator is a ";" rather than a ",". Thanks again. Irucka <-Original Message-> >From: David L Carlson [dcarl...@tamu.edu] >Sent: 11/28/2012 9:56:49 AM >To: iruc...@mail2world.com;jvad...@usgs.gov >Cc: r-help@r-project.org >Subject

Re: [R] zeros in double matrix rather than character matrix

2012-11-28 Thread Irucka Embry
Hi Arun, thank-you! That small change in the code worked perfectly. Irucka <-Original Message-> >From: arun [smartpink...@yahoo.com] >Sent: 11/28/2012 8:36:37 AM >To: iruc...@mail2world.com >Cc: r-help@r-project.org >Subject: Re: [R] zeros in double matrix rather than character matrix >

Re: [R] zeros in double matrix rather than character matrix

2012-11-28 Thread Jean V Adams
Irucka, It looks like your file, Input_Parameter.csv, is not delimited with commas, ",", but with semicolons, ";". What results do you get from submitting these commands? myfile <- "/home/ie/Documents/TTU/GA_Research/GLUE/R-Project/R_GLUE_Example/Input_Parameter.csv" count.fields(myfile, sep=

[R] write out list of lists with names

2012-11-28 Thread Iain Gallagher
Hello List I have a list question. I'm doing some data wrangling for a colleague and I have nested list in the following format: structure(list(MU10 = structure(c(0.80527905920989, 0.4350488707836, 0.455195366623, 0.565174432205497, 0.208180556861924), .Names = c("MU.16", "MU.19", "MU.21", "

Re: [R] Fitting and plotting a coxph with survfit, package(surv)

2012-11-28 Thread Terry Therneau
I answered a similar question yesterday: "The survfit routine will produce predicted survival curves for any requested combination of the covariates in the original model. This is not the same thing as an "adjusted" survival curve. Confusion on this is prevalent, however. True adjustment requ

Re: [R] Using factor variables with overlapping categories

2012-11-28 Thread Jean V Adams
Andrew, Interesting issue. My tack would be to define an age key that incorporates all of the different cut-points that are used in your data tables. Then, with the use of some simple functions, you can test which factors are "nested" within other factors, and you can broaden those categorie

Re: [R] Conjoint Analysis in R??

2012-11-28 Thread Bert Gunter
It took me 11.43 seconds to type a google search on "R package conjoint analysis" to find the package "conjoint." ??? -- Bert On Wed, Nov 28, 2012 at 6:26 AM, Ben Bolker wrote: > Colin Birth gmail.com> writes: > >> >> Hi all, >> >> are there any packages to perform a market simulation with t

Re: [R] Conjoint Analysis in R??

2012-11-28 Thread Ben Bolker
Colin Birth gmail.com> writes: > > Hi all, > > are there any packages to perform a market simulation with the conjoint > analysis' results? > I don't know, but have you looked through the results of library("sos") findFn("{conjoint analysis}") ? __

Re: [R] Order function

2012-11-28 Thread John Kane
Are you asking how to create a variable in each data set so that data set 1 has the idenfier 1 and so on? It's not clear from what you say if you have 20 different data sets (say data frame or file for each ) or if you have one file with the data. As a brute force approach in either case I'd

Re: [R] zeros in double matrix rather than character matrix

2012-11-28 Thread Irucka Embry
Hi Jean, I am responding to the last part of your response now. Thank-you. Irucka Embry m[1:6, ] where m is Input Input <- as.matrix(read.csv("/home/ie/Documents/TTU/GA_Research/GLUE/R-Project/R_ GLUE_Example/Input_Parameter.csv", header = TRUE, sep =",")) > Input[1:6, ] [1] "0;0;0;0;0;0;0;0;0

Re: [R] R strange behaviour when building huge concatenation

2012-11-28 Thread John Kane
> -Original Message- > From: angelo...@gmail.com > Sent: Wed, 28 Nov 2012 00:12:27 -0800 (PST) > To: r-help@r-project.org > Subject: Re: [R] R strange behaviour when building huge concatenation > > Hello John > Thank you for the tips > I already tried by using RKWard and RStudio and I g

Re: [R] zeros in double matrix rather than character matrix

2012-11-28 Thread Irucka Embry
Hi Jean, how are you? Thank-you for the response. I have just created a new post that includes more information about my problem ["how to keep all zeros in 1st row (not NA)"] and I will also show the current code and the results below. I will respond back to the other question in another e-mail

Re: [R] Fitting and plotting a coxph with survfit, package(surv)

2012-11-28 Thread Andrews, Chris
Your model is additive so the effect of rx is the same at every age. There is not one survival curve for all ages (unless the beta for age is 0). The curves will shift up and down as you vary age, but they will retain the same relation. A common approach is to use the sample mean of age. Alt

Re: [R] zeros in double matrix rather than character matrix

2012-11-28 Thread Jean V Adams
Irucka, What is the code that you are using that results in a character matrix? What does the character matrix look like? If your matrix is called m, submit the following code and share the results with us. m[1:6, ] as.numeric(m[1:6, ]) Jean iembry wrote on 11/27/2012 11:35:15 PM: > > Hi,

Re: [R] choose folder interactively

2012-11-28 Thread jim holtman
A simple way is to use 'choose.file' to select a file in the directory that you want and then use 'dirname' to strip off the file name: > dirname('a/b/c') [1] "a/b" On Wed, Nov 28, 2012 at 7:59 AM, Ivan Calandra wrote: > Thank you Duncan for your answer > > I would like to be able to write an

Re: [R] output data by date?

2012-11-28 Thread jim holtman
Your date "string" is sorted in alphabetic order. You need to convert to a Date class and then sort as this example shows: > x <- c('10.5.2011', '11.21.2011', '4.5.2011', '5.17.2011', '6.27.2011', > '8.16.2011') > # convert to Date > xD <- as.Date(x, format = "%m.%d.%Y") > # notice difference in

[R] Plot with residuals in mgcv

2012-11-28 Thread silje skår
Hi, I am using the mgcv package (version 1.7-22.) running the model works fine, but when I want to have a plot with residuals I get an error. fit29<-gam(IV~s(G3)+s(V3)+factor(AAR)+s(D3)+s(RUTE,bs="re"),data=subsf,gamma=1.4,method="ML") plot(fit29,residuals=T) Error in X[, first:last] %*% object

Re: [R] choose folder interactively

2012-11-28 Thread Ivan Calandra
Thank you Duncan for your answer I would like to be able to write an equivalent for MacOS, but I'm not that skilled... I don't know how to find how choose.dir() is written. And then, I'm even less sure to be able to find the equivalent... Would you mind giving my some hints? Thank you in adv

Re: [R] choose folder interactively

2012-11-28 Thread Duncan Murdoch
On 12-11-28 7:39 AM, Ivan Calandra wrote: Dear users, I am looking for a function to choose a folder interactively, just like file.choose() but for a folder. I have found tcltk::tk_choose.dir() but R hangs when I try to do anything and I have to force exit. I've tried to reinstall tcltk with in

[R] choose folder interactively

2012-11-28 Thread Ivan Calandra
Dear users, I am looking for a function to choose a folder interactively, just like file.choose() but for a folder. I have found tcltk::tk_choose.dir() but R hangs when I try to do anything and I have to force exit. I've tried to reinstall tcltk with install.packages(), but "package ‘tcltk’

Re: [R] output data by date?

2012-11-28 Thread John Kane
I think we need a bit more detall of the code that you are using and the structure of the data set. Would you please supply some sample data (see ?dput for a convenient way to supply data to the R-help list. Also the output of str() would be useful. A good guideline for asking a question in

Re: [R] Introduction text in R help files

2012-11-28 Thread Duncan Murdoch
On 12-11-28 6:52 AM, Ulrich Staudinger wrote: Hi everyone, is there a way to include introduction text in the PDF that documents all methods? I want to avoid to write a proper vignette, but would much rather like to include some introduction text in my reference PDF. Text like that could be

  1   2   >