Re: [R] extract worksheet names from an Excel file

2011-06-23 Thread Shi, Tao
Thank you, David and Bill!  I'll try that. ...Tao - Original Message - > From: David Scott > To: bill.venab...@csiro.au > Cc: shida...@yahoo.com; r-help@r-project.org > Sent: Thursday, June 23, 2011 10:11 PM > Subject: Re: [R] extract worksheet names from an Excel file > >   On 24/06/

[R] replacing empty cells, and Date question

2011-06-23 Thread Keun-Hyung Choi
Hello, I have a data set like one below. First, I'd like to replace the empty cells with NA, and then the one immediately above. I could replace NAs with the immediate one, but don't know for the empty cells. index <- which(is.na(data1$year)) while (any(index)) { dummy$data1[index] <

Re: [R] extract worksheet names from an Excel file

2011-06-23 Thread David Scott
On 24/06/11 16:55, bill.venab...@csiro.au wrote: Package XLConnect appears to provide this kind of thing. -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Shi, Tao Sent: Friday, 24 June 2011 2:42 PM To: r-help@r-project.org Subjec

Re: [R] Converting an ftable (contingency table) to a dataframe in R

2011-06-23 Thread Richard M. Heiberger
Use as.data.frame() See ?ftable for details. ftable(Titanic, row.vars = 1:3) as.data.frame(.Last.value) Rich On Thu, Jun 23, 2011 at 10:58 PM, Mark Alen wrote: > I am generating an ftable (by running ftable on the results of a xtabs > command) and I am getting the following. >

Re: [R] extract worksheet names from an Excel file

2011-06-23 Thread Bill.Venables
Package XLConnect appears to provide this kind of thing. -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Shi, Tao Sent: Friday, 24 June 2011 2:42 PM To: r-help@r-project.org Subject: [R] extract worksheet names from an Excel file

[R] extract worksheet names from an Excel file

2011-06-23 Thread Shi, Tao
Hi list, Is there a R function I can use to extract the worksheet names from an Excel file?  If no, any other automatic ways (not using R) to do this? thanks! ...Tao __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help P

[R] Converting an ftable (contingency table) to a dataframe in R

2011-06-23 Thread Mark Alen
I am generating an ftable (by running ftable on the results of a xtabs command) and I am getting the following.                                                                    Var1  Var2 date                 group                                                2007-01-01          q1          

Re: [R] help- subtitles for multiple charts

2011-06-23 Thread David Winsemius
On Jun 23, 2011, at 10:40 PM, David Winsemius wrote: On Jun 23, 2011, at 4:41 PM, jalen wrote: http://r.789695.n4.nabble.com/file/n3620982/mbeFORUM.csv mbeFORUM.csv I uploaded my data and one more time the script (*adjusted version*): To get the "Block and Trt text as in the original reque

Re: [R] help- subtitles for multiple charts

2011-06-23 Thread David Winsemius
On Jun 23, 2011, at 4:41 PM, jalen wrote: http://r.789695.n4.nabble.com/file/n3620982/mbeFORUM.csv mbeFORUM.csv I uploaded my data and one more time the script (*adjusted version*): Try: pMBE<- MBE[MBE$left!=0,] pMBE$bt<- interaction(pMBE$Block,pMBE$trt) par(mfrow=c(3,3), oma=c(2,0,2,0)) f

Re: [R] 'Rscript -e' and stdout() puzzle

2011-06-23 Thread Benjamin Tyner
Thanks Bill! Next time, I'll try literacy. William Dunlap wrote: -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Benjamin Tyner Sent: Thursday, June 23, 2011 5:31 PM To: r-help@r-project.org Subject: [R] 'Rscript -e' and stdout()

Re: [R] trying to import xls or xlsx files

2011-06-23 Thread David Winsemius
On Jun 23, 2011, at 2:00 PM, wwreith wrote: library(xlsReadWrite) mydata<-read.xls("file path", header=TRUE) however if I change xls to csv it works just fine. Any ideas what I'm doing wrong? I have have also using the package gdata with the exact same error. Below is the error that pops

Re: [R] 'Rscript -e' and stdout() puzzle

2011-06-23 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Benjamin Tyner > Sent: Thursday, June 23, 2011 5:31 PM > To: r-help@r-project.org > Subject: [R] 'Rscript -e' and stdout() puzzle > > Hello, > > I am curious to know why the out

Re: [R] reading the results of a within subject test

2011-06-23 Thread Stephen Ellison
>From: r-help-boun...@r-project.org [r-help-boun...@r-project.org] On Behalf Of >Ann [trivialesc...@gmail.com] >Subject: [R] reading the results of a within subject test > >Hi, I ran the following in R (on item means): > > aov(VAR ~(a*b)+Error(item/(a*b)), data = item) > > > I'm confused...

[R] 'Rscript -e' and stdout() puzzle

2011-06-23 Thread Benjamin Tyner
Hello, I am curious to know why the output of Rscript -e "cat(R.version.string,stdout())" includes a trailing " 1", whereas Rscript -e "cat(R.version.string)" does not. I have tried various mechanisms to subvert this behavior, such as Rscript -e "invisible(con<-stdout()); cat(R.vers

Re: [R] Generate the next column from previous column

2011-06-23 Thread Steven Wolf
Basically you need to set up a recursive relationship. I'd do this with a 2D array: G = numeric(6*N) dim(G) = c(6,N) G[,1] = c(1,rep(0,5)) for (i in 2:N){G[,i]=G[,i-1]+5* c(1,rep(0,5))} HTH, -Steve -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.or

Re: [R] trying to import xls or xlsx files

2011-06-23 Thread Abhijit Dasgupta
Gabor's answer explains the error perfectly. You might want to look at the xlsx package as well as the RODBC package if you're on Windows. RODBC is really fast, if you can use it. Abhijit On Jun 23, 2011, at 2:00 PM, wwreith wrote: > library(xlsReadWrite) > mydata<-read.xls("file path", head

Re: [R] new to R need urgent help!

2011-06-23 Thread Abhijit Dasgupta
On Jun 23, 2011, at 4:42 PM, elisheva corn wrote: > hi all- > > I am doing some research, have never used R before until today and need to > understand the following program for a project. > if some one could PLEASE help me understand this program ASAP i would > GREATLY appreciate it (any syntax

Re: [R] change plot area in barplot2

2011-06-23 Thread Marc Schwartz
On Jun 23, 2011, at 4:11 PM, Adrienne Keller wrote: > I would like to change the plot area for a figure I made with barplot2 so > that it is rectangular (for example, 5 x 3 inches) rather than square, which > is the default. What is the best way to do this? > > Thanks, > > Adrienne Hi, The s

Re: [R] packages which call functions which run C code...

2011-06-23 Thread Peter Ehlers
On 2011-06-23 16:46, Steven Wolf wrote: I am looking at the function ks.test in the stats package and trying to figure out why it gives a different result for a p-value than does the corresponding function in MATLAB. I am hoping for one of two responses: 1. You know about ks.tests and h

Re: [R] packages which call functions which run C code...

2011-06-23 Thread Peter Langfelder
On Thu, Jun 23, 2011 at 4:46 PM, Steven Wolf wrote: > I am looking at the function ks.test in the stats package and trying to > figure out why it gives a different result for a p-value than does the > corresponding function in MATLAB.  I am hoping for one of two responses: > > > > 1.       You kno

Re: [R] trying to import xls or xlsx files

2011-06-23 Thread Gabor Grothendieck
On Thu, Jun 23, 2011 at 2:00 PM, wwreith wrote: > library(xlsReadWrite) > mydata<-read.xls("file path", header=TRUE) > > however if I change xls to csv it works just fine. Any ideas what I'm doing > wrong? I have have also using the package gdata with the exact same error. > > Below is the error t

[R] new to R need urgent help!

2011-06-23 Thread elisheva corn
hi all- I am doing some research, have never used R before until today and need to understand the following program for a project. if some one could PLEASE help me understand this program ASAP i would GREATLY appreciate it (any syntax/ statistic comments would be great) PLEASE PLEASE HELP!! THAN

Re: [R] question about Software for Data analysis book

2011-06-23 Thread Fritz Scholz
the answer to the missing mars data can be found on pages 176/177 of the referenced book. -- View this message in context: http://r.789695.n4.nabble.com/question-about-Software-for-Data-analysis-book-tp1043713p3621277.html Sent from the R help mailing list archive at Nabble.com. ___

Re: [R] Estimating choice models at the individual level

2011-06-23 Thread Chris Chapman
The "bayesm" package does HB models for discrete choice. In practice, a hurdle is likely to be translating your data (if it's fielded in Sawtooth Software) to the correct format for bayesm (which uses a list format instead of a matrix, and difference coding instead of dummy coding). (BTW, note

Re: [R] help- subtitles for multiple charts

2011-06-23 Thread jalen
http://r.789695.n4.nabble.com/file/n3620982/mbeFORUM.csv mbeFORUM.csv I uploaded my data and one more time the script (*adjusted version*): pMBE<- MBE[MBE$left!=0,] pMBE$bt<- interaction(pMBE$Block,pMBE$trt) par(mfrow=c(3,3), oma=c(2,0,2,0)) for(i in unique(pMBE$bt)){ ss <- pMBE$bt==i plot(pMBE$

[R] maximizing the LDV model

2011-06-23 Thread Edward Bowora
Hi Please find attached document to see my problem that I wish you would assist me to solve. I want to maximise the LDV model to get alpha estimates. I am looking forward to hearing from you soon. Edward Actuarial Science student __ R-help@r-project.o

[R] change plot area in barplot2

2011-06-23 Thread Adrienne Keller
I would like to change the plot area for a figure I made with barplot2 so that it is rectangular (for example, 5 x 3 inches) rather than square, which is the default. What is the best way to do this? Thanks, Adrienne __ R-help@r-project.org mailin

[R] trying to import xls or xlsx files

2011-06-23 Thread wwreith
library(xlsReadWrite) mydata<-read.xls("file path", header=TRUE) however if I change xls to csv it works just fine. Any ideas what I'm doing wrong? I have have also using the package gdata with the exact same error. Below is the error that pops up. Error in findPerl(verbose = verbose) : perl

[R] Generate the next column from previous column

2011-06-23 Thread Mkkl
Hi, I'm quite new to R and are stuck with the following problem. Lets say I have a column consisting of a 1 and the rest zero's, called G0. G0 <- c(1,rep(0,5)) Now what I would like to do is to generate G1 from G0, and G2 from G1 etc... Just for the simplicity, let's say I need the first entry of

[R] packages which call functions which run C code...

2011-06-23 Thread Steven Wolf
I am looking at the function ks.test in the stats package and trying to figure out why it gives a different result for a p-value than does the corresponding function in MATLAB. I am hoping for one of two responses: 1. You know about ks.tests and have a familiarity with both the R and MAT

Re: [R] Time-series analysis with treatment effects - statistical approach

2011-06-23 Thread J.Morgenroth
Mike Marchywka wrote: > >> I discovered a way to do repetitive tasks that can be concisely specified >> using >> something called a computer. Now that's funny :) There were not controlled tests. It was a field experiment testing the effects that various pavement designs have on underlying soi

[R] gcc-4.5.2 and install.packages("glmnet")?

2011-06-23 Thread Juergen Rose
Hi, is there any chance to install glmnet with gcc-4.5.2? For me it fails on all systems with: trying URL 'http://mirrors.softliste.de/cran/src/contrib/glmnet_1.7.tar.gz' Content type 'application/x-gzip' length 522888 bytes (510 Kb) opened URL == d

[R] Using 'foreach' for parallel computing

2011-06-23 Thread Stacey Wood
Hi all, I'm currently working on updating an R package to run for loops in parallel to speed up computation time. I'm using the 'foreach' package with a foreach loop. When I run my code inside the loop, I get an error message that a number of the functions aren't recognized (even though the func

[R] reading the results of a within subject test

2011-06-23 Thread Ann
Hi, I ran the following in R (on item means): aov(VAR ~(a*b)+Error(item/(a*b)), data = item) I got this result: Error: item Df Sum SqMean Sq F value Pr(>F) a 1 7.7249e+13 7.7249e+13 11.329 0.003934 ** Residuals 16 1.0910e+14 6.8187e+12 --- Signif

Re: [R] Rms package - problems with fit.mult.impute

2011-06-23 Thread Frank Harrell
There is a problem passing x in the ... arguments to fit.mult.impute when the function has a formal argument starting with "x" (xtrans). To get around this specify xtrans=a to fit.mult.impute instead of just listing a. Frank Lina Hellström wrote: > > Hi! > Does anyone know how to do the test fo

[R] Loops, Paste, Apply? What is the best way to set up a list of many equations?

2011-06-23 Thread Rita Carreira
Is there a way to apply paste to list(form1 = EQ1, form2 = EQ2, form3 = EQ3, form4 = EQ4) such that I don't have to write form1=EQ1 for all my models (I might have a list of 20 or more)? I also need the EQs to read the formulas associated with them. For example, below, I was able to automate

Re: [R] Ranking submodels by AIC (more general question)

2011-06-23 Thread Alexandra Thorn
Thanks for the suggestion. Those functions only provide part of the functionality I want. After a great deal more of drawing the internet, I've concluded that the correct answer to my question is dredge() from the package MuMIn. It seems to use the same AIC algorithm as AIC, which is perfect f

Re: [R] Help using cutreeHybrid

2011-06-23 Thread Peter Langfelder
On Thu, Jun 23, 2011 at 11:19 AM, Estefania Ruiz Vargas wrote: > I am using the function cutreeHybrid from the package dynamic Tree Cut and I > need a list of the resulting clusters but I do not know how to get it. Hi, I'm the author of the package. The function returns a list whose component '

Re: [R] Ranking submodels by AIC (more general question)

2011-06-23 Thread Jan van der Laan
Alexandra, Have a look at add1 and drop1. Regards, Jan On 06/23/2011 07:32 PM, Alexandra Thorn wrote: Here's a more general question following up on the specific question I asked earlier: Can anybody recommend an R command other than mle.aic() (from the wle package) that will give back a ran

[R] concordance

2011-06-23 Thread Assieh Rashidi
Is there any package for computing concordance coefficient of incomplete ranking? If there is not, please help me to write it.   [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-

Re: [R] two panel figure using barplot2

2011-06-23 Thread Marc Schwartz
On Jun 23, 2011, at 1:19 PM, Adrienne Keller wrote: > I am trying to make a two panel figure using barplot2 in gplots. When I use > par(mfrow=c(1,2)), two panels are created but both barplots are overlaid on > top of one another in the first panel and the second panel is left blank. Am > I run

Re: [R] subset

2011-06-23 Thread David Winsemius
On Jun 23, 2011, at 1:47 PM, yf wrote: Dear all, How can I do the subset fucntion from the table? What table? I want to do the subset for the less than 50. I tried b8a<-subset(b8, (table(g$book)<50)==TRUE) but it didn't work. And you neither shown us what these structures are nor posted

Re: [R] help- subtitles for multiple charts

2011-06-23 Thread David Winsemius
On Jun 23, 2011, at 1:00 PM, jalen wrote: Hello, I have a problem with my script. I don'y know how to apply subtitles. I have 9 charts per page (for combination of 3 blocks and 3 treatments). I want to have subtitles for this interaction (e.g. Block A Trt 1, Block A Trt 2, ...) MBE$bt<-

[R] Merging multiple data sets

2011-06-23 Thread cddesjar
Hi, I am trying to merge data similar to the example data below > dat0 idvar1var2var3 2 1 0 1 3 1 0 1 4 0 1 1 5 0 1 1 > dat1 idvar4var5var6 2 1 0 1 3 1

Re: [R] caret's Kappa for categorical resampling

2011-06-23 Thread Harlan Harris
Yes, that's true. On a test set, the highest probability of being in the smaller class is about 40%. (Incidentally, accuracy on the test set is much higher when I use the best-according-to-Kappa model instead of the best-according-to-Accuracy model.) It looks like the ctree() method supports weigh

[R] help- subtitles for multiple charts

2011-06-23 Thread jalen
Hello, I have a problem with my script. I don'y know how to apply subtitles. I have 9 charts per page (for combination of 3 blocks and 3 treatments). I want to have subtitles for this interaction (e.g. Block A Trt 1, Block A Trt 2, ...) MBE$bt<- interaction(MBE$Block,MBE$trt) par(mfrow=c(3,3)) for

[R] subset

2011-06-23 Thread yf
Dear all, How can I do the subset fucntion from the table? I want to do the subset for the less than 50. I tried b8a<-subset(b8, (table(g$book)<50)==TRUE) but it didn't work. Thanks. table(g$ book ) 119 121 134 160 161 170 175 179 190 193 225 226 256 260 130 89 50 8774 23 8547

[R] Help using cutreeHybrid

2011-06-23 Thread Estefania Ruiz Vargas
I am using the function cutreeHybrid from the package dynamic Tree Cut and I need a list of the resulting clusters but I do not know how to get it. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/m

[R] two panel figure using barplot2

2011-06-23 Thread Adrienne Keller
I am trying to make a two panel figure using barplot2 in gplots. When I use par(mfrow=c(1,2)), two panels are created but both barplots are overlaid on top of one another in the first panel and the second panel is left blank. Am I running into problems because I of some complexities of gpl

[R] Ranking submodels by AIC (more general question)

2011-06-23 Thread Alexandra Thorn
Here's a more general question following up on the specific question I asked earlier: Can anybody recommend an R command other than mle.aic() (from the wle package) that will give back a ranked list of submodels? It seems like a pretty basic piece of functionality, but the closest I've been able

Re: [R] Merging multiple data sets

2011-06-23 Thread Dennis Murphy
Hi: Try this: merge(merge(dat0, dat1, by = 'id', all.x = TRUE, all.y = TRUE), dat2, by = 'id', all.x = TRUE, all.y = TRUE) Dennis On Thu, Jun 23, 2011 at 9:53 AM, cddesjar wrote: > Hi, > I am trying to merge data similar to the example data below > >> dat0 > > id    var1    var2    var3 > 2  

Re: [R] Merging multiple data sets

2011-06-23 Thread Sarah Goslee
Hi, > How can I best do this in R? I've looked into merge but it excludes ids that > aren't in all 3 data sets. You need to look a bit harder at merge(), specifically the all.x and all.y options. Sarah On Thu, Jun 23, 2011 at 12:53 PM, cddesjar wrote: > Hi, > I am trying to merge data similar t

[R] Finding the "levels" in a data frame column

2011-06-23 Thread Abraham Mathew
I have a data frame that looks as follows. df <- data.frame(city=c("Houston", "Houston", "El Paso", "Waco", Houston", "Plano", "Plano") What I want to do is get a list of the city values. Currently, when I run df$city, I get all the values. I just want to know the four cities that appear. So ins

Re: [R] Finding the "levels" in a data frame column

2011-06-23 Thread Greg Snow
Try levels(df$city) or unique(df$city) depending on if it is a factor (default) or character string. -- 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-hel

[R] Glmnet Variable Questions

2011-06-23 Thread Paul Bleicher
Hi all,  I have two questions about variables in glmnet:   1. We are doing a logistic regression with binary outcome variable using a set of predictors that include continuous and binary predictors(coded 0 and 1).  If the latter are centered and standardized, they will be transformed into negative

[R] Lattice xyplot to group by two parameters

2011-06-23 Thread Guy Jett
My thanks to this mailing list and its members for their great help in the past. I have yet another question per the following code and comments: # I need individual graphs grouped by "PARLABEL" AND "Event", with "PARLABEL" # controlling pct and lty, and "Event" controlling col (where Event==1

Re: [R] Saved EPS does not match screen when using bquote(.(i))

2011-06-23 Thread Peter Ehlers
I think that there may be a problem with the way bquote(), for() and savePlot() play together in the OP's example (multiple plots on a windows device; bquote using the loop index). Here's a version using replayPlot(): ## show mu with subscripts 4 and 9: x11() par(mfrow = c(2,1)) for (i in

Re: [R] split dataframe by sample()

2011-06-23 Thread Sarah Goslee
It's very simple to do this in steps: > # to make separate dataframes > df <- data.frame(A=1:5, B=11:15) > df.sample <- c(1,3,4) > df[df.sample, ] A B 1 1 11 3 3 13 4 4 14 > df[-df.sample, ] A B 2 2 12 5 5 15 > > # or a list with two components > split(df, 1:nrow(df) %in% df.sample) $`FALSE`

Re: [R] else problem

2011-06-23 Thread David Winsemius
On Jun 23, 2011, at 12:05 PM, Kara Przeczek wrote: Thank you for all your help! I did not know to use "" when searching for help, as ?mean, etc, had always worked for me in the past. It makes perfect sense why 'else' was causing me the trouble the way I was using it. I think it was working i

[R] split dataframe by sample()

2011-06-23 Thread Paul Tanger
Hi, I seemingly have a simple problem, but I've spend hours reading guides & posts on this forum and I can't seem to piece together what I need. I have a dataframe where I want to divide it into two subsets: a sample, and the remainder of the dataframe in a new frame. I've tried this: split(df, s

Re: [R] Confidence interval from resampling

2011-06-23 Thread Stephen Ellison
Depending on how critical the problem is, you might also want to look at the literature on bootstrap CI's, perhaps starting from the references in boot.ci in the boot package. The simple quantiles are not necessarily the most appropriate. For example I seem to recall that BCa intervals were the

Re: [R] else problem

2011-06-23 Thread Kara Przeczek
Thank you for all your help! I did not know to use "" when searching for help, as ?mean, etc, had always worked for me in the past. It makes perfect sense why 'else' was causing me the trouble the way I was using it. I think it was working in my other code, despite the same format, because it w

Re: [R] Memory(RAM) issues

2011-06-23 Thread David Winsemius
On Jun 23, 2011, at 11:57 AM, Abhisek Saha wrote: Hi Lui, Anupam and my other R-user friends, Thanks for your previous suggestions. As for my issue, it is clearly RAM problem as my code is running perfectly as long as my input data size is small and code has been refined a number of times to i

Re: [R] problem (and solution) to rle on vector with NA values

2011-06-23 Thread Cormac Long
D'oh! Completely missed that. Definately a case or RTFMS (RTFM, Stupid). My apologies for the spam. Sincerely (with additional grovelling) Cormac. On 23 June 2011 15:59, Nick Sabbe wrote: > Hello Cormac. > > Not having thoroughly checked whether your code actually works, the behavior > of rle y

Re: [R] Loading List data into R with scan()

2011-06-23 Thread Michael Pearmain
Thanks All, Henrique, gave me the solution is was looking for, the indexing was a mistake on my part. Thanks again On 23 June 2011 16:37, David Winsemius wrote: > > On Jun 23, 2011, at 11:19 AM, Uwe Ligges wrote: > > >> >> On 23.06.2011 16:39, Michael Pearmain wrote: >> >>> Hi All, >>> >>> I'v

Re: [R] Memory(RAM) issues

2011-06-23 Thread Abhisek Saha
Hi Lui, Anupam and my other R-user friends, Thanks for your previous suggestions. As for my issue, it is clearly RAM problem as my code is running perfectly as long as my input data size is small and code has been refined a number of times to increase efficiency [ by using matrix more in the conte

Re: [R] ddply to count frequency of combinations

2011-06-23 Thread Brian Diggs
On 6/22/2011 11:02 PM, Idris Raja wrote: Brian, I'm a bit confused about how the following line works, specifically, what is happening in freq=length(x)? Is it just taking the length of x after it has been summarized by different combinations x& y? I guess that must be the case, because that gi

Re: [R] Loading List data into R with scan()

2011-06-23 Thread David Winsemius
On Jun 23, 2011, at 11:19 AM, Uwe Ligges wrote: On 23.06.2011 16:39, Michael Pearmain wrote: Hi All, I've been given a data file of the form: 1: 3,4,5,6 2:1,2,3 43: 5,7,8,9,5 and i want to read this data in as a list to create the form: (guessing final look) my.list [[1]] [1] 3 4 5 6 [[2]

Re: [R] Loading List data into R with scan()

2011-06-23 Thread Henrique Dallazuanna
Try this: sapply(lapply(strsplit(l, ":"), strsplit, ","), function(x)structure(lapply(x[2], as.numeric), .Names = x[1])) On Thu, Jun 23, 2011 at 11:39 AM, Michael Pearmain wrote: > Hi All, > > I've been given a data file of the form: > 1: 3,4,5,6 > 2:1,2,3 > 43: 5,7,8,9,5 > > and i want to read

Re: [R] Loading List data into R with scan()

2011-06-23 Thread Michael Pearmain
Thanks Uwe, The list elements was a mistake on my part, i just wanted everything before the : to be the name of the element. Thanks for the help, i can play around with this to get what i want. M 2011/6/23 Uwe Ligges > > > On 23.06.2011 16:39, Michael Pearmain wrote: > >> Hi All, >> >> I've b

Re: [R] Loading List data into R with scan()

2011-06-23 Thread Henrique Dallazuanna
l <- readLines(textConnection("1: 3,4,5,6 2:1,2,3 43: 5,7,8,9,5")) On Thu, Jun 23, 2011 at 12:28 PM, Henrique Dallazuanna wrote: > Try this: > >  sapply(lapply(strsplit(l, ":"), strsplit, ","), > function(x)structure(lapply(x[2], as.numeric), .Names = x[1])) > > On Thu, Jun 23, 2011 at 11:39 AM,

Re: [R] else problem

2011-06-23 Thread Bert Gunter
Perhaps some additional clarification... (???) >> if (length(dat2f$year)%%2==0) { >>  md <-dat2f[, list(med_year = max(year[which(abs(tot_km3y - >> median(tot_km3y)) == min(abs(tot_km3y - median(tot_km3y ]), med_TotQ = >> median(tot_km3y))]  } >> else { > > If this line is executed at a conso

Re: [R] Loading List data into R with scan()

2011-06-23 Thread Uwe Ligges
On 23.06.2011 16:39, Michael Pearmain wrote: Hi All, I've been given a data file of the form: 1: 3,4,5,6 2:1,2,3 43: 5,7,8,9,5 and i want to read this data in as a list to create the form: (guessing final look) my.list [[1]] [1] 3 4 5 6 [[2]] [1] 1 2 3 [[43]] [1] 5 7 8 9 5 I can get to a s

Re: [R] plotmath: unexpected SPECIAL

2011-06-23 Thread Sarah Goslee
On Thu, Jun 23, 2011 at 6:30 AM, Uwe Ligges wrote: > Folks, > > the relevant thing you have to remember is: All the stuff must be valid R > syntax (with few additional functions as mention in the ?plotmath help > file). Knowing that it is obvious where additional "operators" are required. > > Best

Re: [R] else problem

2011-06-23 Thread David Winsemius
On Jun 23, 2011, at 10:59 AM, Kara Przeczek wrote: Dear R users, I have run into a problem using if...else and I hope you can shed some light on it. I am using R version 2.2.0.1. I have the following data frame: head(dat2f) year tot_km3y [1,] 1964 0.1876854 [2,] 1965 0.1835116 [3,] 1

[R] Loading List data into R with scan()

2011-06-23 Thread Michael Pearmain
Hi All, I've been given a data file of the form: 1: 3,4,5,6 2:1,2,3 43: 5,7,8,9,5 and i want to read this data in as a list to create the form: (guessing final look) my.list [[1]] [1] 3 4 5 6 [[2]] [1] 1 2 3 [[43]] [1] 5 7 8 9 5 I can get to a stage using scan: scan("my.data", what = character

[R] else problem

2011-06-23 Thread Kara Przeczek
Dear R users, I have run into a problem using if...else and I hope you can shed some light on it. I am using R version 2.2.0.1. I have the following data frame: > head(dat2f) year tot_km3y [1,] 1964 0.1876854 [2,] 1965 0.1835116 [3,] 1966 0.1915012 [4,] 1967 0.1869758 [5,] 1968 0.2249865 [6

Re: [R] problem (and solution) to rle on vector with NA values

2011-06-23 Thread Nick Sabbe
Hello Cormac. Not having thoroughly checked whether your code actually works, the behavior of rle you describe is the one documented (check the details of ?rle) and makes sense as the missingness could have different reasons. As such, changing this type of behavior would probably break a lot of ex

Re: [R] How to delete file -

2011-06-23 Thread Uwe Ligges
On 23.06.2011 16:50, David Winsemius wrote: On Jun 23, 2011, at 9:48 AM, Mark Finger wrote: Have you ever run into a situation where you wanted to delete a file, but Windows simply wouldn’t allow you to do it? Personally, these things happen to me all the time, especially when I’m at a clien

Re: [R] How to delete file -

2011-06-23 Thread David Winsemius
On Jun 23, 2011, at 9:48 AM, Mark Finger wrote: Have you ever run into a situation where you wanted to delete a file, but Windows simply wouldn’t allow you to do it? Personally, these things happen to me all the time, especially when I’m at a client’s house trying to get their machine clean of

Re: [R] problem (and solution) to rle on vector with NA values

2011-06-23 Thread Peter Ehlers
On 2011-06-23 06:44, Cormac Long wrote: Hello there R-help, I'm not sure if this should be posted here - so apologies if this is the case. I've found a problem while using rle and am proposing a solution to the issue. Description: I ran into a niggle with rle today when working with vectors wit

[R] Stepwise Manova

2011-06-23 Thread Schuster, Veronika
Hello all, I have a question on manova in R: I'm using the function "manova()" from the stats package. Is there anything like a stepwise (backward or forward) manova in R (like there is for regression and anova). When I enter: step(Model1, data=Mydata) R returns the message: Error in drop1.

[R] agrep: How to match with more than 1 substitution?

2011-06-23 Thread Niklaus Kuehnis
Hi all I'm trying to match a numeric code to a vector of numeric codes: a <- c(12345, 12346, 12347) agrep(12349, a, max.distance=list(substitutions=1)) # [1] 1 2 3 agrep(12399, a, max.distance=list(substitutions=2)) # integer(0) I didn't expect the latter result as substituting two characters

[R] problem (and solution) to rle on vector with NA values

2011-06-23 Thread Cormac Long
Hello there R-help, I'm not sure if this should be posted here - so apologies if this is the case. I've found a problem while using rle and am proposing a solution to the issue. Description: I ran into a niggle with rle today when working with vectors with NA values (using R 2.31.0 on Windows 7 x

[R] R-squared values for multiple linear regression with a matrix of multiple response variables

2011-06-23 Thread Manabu Sakamoto
Dear list, I have a matrix Y of multiple response variables and a matrix X of predictor variables and I would like to fit a multivariate multiple regression model and compute the R2-value to determine the overall proportion of variance of the response matrix Y that is explained by the predictor ma

Re: [R] RBloomberg data account for dividend

2011-06-23 Thread michalseneca
Solved :) Just use RBloomberg with RJava and use option_names more in http://www.carfield.com.hk/document/Finance/rbloomberg-manual-0-4-144.pdf Thanks mike you did a good job :) -- View this message in context: http://r.789695.n4.nabble.com/RBloomberg-data-account-for-dividend-tp3614213p36198

[R] How to delete file - http://CannotDeleteFile.net

2011-06-23 Thread Mark Finger
Have you ever run into a situation where you wanted to delete a file, but Windows simply wouldn’t allow you to do it? Personally, these things happen to me all the time, especially when I’m at a client’s house trying to get their machine clean of malware. Have you ever tried deleting a locked file

Re: [R] Confidence interval from resampling

2011-06-23 Thread David Winsemius
On Jun 23, 2011, at 9:44 AM, Adriana Bejarano wrote: Dear R gurus, I have the following code, but I still not know how to estimate and extract confidence intervals (95%CI) from resampling. If you have a distribution of values, say "resamp.stat", of a statistic from a properly performed

Re: [R] [cleaned code] RE: AIC() vs. mle.aic() vs. step()?

2011-06-23 Thread Alexandra Thorn
On Thu, 2011-06-23 at 09:29 -0400, Alexandra Thorn wrote: > Ok, here's some example code showing how I get different output for AIC > vs. mle.aic(). Now that I've taken another look at the independent > variables, I'm wondering whether missing values in one of the variables > might be what is mes

[R] Confidence interval from resampling

2011-06-23 Thread Adriana Bejarano
Dear R gurus, I have the following code, but I still not know how to estimate and extract confidence intervals (95%CI) from resampling. Thanks! ~Adriana #data penta<-c(770,729,640,486,450,410,400,340,306,283,278,260,253,242,240,229,201,198,190,186,180,170,168,151,150,148,147,125,117,110,107,104

[R] [example code] RE: AIC() vs. mle.aic() vs. step()?

2011-06-23 Thread Alexandra Thorn
Ok, here's some example code showing how I get different output for AIC vs. mle.aic(). Now that I've taken another look at the independent variables, I'm wondering whether missing values in one of the variables might be what is messing me up. I'm going to see if the behavior changes when I remove

Re: [R] numerical integration and 'non-finite function value' error

2011-06-23 Thread David Winsemius
On Jun 23, 2011, at 8:55 AM, Adan_Seb wrote: Here is a self-contained example of my problem. set.seed(100) x = rbeta(100, 10.654, 10.439) # So the shape parameters and the exteremes are a = 10.654 b = 10.439 xmax = 1 xmin = 0 # Using the non-standardized form (as in my application and this s

[R] The R Journal Vol. 3/1 now published

2011-06-23 Thread Heather Turner
Dear All, The first issue of the third volume of The R Journal is now available at http://journal.r-project.org/current.html. Thanks to everyone involved. Heather -- Editor in chief heather.tur...@r-project.org ___ r-annou...@r-project.org mailing l

[R] Rms package - problems with fit.mult.impute

2011-06-23 Thread Lina Hellström
Hi! Does anyone know how to do the test for goodness of fit of a logistic model (in rms package) after running fit.mult.impute? I am using the rms and Hmisc packages to do a multiple imputation followed by a logistic regression model using lrm. Everything works fine until I try to run the test f

Re: [R] AIC() vs. mle.aic() vs. step()?

2011-06-23 Thread Alexandra Thorn
The packages is wle. I'll put together some code that shows the behavior I'm talking about, and send it to the list. Alexandra On Thu, 2011-06-23 at 13:51 +0200, Rubén Roa wrote: > I don't find the mle.aic function. Thus it does not ship with R and it's in > some contributed package. > What pa

Re: [R] numerical integration and 'non-finite function value' error

2011-06-23 Thread Adan_Seb
Here is a self-contained example of my problem. set.seed(100) x = rbeta(100, 10.654, 10.439) # So the shape parameters and the exteremes are a = 10.654 b = 10.439 xmax = 1 xmin = 0 # Using the non-standardized form (as in my application and this shouldn't make any difference) of the # Beta densi

Re: [R] Time-series analysis with treatment effects - statistical approach

2011-06-23 Thread Mike Marchywka
> From: rvarad...@jhmi.edu > To: marchy...@hotmail.com; jmo...@student.canterbury.ac.nz; > r-help@r-project.org > Subject: RE: [R] Time-series analysis with treatment effects - statistical > approach > Date: Thu, 23 Jun 2011 02:59:19 + > > If you have any specific features of the ti

Re: [R] Subtracting TimeStamps

2011-06-23 Thread David Winsemius
On Jun 23, 2011, at 7:26 AM, sumit gupta wrote: Hi All,, I am new to R and having a problem dealing with timestamps. I have 2 columns in my table . Both of these have timestamps value in format 06/22/11 05:34 PM . If these are Date or DateTime objects you can use: ?difftime # with atten

[R] MST dissimilarity

2011-06-23 Thread Ondřej Mikula
Dear R-helpers, I need to quantify dissimilarity of two minimum spanning trees, specifically dissimilarity of their topologies. (They connect the same objects but they are calculated from different sets of variables.) Are you aware of any R-function doing this? Best regards Ondrej Mikula _

Re: [R] Removing rows of zeros from a matrix

2011-06-23 Thread David Winsemius
On Jun 2, 2011, at 11:35 AM, Petr Savicky wrote: On Thu, Jun 02, 2011 at 11:23:28AM -0400, Jim Silverton wrote: Hi, Can someone tell me how to remove rows of zeros from a matrix? For example if I have the following matrix, 0 0 0 1 2 8 0 0 4 56 I should end up with 0 1 2 8 4 56 Hi. Try the

  1   2   >