[R] Error message related to 'weights for observations' argument in glmpath

2011-08-24 Thread Robert Nee
Hello- I am new to R and am trying to use glmpath for LASSO logistic regression. My data set contains 40 observations and a mix of dichotomous, categorical, and continuous potential predictor variables. I am having a problem with the 'weight = rep(1, n)' argument that relates to an optional ve

[R] question on silhouette colours

2011-08-24 Thread Gordon Robertson
I'm fairly new to the silhouette functionality in the cluster package, so apologize if I'm asking something naive. If I run the 'agnes(ruspini)' example from the silhouette section of the cluster package vignette, and assign colours to clusters, two clusters have what appear to be incorrect co

Re: [R] Suppressing error messages printed in xyplot() with panel function

2011-08-24 Thread Adam Zeilinger
Dear Deepayan and Dennis, Both of your proposed fixes worked perfectly. Thank you! Adam On 8/24/2011 9:47 PM, Deepayan Sarkar wrote: On Thu, Aug 25, 2011 at 1:00 AM, Adam Zeilinger wrote: Hello, I am using the xyplot() function to create a series of scatterplot panels with lines of best f

Re: [R] How to combine two learned regression models?

2011-08-24 Thread David Winsemius
On Aug 25, 2011, at 12:38 AM, Andra Isan wrote: Hi All, I have a set of features of size p and I would like to separate my feature space into two sets so that p = p1 + p2, p1 is a set of features and p2 is another set of features and I want to fit a glm model for each sets of features se

Re: [R] How to store the output of a loop into a matrix??

2011-08-24 Thread Dennis Murphy
Hi: It's straightforward to write a simple function to do this: simmat <- function(N, t1) matrix(rep(runif(N, min = -1, max = 1), each = t1), nrow = N, byrow = TRUE) v <- simmat(45, 10) head(v, 3) HTH, Dennis PS: T is a reserved word in R (abbreviation for the logical TRUE) and should not be us

Re: [R] dput data frame

2011-08-24 Thread Dennis Murphy
Hi: Try this instead: m <- matrix(rpois(40, 10), nrow = 1) > dim(m) [1] 140 r <- m[1:10, 3:6] dput(r) structure(c(12, 7, 15, 8, 6, 7, 14, 10, 11, 4, 9, 16, 12, 5, 9, 10, 9, 9, 8, 7, 12, 9, 10, 12, 12, 11, 11, 8, 12, 8, 15, 21, 3, 3, 13, 9, 8, 13, 7, 11), .Dim = c(10L, 4L)) # Alte

Re: [R] Creating new variable with maximum visit date by group_id

2011-08-24 Thread Dennis Murphy
Hi: Since you tried several functions (reasonably so IMO), here is how they would work in this problem, in addition to the solutions already supplied. Some data massaging before starting, taking your data as input, saved into an object named visits: visits <- structure(list(unique_id = c(1L, 1L,

Re: [R] Suppressing error messages printed in xyplot() with panel function

2011-08-24 Thread Deepayan Sarkar
On Thu, Aug 25, 2011 at 1:00 AM, Adam Zeilinger wrote: > Hello, > > I am using the xyplot() function to create a series of scatterplot panels > with lines of best fit.  To draw the lines of best fit for each panel, I am > using a panel function.  Here's an example: > >> species <- as.character(c(r

[R] How to combine two learned regression models?

2011-08-24 Thread Andra Isan
Hi All, I have a set of features of size p and I would like to separate my feature space into two sets so that p = p1 + p2, p1 is a set of features and p2 is another set of features and I want to fit a glm model for each sets of features separately. Then I want to combine the results of two gl

Re: [R] (OT) Puzzled over reinstalling R on new Linux distro...

2011-08-24 Thread Peter Langfelder
On Wed, Aug 24, 2011 at 6:19 PM, Brian Lunergan wrote: > Evening all: > > Redid my home box using VectorLinux (Slackware variation) and now I'm not sure > which game trail to follow to reinstall R. > > Could somebody with more knowledge in this share their thoughts off-list. Just > need a pointer

Re: [R] pooled hazard model with aftreg and time-dependent variables

2011-08-24 Thread JPF
This is for coxph: The cluster term is used to compute a robust variance for the model. The term + cluster(id) where each value of id is unique is equivalent to specifying the robust=T argument, and produces an approximate jackknife estimate of the variance. If the id variable were not unique, but

Re: [R] Suppressing error messages printed in xyplot() with panel function

2011-08-24 Thread Dennis Murphy
Hi: Here's one way out: xyplot(y ~ x|species*year, data = ex.data, type = c('p', 'r')) type = is a very useful argument to know in xyplot(). See p.75 of the Lattice book. HTH, Dennis On Wed, Aug 24, 2011 at 12:30 PM, Adam Zeilinger wrote: > Hello, > > I am using the xyplot() function to creat

Re: [R] Bold in expression in Y label

2011-08-24 Thread David Winsemius
On Aug 24, 2011, at 9:10 PM, Katherine Lizama Allende wrote: Hi all: I need to put bold font in the y label, which is an expression at the same time When putting font.lab=2 in plot, it only puts bold font for the x axis label.. what should I do? Thanks very much plot(jitter(c(1, 4, 7, 9,

Re: [R] how to compare two dataset with same sampling

2011-08-24 Thread William Dunlap
merge() can align the values in the obs columns so those with the same date can be compared. E.g., set up the data with the following copy-and-pastable code: A <- read.table(header=TRUE, textConnection(" year mon day obs 2010 03 1212 2010 03 1822 2010 04 1262 2010 0

Re: [R] Bold in expression in Y label

2011-08-24 Thread Jorge I Velez
Hi Kathy, Try plot(10, xlab = "Week", ylab = expression(bold("B removal rate "*"(mg/"*m^3*"-d)"))) HTH, Jorge On Wed, Aug 24, 2011 at 9:10 PM, Katherine Lizama Allende <> wrote: > Hi all: > > I need to put bold font in the y label, which is an expression at the same > time > > When putting fo

Re: [R] How to store the output of a loop into a matrix??

2011-08-24 Thread Jorge I Velez
Hi Alexandra, Here is an alternative without using a loop: matrix(sapply(a, rep, T), ncol = 1) HTH, Jorge On Wed, Aug 24, 2011 at 9:10 PM, Soberon Velez, Alexandra Pilar <> wrote: > Hello, > > I want to create a matrix of N random numbers with a uniform distributions. > Later, I want to repea

Re: [R] how to compare two dataset with same sampling

2011-08-24 Thread Jie TANG
thanks. Merge? I am just looking for a method to comparison on homogeneous sample between two dataset. 2011/8/25 Jeff Newmiller > ?merge may be what you are looking for. If not, you should clarify what you > want to do. >

[R] Bold in expression in Y label

2011-08-24 Thread Katherine Lizama Allende
Hi all: I need to put bold font in the y label, which is an expression at the same time When putting font.lab=2 in plot, it only puts bold font for the x axis label.. what should I do? Thanks very much plot(jitter(c(1, 4, 7, 9, 11, 13), a=0.1), y = Bllim.m, xlab = "Week", ylab = expression(paste

[R] (OT) Puzzled over reinstalling R on new Linux distro...

2011-08-24 Thread Brian Lunergan
Evening all: Redid my home box using VectorLinux (Slackware variation) and now I'm not sure which game trail to follow to reinstall R. Could somebody with more knowledge in this share their thoughts off-list. Just need a pointer to the appropriate trail head. I can take it from there. Regards.

[R] How to store the output of a loop into a matrix??

2011-08-24 Thread Soberon Velez, Alexandra Pilar
Hello, I want to create a matrix of N random numbers with a uniform distributions. Later, I want to repeat T times each row of this matrix. For this I do the following loop: N<-45 T<-10 n<-N*T a<-matrix(runif(N,min=-1,max=1),nr=N) mymat<-matrix(rep(NA,n),nr=n,nc=1) for(i in i:N){ b<-rep(a[i,],

Re: [R] how to compare two dataset with same sampling

2011-08-24 Thread Jeff Newmiller
?merge may be what you are looking for. If not, you should clarify what you want to do. --- Jeff Newmiller The . . Go Live... DCN: Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar

[R] how to compare two dataset with same sampling

2011-08-24 Thread Jie TANG
hi , Now I have two dataset and want to compare them with same sample. Dataset A: year mon day obs 2010 03 1212 2010 03 1822 2010 04 1262 2010 07 24 29 Dataset B: year mon day obs 2010 03 1215 2010 04 1257 2010 07 2432 2010 08

Re: [R] Boxplot orders

2011-08-24 Thread David Winsemius
On Aug 24, 2011, at 8:36 PM, Weidong Gu wrote: At default, factors (months) are alphabetically leveled. You can explicitly re-level months months<-factor(months,levels=c('Jan','Feb','Mar',...,'Dec')) > ?Constants > month.abb [1] "Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug" "Sep" "Oct"

Re: [R] Importing data from MS EXCEL (.xls) to R XXXX

2011-08-24 Thread B77S
I agree with Ken.. if you can, save it as a CSV file. But if you have a bunch of these, then it isn't very efficient. I use read.xlsx() from the package "xlsx". I notice that you are using the full path.. have you tried changing directories?... I find it is best to compartmentalize my work and

Re: [R] Boxplot orders

2011-08-24 Thread Weidong Gu
At default, factors (months) are alphabetically leveled. You can explicitly re-level months months<-factor(months,levels=c('Jan','Feb','Mar',...,'Dec')) Then it should work. Weidong Gu On Wed, Aug 24, 2011 at 10:45 AM, Phoebe Jekielek wrote: > Hi there, > > I have length data of an organism o

Re: [R] Howto convert Linear Regression data to text

2011-08-24 Thread B77S
If I understand you correctly, see ?paste and the following to extract the values you require: summary(res)[[4]][1] summary(res)[[4]][2] summary(res)[[8]] HTH ashz wrote: > > Dear all, > > How can I covert lm data to text in the form of "y=ax+b, r2" and how do I > calculate R-squared(r

[R] Package missForest changes data types?

2011-08-24 Thread nima82
Hi, I'm trying to impute a data set consisting of mixed type variables, mostly logical, but also ordered and non-ordered factors, and numeric variables with the missForest package. Although the help file of missForest states that the resulting data matrix 'ximp' has the same type as the original d

[R] Refit for flexmix

2011-08-24 Thread ericmak
Hi all, Just a small question: After fitting a multivariate mixture using flexmix, I wish to use refit to get the parameters of covariates and their standard errors. However using refit I only can see the components for the first dependent variable. What should I do if I want to see the others? T

Re: [R] dput data frame

2011-08-24 Thread David Winsemius
On Aug 24, 2011, at 6:48 PM, Jeffrey Joh wrote: I have a data frame that is about 40 columns by 1 rows. I want to get the dput of small portion of that by using dput(results[1:10,3:6]). The dput is very long and includes all the values from the original data frame. Why is that?

Re: [R] dput data frame

2011-08-24 Thread R. Michael Weylandt
How are you storing the elements of the data frame? I'm working with a data frame of doubles with no names and having trouble observing the same problem. If they are factor levels though, that *might* account for it. sessionInfo() might also help. Obviously it's not convenient to print this example

[R] dput data frame

2011-08-24 Thread Jeffrey Joh
I have a data frame that is about 40 columns by 1 rows. I want to get the dput of small portion of that by using dput(results[1:10,3:6]). The dput is very long and includes all the values from the original data frame. Why is that? Jeffrey __

Re: [R] Importing data from MS EXCEL (.xls) to R XXXX

2011-08-24 Thread Jorge I Velez
Hi Dan, You might try require(gdata) ?read.xls HTH, Jorge On Wed, Aug 24, 2011 at 6:20 PM, Dan Abner <> wrote: > Hello everyone, > > What is the simplest, most RELIABLE way to import data from MS EXCEL (.xls) > format to R? In the past I have used the read.xls() function from the > xlsReadWri

Re: [R] Creating new variable with maximum visit date by group_id

2011-08-24 Thread Jean V Adams
Try this: require(zoo) lvd <- tapply(df$visit_date, df$unique_id, max) index <- tapply(df$visit_date, df$unique_id) df$last_visit_date <- as.Date(lvd[index]) Jean Kathleen Rollet wrote on 08/24/2011 04:15:45 PM: > > Dear R users, > > I am encoutering the following problem: I have a dataset wit

[R] Fwd: Importing data from MS EXCEL (.xls) to R XXXX

2011-08-24 Thread Ken Hutchison
-- Forwarded message -- From: Ken Hutchison Date: Wed, Aug 24, 2011 at 6:27 PM Subject: Re: [R] Importing data from MS EXCEL (.xls) to R To: Dan Abner save as csv. ?read.csv Ken On Wed, Aug 24, 2011 at 6:20 PM, Dan Abner wrote: > Hello everyone, > > What is the simpl

[R] Fwd: help with "by" command

2011-08-24 Thread Ken Hutchison
-- Forwarded message -- From: Ken Hutchison Date: Wed, Aug 24, 2011 at 6:06 PM Subject: Re: [R] help with "by" command To: amalka ?tapply or more specifically ?ave Hope this helps, Ken On Wed, Aug 24, 2011 at 2:51 PM, amalka wrote: > Hello, > > I am a new user of R, an

Re: [R] Creating new variable with maximum visit date by group_id

2011-08-24 Thread David Winsemius
On Aug 24, 2011, at 5:15 PM, Kathleen Rollet wrote: Dear R users, I am encoutering the following problem: I have a dataset with a 'unique_id' and different 'visit_date' (formatted as.Date, "%d/%m/ %Y") per unique_id. I would like to create a new variable with the most recent date of visit

[R] Importing data from MS EXCEL (.xls) to R XXXX

2011-08-24 Thread Dan Abner
Hello everyone, What is the simplest, most RELIABLE way to import data from MS EXCEL (.xls) format to R? In the past I have used the read.xls() function from the xlsReadWrite package, however, I have been wrestling with it all afternoon long with no success. I continue to receive the following err

Re: [R] Split data frame by date (POSIXlt)

2011-08-24 Thread Jean V Adams
You could try using the numeric representation of date, and split the data frame using that variable. For example: src$date.num <- as.numeric(src$date) Jean Franc Lucas wrote on 08/24/2011 02:42:58 PM: > >Hello everyone, >I want to split a data.frame by the column date . The data fram

Re: [R] as.numeric() and POSIXct format

2011-08-24 Thread Justin Haynes
as.POSIXct(518400,origin='2001-01-01') [1] "2001-01-07 PST" as.POSIXct(as.numeric(as.POSIXct(518400,origin='2001-01-01')),origin='1970-01-01') [1] "2001-01-07 08:00:00 PST" On Wed, Aug 24, 2011 at 9:22 AM, Agustin Lobo wrote: > Hi! > > I'm confused by this: > > as.numeric(as.POSIXct(518400,**o

Re: [R] help with "by" command

2011-08-24 Thread Jorge I Velez
Hi Ari, Try this instead with(foo, tapply(V2, trust, mean, na.rm = TRUE)) See ?tapply and ?with for more information. HTH, Jorge On Wed, Aug 24, 2011 at 2:51 PM, amalka <> wrote: > Hello, > > I am a new user of R, and I'd be grateful if someone could help me with the > following: > > I would

Re: [R] Regression by factor using "sapply"

2011-08-24 Thread Jorge I Velez
Hi elh, You could try using split() and lapply() instead (untested): mymodels <- lapply(split(usage, ActNo), function(l) lm(AvgKWh ~ AvgHDD + AvgCDD, data = l) ) To access the coefficients for all models you can do lapply(mymodels, coef) and, to access model number one (first ActNo), mymodels

Re: [R] Threads in R

2011-08-24 Thread Immanuel
Thanks again, you are perfectly right. I checked and saw I was indeed polluting my machine with unclosed threads. On 08/23/2011 01:34 AM, Peter Langfelder wrote: > On Mon, Aug 22, 2011 at 3:12 PM, Immanuel wrote: >> Hello, >> >> thanks for the input. Below is a small example, simpler then expecte

Re: [R] unused argument(s) (Header = True) help!

2011-08-24 Thread Daniel Nordlund
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of shardman > Sent: Wednesday, August 24, 2011 8:10 AM > To: r-help@r-project.org > Subject: [R] unused argument(s) (Header = True) help! > > Hi, > > I'm really new to R so I aopl

Re: [R] unused argument(s) (Header = True) help!

2011-08-24 Thread Jorge I Velez
Hi Sam, It is "header", not "Header". See ?read.table. HTH, Jorge On Wed, Aug 24, 2011 at 11:10 AM, shardman < wrote: > Hi, > > I'm really new to R so I aoplogise if this is a stupid question. > > I'm trying to import data from a .txt file into R using the read.table > command, the headers fo

Re: [R] unused argument(s) (Header = True) help!

2011-08-24 Thread R. Michael Weylandt
The proper command is "header = TRUE" capitalization is important for both *h*eader and T*RUE* Hope this helps, Michael Weylandt On Wed, Aug 24, 2011 at 11:10 AM, shardman wrote: > Hi, > > I'm really new to R so I aoplogise if this is a stupid question. > > I'm trying to import data from a .txt

Re: [R] regarding changing of title of decompose graph

2011-08-24 Thread R. Michael Weylandt
Read the plot documentation by typing ?plot, particularly the optional argument main. Hope this helps, Michael Weylandt On Wed, Aug 24, 2011 at 1:40 PM, upani1982 wrote: > Hi All, > > I am new to this forum. I have just started learning R. When i use > plot(decompose(x)), i am getting the titl

Re: [R] Append a value to a vector

2011-08-24 Thread Jean V Adams
Claudio Zanettini wrote on 08/24/2011 04:33:50 PM: > > Thank you, this work fine, > and is not contorted like mine:) > In this case lastV=LastI but depending on the data that I obtain > lastV can be = LastA. > > Any way it works very good:) > > Thank you > very much :) > > > PS: but I still

Re: [R] df of numerator and denominator

2011-08-24 Thread Jorge I Velez
Hi, All the information is contained in your aov() object. Take a look at the first example at ?aov HTH, Jorge * * On Wed, Aug 24, 2011 at 10:33 AM, martinas <> wrote: > hello > > I need to know the dfn and dfd of my Anova. But in the Anova output there > is > only "Df". > Is this the dfn or

[R] lodplot help

2011-08-24 Thread Al-Sabban, Shaza
I have a data frame (narrow) with 431 rows and 6 columns containing information on chromosome, position, lod1, lod2, lod3, lod4, looking like this: > narrow chr pos lod1 lod2 lod3 lod4 1 1 3.456 -0.025 -0.003 -0.209 -0.057 2 1 5.697 -0.029 -0.005 -0.200 -0.058 3 1

[R] looking for REML from a gnls fit or a nonlinear function (without random effects) fit using REML

2011-08-24 Thread Daniel Okamoto
Dear R users, I am fitting nonlinear mixed effects models with autocorrelated errors (an AR(1) model on the residuals) using NLME and am comparing a set of models that contain the same fixed effects structure but with different or no random effects (nested) . The issue I've come across that

Re: [R] Two-levels labels on x-axis?

2011-08-24 Thread Sébastien Vigneau
I figured out a solution by myself. In brief, I used different axis commands to specify the ticks (with labels set to FALSE) and the labels (with tick set to FALSE). For instance (with width=1 and space=1): axis(side=1,at=c(2,6),labels=FALSE,tck=-0.1) axis(side=1,at=c(0,4,8),labels=FALSE,tck=-0.2)

[R] Suppressing error messages printed in xyplot() with panel function

2011-08-24 Thread Adam Zeilinger
Hello, I am using the xyplot() function to create a series of scatterplot panels with lines of best fit. To draw the lines of best fit for each panel, I am using a panel function. Here's an example: > species <- as.character(c(rep(list("A", "B", "A"), 10), "B")) > year <- as.character(c(rep

[R] Creating new variable with maximum visit date by group_id

2011-08-24 Thread Kathleen Rollet
Dear R users, I am encoutering the following problem: I have a dataset with a 'unique_id' and different 'visit_date' (formatted as.Date, "%d/%m/%Y") per unique_id. I would like to create a new variable with the most recent date of visit per unique_id as shown below. unique_id visit_date

[R] Extracting and using fitted values and residuals with missing data

2011-08-24 Thread Matt1299
Hi folks, I've a basic question concerning missing data. I'm running mixed effects analyses using nlme. I've a sizable chunk of missing data on the outcome being modeled, and am using "na.action=na.omit" when running the models. After fitting the models, I'm then trying to extract and use the f

[R] Split data frame by date (POSIXlt)

2011-08-24 Thread Franc Lucas
Hello everyone, I want to split a data.frame by the column date . The data frame looks like this date time openclose 02.01.201109:00:00 1000 1200 02.01.201109:05:02 1200 1203 ... 01.02.2011

[R] regarding changing of title of decompose graph

2011-08-24 Thread upani1982
Hi All, I am new to this forum. I have just started learning R. When i use plot(decompose(x)), i am getting the title " Additive time series decomposition". How to make this title off and change to some other title. Any help regarding this is highly appreciated. With sincerer regards, Upananda

[R] help with "by" command

2011-08-24 Thread amalka
Hello, I am a new user of R, and I'd be grateful if someone could help me with the following: I would like to compute the mean of variable "trust" in dataframe "foo", but separately for each level of variable V2. That is, I'd like to compute the mean of trust at each level of V2. I have done th

[R] nlminb - how to avoid evaluating initial parameters infinite in integrate

2011-08-24 Thread Newbie
Dear R-users. I am faced with a problem I dont know how to solve. I need to calibrate the Heston stochastic volatility model, and have (to my own belief) created a code for calculating the prices of options by this model. However, when I calibrate the model using NLMINB I also evaluate my initial

[R] as.numeric() and POSIXct format

2011-08-24 Thread Agustin Lobo
Hi! I'm confused by this: > as.numeric(as.POSIXct(518400,origin="2001-01-01")) [1] 978822000 I guess the problem is that as.numeric() assumes a different origin, but cannot find any default origin. How can I get back the seconds from the POSIXct format? In other words, which the inverse funct

[R] Append a value to a vector

2011-08-24 Thread heverkuhn
This should be easy but it does not work I have 3 vectors*(activeT,inactT, activeR)*, the idea is that if the last value in inactT is higher than the last in activeT this value has to be append in active T and the last value in another vector call activeR has to be repeated. (at the bottom you can

[R] Regression by factor using "sapply"

2011-08-24 Thread elh
Apologies for the elementary nature of the question (yes, I'm another newbie)... I'd like to perform a multiple regression on a single data set containing a representation of energy consumption and temperatures containing account number, usage (KWh), heating degree days (HDD) and cooling degree (C

Re: [R] Controling R from MS Access

2011-08-24 Thread lowman
Hello did you happen to figure this out? I am just learning about using R, i have a whack of fish data in MSAccess...and i want to take whatever functions access is limited by with stats, and then call R to do them i know the package RODBC works great to read data from your mdb, but i want to hav

[R] df of numerator and denominator

2011-08-24 Thread martinas
hello I need to know the dfn and dfd of my Anova. But in the Anova output there is only "Df". Is this the dfn or the dfd? and how do I get both of it in R? Thanks for any answers -- View this message in context: http://r.789695.n4.nabble.com/df-of-numerator-and-denominator-tp3765526p3765526.htm

Re: [R] Controling R from MS Access

2011-08-24 Thread lowman
answered my own question, just use the call shell function in vb woohoo -- View this message in context: http://r.789695.n4.nabble.com/Controling-R-from-MS-Access-tp2719751p3766037.html Sent from the R help mailing list archive at Nabble.com. __ R-h

Re: [R] R (&stats) newcomer.... help!

2011-08-24 Thread geigercounter120
Many thanks for your response. unfortunately, it appears that I'm the closest thing in the vicinity to a local expert (chilling times indeed...), but i will certainly look at the booklist in terms of the number of data points, we have: two shores, three treatments, three replicates of each treatm

[R] ddply from plyr package - any alternatives?

2011-08-24 Thread AdamMarczak
Hello everyone, I was asked to repost this again, sorry for any inconvenience. I'm looking replacement for ddply function from plyr package. Function allows to apply function by category stored in any column/columns. Regular loops or lapplys slow down greatly because my unique combination count

Re: [R] Replacing NAs in one variable with values of another variable

2011-08-24 Thread StellathePug
Thank you Dan and Ista! Both of you are correct, I should have used NA rather than "NA" in my example. So the correct code should be: X <-as.data.frame(matrix(c(9, 6, 1, 3, 9, NA, NA,NA,NA,NA, 6, 4, 3,NA, NA, NA, 5, 4, 1, 3), ncol=2)) names(X)<-c("X1","X2") X$X1[

[R] unused argument(s) (Header = True) help!

2011-08-24 Thread shardman
Hi, I'm really new to R so I aoplogise if this is a stupid question. I'm trying to import data from a .txt file into R using the read.table command, the headers for the data columns are already in the text file so I add Header = True after the file location. The problem is I keep getting the erro

[R] Howto convert Linear Regression data to text

2011-08-24 Thread ashz
Dear all, How can I covert lm data to text in the form of "y=ax+b, r2" and how do I calculate R-squared(r2)? Thanks. Code: x=18:29 y=c(7.1,7,7.7,8.2,8.8,9.7,9.9,7.1,7.2,8.8,8.7,8.5) res=lm(y~x) -- View this message in context: http://r.789695.n4.nabble.com/Howto-convert-Linear-Regression-dat

[R] Boxplot orders

2011-08-24 Thread Phoebe Jekielek
Hi there, I have length data of an organism over the year and I want to make a boxplot. I get the boxplot just fine but the months are all out of order. In the data set they are in order from Jan-Dec...how can I fix this problem? Thanks so much in advance!! Phoebe [[alternative HTML ver

Re: [R] Append a value to a vector

2011-08-24 Thread Claudio Zanettini
Thank you, this work fine, and is not contorted like mine:) In this case lastV=LastI but depending on the data that I obtain lastV can be = LastA. Any way it works very good:) Thank you very much :) PS: but I still do not understand what was wrong in the script that I used, It was not very appr

Re: [R] Append a value to a vector

2011-08-24 Thread Jean V Adams
I'm still a little confused about lastV and lastI. The code you provide uses lastV, but your description seems to refer to lastI. Test out this code and see if it is doing what you want it to do. lastI lastA activeT activeR if(lastI > lastA) { activeT <- c(activeT, lastI) activ

Re: [R] Column of probabilities

2011-08-24 Thread David Winsemius
On Aug 24, 2011, at 3:31 PM, Jim Silverton wrote: Hi all, I have a vector xm say: xm = c(1,2,3,4,5,5,5,6,6) I want to return a vector with the corresponding probabilities based on the amount of times the numbers occurred. For example, I should get the following vector for xm: prob.xm = c(1

Re: [R] Append a value to a vector

2011-08-24 Thread Jean V Adams
Claudio Zanettini wrote on 08/24/2011 03:04:39 PM: > This should be easy but it does not work > I have 3 vectors*(activeT,inactT, activeR)*, > the idea is that if the last value in inactT is higher than the last in > activeT > this value has to be append in active T When you say "this value" whi

[R] Append a value to a vector

2011-08-24 Thread Claudio Zanettini
This should be easy but it does not work I have 3 vectors*(activeT,inactT, activeR)*, the idea is that if the last value in inactT is higher than the last in activeT this value has to be append in active T and the last value in another vector call activeR has to be repeated. (at the bottom you can

Re: [R] Opening package manual from within R

2011-08-24 Thread Tyler Rinker
Apparently my request to view the help pages is not a popular method among R users for gaining information. for me these pages are very helpful so I will follow up to completed this thread for future searchers. First thanks fo Prof. Brian Ripley. Your idea was spot on what I was looking for

Re: [R] Model selection and model efficiency - Search for opinions

2011-08-24 Thread Bert Gunter
1. As this is not really appropriate for R, I suggest replies be private. 2. You might try posting on various statistical forums, e.g. on http://stats.stackexchange.com/ -- Cheers, Bert On Wed, Aug 24, 2011 at 12:15 PM, Arnaud Mosnier wrote: > Hi, > > In order to find the best models I use AIC

Re: [R] Column of probabilities

2011-08-24 Thread R. Michael Weylandt
If your numbers are all positive integers, this should work: (tabulate(xm)[xm])/length(xm) it can be put into a function for ease of use: probVec <- function(x) {(tabulate(x)[x])/length(x)} You'll have some trouble if you have non-positive integers or non-integers. Let me know if you need to ha

Re: [R] Column of probabilities

2011-08-24 Thread Jean V Adams
Try this: prob.xm <- (table(xm)/length(xm))[match(xm, sort(unique(xm)))] Jean Jim Silverton wrote on 08/24/2011 02:31:05 PM: > Hi all, > I have a vector xm say: xm = c(1,2,3,4,5,5,5,6,6) > > I want to return a vector with the corresponding probabilities based on the > amount of times the nu

[R] Column of probabilities

2011-08-24 Thread Jim Silverton
Hi all, I have a vector xm say: xm = c(1,2,3,4,5,5,5,6,6) I want to return a vector with the corresponding probabilities based on the amount of times the numbers occurred. For example, I should get the following vector for xm: prob.xm = c(1/9, 1/9, 1/9, 1/9, 3/9, 3/9, 3/9, 2/9, 2/9) Any help grea

[R] Model selection and model efficiency - Search for opinions

2011-08-24 Thread Arnaud Mosnier
Hi, In order to find the best models I use AIC, more specifically I calculate Akaike weights then Evidence Ratio (ER) and consider that models with a ER < 2 are equally likely. But the same problem remain each time I do that. I selected the best models from a set of them, but I don't know if those

Re: [R] silently testing for data from another package for .Rd examples

2011-08-24 Thread Michael Friendly
On 8/24/2011 12:40 PM, Uwe Ligges wrote: Actually it is recommended to test for the availability of a valid package with find.package(), particularly in this case where the name of the package is already know. Best, Uwe Thanks. So I guess the idiom I'm looking for is > length((find.package(

Re: [R] Help: convert entry of a list into a matrix

2011-08-24 Thread R. Michael Weylandt
Rereading your email, still not sure what the question is -- perhaps you could give a better code example to illustrate the difference between a[[2]] and mat1 -- but, since you mentioned briefly lists of lists, have you looked at unlist(, recursive = F)? If applied to a list of lists, it won't unli

Re: [R] Help: convert entry of a list into a matrix

2011-08-24 Thread R. Michael Weylandt
I'm not sure I understand your question: a[[2]] is a matrix. > a <- list(matrix(1:6,2),matrix(5:10,2)) > is.matrix(a[[2]]) TRUE x = a[[2]] > is.matrix(x) TRUE > x+2 [,1] [,2] [,3] [1,] 7 9 11 [2,] 810 12 > a[[2]] + 2 [,1] [,2] [,3] [1,] 7 9 11 [2,] 810 12 Wha

Re: [R] read.table truncated data?

2011-08-24 Thread Sarah Goslee
Hi, On Wed, Aug 24, 2011 at 2:18 PM, zhenjiang xu wrote: > Hi R users, > > I was using read.table to read a file. The data.fame looked alright, but I > found not all rows are read by the read.table. What's wrong with it? It > didn't give me any warning or error messages. Why the data are truncate

[R] Help: convert entry of a list into a matrix

2011-08-24 Thread Chee Chen
Dear All, As always, I appreciate all your help. I would like to know the easiest way to convert each of the homogeneous elements of a numeric list into a matrix. Each element of this list is also a list such that when displayed, looks like a 2-by-3 matrix , I would like to convert each of them

[R] read.table truncated data?

2011-08-24 Thread zhenjiang xu
Hi R users, I was using read.table to read a file. The data.fame looked alright, but I found not all rows are read by the read.table. What's wrong with it? It didn't give me any warning or error messages. Why the data are truncated? Thanks. $ wc -l all/isoform_exp.diff 42847 all/isoform_exp.diff

Re: [R] Function rank() for data frames (or multiple vectors)?

2011-08-24 Thread David Winsemius
On Aug 24, 2011, at 1:37 PM, Sebastian Bauer wrote: Hi! in R? Basically, what I need is a mixture of order() and rank(). While the former allows to specify multiple vectors, it doesn't provide the flexibility of rank() such that I can specify what happens if ties can not be broken. An exampl

Re: [R] How to do cross validation with glm?

2011-08-24 Thread Frank Harrell
What is your sample size? I've had trouble getting reliable estimates using simple data splitting when N < 20,000. Note that the following functions in the rms package facilitates cross-validation and bootstrapping for validating models: ols, validate, calibrate. Frank Andra Isan wrote: > > Hi

Re: [R] Function rank() for data frames (or multiple vectors)?

2011-08-24 Thread Sebastian Bauer
Hi! in R? Basically, what I need is a mixture of order() and rank(). While the former allows to specify multiple vectors, it doesn't provide the flexibility of rank() such that I can specify what happens if ties can not be broken. >>> An example of this "simple problem" would c

Re: [R] data manipulation and summaries with few million rows

2011-08-24 Thread Juliet Hannah
Thanks Dennis! I'll check this out. Just to clarify, I need the total number of switches/changes regardless of if that state had occurred in the past. So A-A-B-A, would have 2 changes: A to B and B to A. Thanks again. On Wed, Aug 24, 2011 at 1:28 PM, Dennis Murphy wrote: > Hi Juliet: > > Here'

Re: [R] Function rank() for data frames (or multiple vectors)?

2011-08-24 Thread David Winsemius
On Aug 24, 2011, at 1:11 PM, Sebastian Bauer wrote: Hi! I'd like to rank rows of a data frame similar to what rank() does for vectors. However, ties should be broken by columns that I specify. If it is not possible to break a ties (because the row data is essentially the same), I'd like to ha

Re: [R] data manipulation and summaries with few million rows

2011-08-24 Thread Dennis Murphy
Hi Juliet: Here's a Q & D solution: # (1) plyr > f <- function(d) length(unique(d$mygroup)) - 1 > ddply(myData, .(id), f) id V1 1 1 0 2 2 2 3 3 1 4 4 0 # (2) data.table myDT <- data.table(myData, key = 'id') myDT[, list(nswitch = length(unique(mygroup)) - 1), by = 'id'] If one can sw

Re: [R] How to do cross validation with glm?

2011-08-24 Thread Andra Isan
Hi, Thanks for the reply. What I meant is that, I would like to partition my dat data (a data frame) into training and testing data and then evaluate the performance of the model on test data. So, I thought cross validation is the natural choice to see how the prediction works on the hold-out d

Re: [R] How to do cross validation with glm?

2011-08-24 Thread Prof Brian Ripley
What you describe is not cross-validation, so I am afraid we do not know what you mean. And cv.glm does 'prediction for the hold-out data' for you: you can read the code to see how it does so. I suspect you mean you want to do validation on a test set, but that is not what you actually claim.

Re: [R] Function rank() for data frames (or multiple vectors)?

2011-08-24 Thread Sebastian Bauer
Hi! >> I'd like to rank rows of a data frame similar to what rank() does >> for vectors. However, ties should be broken by columns that I >> specify. If it is not possible to break a ties (because the row data >> is essentially the same), I'd like to have the same flexibility that >> rank() offers

[R] How to do cross validation with glm?

2011-08-24 Thread Andra Isan
Hi All, I have a fitted model called glm.fit which I used glm and data dat is my data frame pred= predict(glm.fit, data = dat, type="response") to predict how it predicts on my whole data but obviously I have to do cross-validation to train the model on one part of my data and predict on the

[R] data manipulation and summaries with few million rows

2011-08-24 Thread Juliet Hannah
I have a data set with about 6 million rows and 50 columns. It is a mixture of dates, factors, and numerics. What I am trying to accomplish can be seen with the following simplified data, which is given as dput output below. > head(myData) mydate gender mygroup id 1 2012-03-25 F

Re: [R] Function rank() for data frames (or multiple vectors)?

2011-08-24 Thread David Winsemius
On Aug 24, 2011, at 11:09 AM, Sebastian Bauer wrote: Hello, I'd like to rank rows of a data frame similar to what rank() does for vectors. However, ties should be broken by columns that I specify. If it is not possible to break a ties (because the row data is essentially the same), I'd l

Re: [R] silently testing for data from another package for .Rd examples

2011-08-24 Thread Uwe Ligges
Actually it is recommended to test for the availability of a valid package with find.package(), particularly in this case where the name of the package is already know. Best, Uwe On 24.08.2011 18:29, Yihui Xie wrote: .packages(all = TRUE) will give you a list of all available packages witho

  1   2   >