Re: [R] Running different Regressions using for loops

2012-09-26 Thread Krunal Nanavati
Dear Rui, Thanks for your time. I have a question though, when I run the 5 regression, whose outputs are stored in “lm.list[i]”, I only get the coefficients for the Intercept, Price, Trend & Seasonality as below > lm.list[1] [[1]] Call: lm(formula = as.formula(fmla), data = tryout)

[R] Calculating number of elapsed days from starting date

2012-09-26 Thread Marcel Curlin
Hi I have data for events in rows, with columns for person and date. Each person may have more than one event; tC <- textConnection(" Person date bob 1/1/00 bob 1/2/00 bob 1/3/00 dave1/7/00 dave1/8/00 dave1/10/00 kevin 1/2/00 kevin 1/3/00 kevin 1/4/00 ") data <- rea

Re: [R] Package ‘orcutt’ bug?

2012-09-26 Thread David Winsemius
Shouldn't you be sending this to the maintainer? -- David. On Sep 26, 2012, at 9:03 PM, 王柏元 wrote: > Hello~ > > Did any one have used the package 'orcutt' ? > > I find that it can not work smoothly in a single variable regression. I use > the example following, it function very well. >

[R] Package ‘orcutt’ bug?

2012-09-26 Thread 王柏元
Hello~   Did any one have used the package 'orcutt' ?   I find that it can not work smoothly in a single variable regression. I use the example following, it function very well.   But when I regress "cons" on "price" (use the "reg1<-lm(cons~price+income+temp)") , then  use "reg11<-cochr

Re: [R] replace string values with numbers

2012-09-26 Thread JiangZhengyu
Hi Guys, Both of your ways worked. Thanks a lot for your help! Best,Zhengyu > Date: Wed, 26 Sep 2012 16:28:29 -0700 > From: smartpink...@yahoo.com > Subject: Re: [R] replace string values with numbers > To: zhyjiang2...@hotmail.com > CC: r-help@r-project.org; dwinsem...@comcast.net > > Hi, > >

[R] How does "apply.monthly" function works (xts package)

2012-09-26 Thread CALEF ALEJANDRO RODRIGUEZ CUEVAS
Hi everybody. I use to work with monthly data, however this is my first time working with weekly data. I have 4 data bases with monthly data and 1 with weekly data, so I want to convert my weekly to monthly data in order to have the same periodicity in all of them. I've read that package xts can

Re: [R] replace string values with numbers

2012-09-26 Thread arun
Hi, You can also try these: Gene<-read.table(text=" P1 P2 P3  CG CG GG -- --  AC  -- AC CC AC  --  AC ",header=TRUE,sep="") Gene<-sapply(Gene,as.character) Gene<-data.frame(gsub("GG","3",Gene))  Gene #  P1 P2 P3 #1 CG CG  3 #2 -- -- AC #3 -- AC CC #4 AC -- AC # str(Gene) #'data.frame':    4 obs.

Re: [R] Anova problem with order of terms in model

2012-09-26 Thread Modi2020
Please check if your independent variables or Xs are independent. If they are not that can affect the sequential decomposition. -- View this message in context: http://r.789695.n4.nabble.com/Anova-problem-with-order-of-terms-in-model-tp791744p4644320.html Sent from the R help mailing list arch

Re: [R] Reading multiple files

2012-09-26 Thread Silvano Cesar da Costa
Actually the problem occurred in the command: names = substr (filenames, 1, 7) As the file's names are: Dados1.raw, Dados2.raw, ..., Dados11.raw, Dados12.raw, ..., Data 35.raw the program doesn't work. A quick way to make it work is rename the files to: Dados01.raw, Dados02.raw, ..., Dados11.r

Re: [R] Simple Question About Exporting Back to Excel

2012-09-26 Thread Rui Barradas
Hello, In the help page for ?hclust you will see the return values. It has an element order, "a vector giving the permutation of the original observations suitable for plotting". From the first example on that page: hc <- hclust(dist(USArrests), "ave") plot(hc) ix <- hc$order rownames(USArre

Re: [R] Simple Question About Exporting Back to Excel

2012-09-26 Thread David L Carlson
Check the return values for hclust using ?hclust (particularly the value order): > set.seed(42) > x <- matrix(rnorm(100), nrow=25) > outp <- hclust(dist(x)) > plot(outp) > outp$order [1] 9 6 16 1 7 24 25 3 14 11 12 20 18 19 23 4 10 5 17 13 22 2 15 8 21 You could use this to reorder the d

Re: [R] Reading multiple files

2012-09-26 Thread Silvano Cesar da Costa
Hi, I didn't notice problems with this. > Will your data be read in correctly if you do away with the colClasses > argument to read.delim (or read.table)? > > Jean > > > > "Silvano Cesar da Costa" wrote on 09/26/2012 09:11:33 AM: >> >> Hi, >> >> I have 35 data files for reading. I would like ge

Re: [R] Simple Question About Exporting Back to Excel

2012-09-26 Thread ilai
On Wed, Sep 26, 2012 at 3:11 PM, RCar wrote: > All, > Relatively new R user so this is probably an easy question to answer. > I am able to generate a cluster for my dataset using hclust() then ploting > the data with plot(). > This results in an image with a dendrogram with my sample names along t

Re: [R] Comparing density plots using same axes or same axes scale

2012-09-26 Thread David Winsemius
On Sep 26, 2012, at 6:13 PM, Rui Barradas wrote: > Hello, again. > > I forgot, but the subject line also says "same axes", not just same axes > scale. > If you want all densities on the same graph, use ?matplot (matrix plot). If you use matplot , presumably just plotting the y-values, you wil

Re: [R] Mac Text editors

2012-09-26 Thread Bhupendrasinh Thakre
My vote for R-Studio. Very elegant design and great functionality. However if coming from languages like Java and others then eclipse is better. R-Studio have dedicated section for Mac user which you will find useful. Best Regards, Bhupendrasinh Thakre Sent from my iPhone On Sep 26, 2012, at

Re: [R] Comparing density plots using same axes or same axes scale

2012-09-26 Thread Rui Barradas
Hello, again. I forgot, but the subject line also says "same axes", not just same axes scale. If you want all densities on the same graph, use ?matplot (matrix plot). Rui Barradas Em 27-09-2012 02:08, Rui Barradas escreveu: Hello, Something like this? sag <- matrix(rnorm(1e3 * 9), ncol = 9)

Re: [R] Mac Text editors

2012-09-26 Thread David Winsemius
On Sep 26, 2012, at 6:06 PM, David Winsemius wrote: > > On Sep 26, 2012, at 5:48 PM, Steven Wolf wrote: > >> Hi everyone, >> >> I've recently moved from using a windows machine to a Mac (some might call >> it an upgrade, others not…I'll let you be the judge). Once I started using >> Notepad

Re: [R] Comparing density plots using same axes or same axes scale

2012-09-26 Thread Rui Barradas
Hello, Something like this? sag <- matrix(rnorm(1e3 * 9), ncol = 9) d.list <- apply(sag, 2, density) xrange <- range(sapply(d.list, function(d) range(d$x))) ymax <- max(sapply(d.list, function(d) max(d$y))) op <- par(mfrow=c(3,3)) for(i in 1:9) plot(d.list[[i]], xlim = xrange, ylim = c(0,

Re: [R] Mac Text editors

2012-09-26 Thread David Winsemius
On Sep 26, 2012, at 5:48 PM, Steven Wolf wrote: > Hi everyone, > > I've recently moved from using a windows machine to a Mac (some might call it > an upgrade, others not…I'll let you be the judge). Once I started using > Notepad ++ on my windows machine, I really began to like it. Unfortunat

[R] Random Forest - Extract

2012-09-26 Thread Lopez, Dan
Hello, I have two Random Forest (RF) related questions. 1. How do I view the classifications for the detail data of my training data (aka trainset) that I used to build the model? I know there is an object called predicted which I believe is a vector. To view the detail for my testset I

Re: [R] Mac Text editors

2012-09-26 Thread David Winsemius
On Sep 26, 2012, at 5:48 PM, Steven Wolf wrote: > Hi everyone, > > I've recently moved from using a windows machine to a Mac (some might call it > an upgrade, others not…I'll let you be the judge). Once I started using > Notepad ++ on my windows machine, I really began to like it. Unfortunat

Re: [R] Mac Text editors

2012-09-26 Thread Albyn Jones
Have you looked at aquamacs? (emacs for the mac). its at aquamacs.org. albyn On 2012-09-26 17:48, Steven Wolf wrote: Hi everyone, I've recently moved from using a windows machine to a Mac (some might call it an upgrade, others not…I'll let you be the judge). Once I started using Notepad ++ on

[R] Comparing density plots using same axes or same axes scale

2012-09-26 Thread Meredith Ballard LaBeau
Good Evening- I have a set of nine scenarios I want to plot to see how the distribution is changing, if one tail is getting larger in certain scenario, currently I am using this code colnames<-dimnames(sag_pdfs)[[2]] par(mfrow=c(3,3)) for(i in 1:9) { d<-density(sag[,i]) plot(d,type="n", mai

Re: [R] Is there a way to source from a specific Git repository without hardcoding the location everywhere?

2012-09-26 Thread Curt Seeliger
Duncan Murdoch wrote on 09/26/2012 05:35:00 PM: > > ... > > I'd like to have the code source files from the 'local' git repository > > without modification, where 'local' could mean c:\yada\ for one person, > > m:\my documents\wetlands\ for another, and l:\foo\bar\sharedRemote\wet\ to > > anothe

[R] Mac Text editors

2012-09-26 Thread Steven Wolf
Hi everyone, I've recently moved from using a windows machine to a Mac (some might call it an upgrade, others not…I'll let you be the judge). Once I started using Notepad ++ on my windows machine, I really began to like it. Unfortunately, I'm not sure what the free text editor options are for

Re: [R] Is there a way to source from a specific Git repository without hardcoding the location everywhere?

2012-09-26 Thread Duncan Murdoch
On 12-09-26 8:25 PM, Curt Seeliger wrote: Folks, A small group of us are working together to develop a set of R functions to support data management and analysis using Eclipse/StatET in a Windows environment. We are using Git/EGit for version control. We work within our own repository and occas

[R] Is there a way to source from a specific Git repository without hardcoding the location everywhere?

2012-09-26 Thread Curt Seeliger
Folks, A small group of us are working together to develop a set of R functions to support data management and analysis using Eclipse/StatET in a Windows environment. We are using Git/EGit for version control. We work within our own repository and occasionally push to a common remote location.

Re: [R] averageif and looping

2012-09-26 Thread William Dunlap
You could use filter(..., filter=rep(1,5)) to get running sums of length 5 to get your answer. The following calls filter once to get the sum of the negative values in each window and once to get the number of negative values in each window, then divides to get the means. f <- function(x, n=5) {

Re: [R] averageif and looping

2012-09-26 Thread Rui Barradas
Hello, Try the following. sapply(seq_len(nrow(dat) - 4), function(i){ w <- window(dat$value, start = i, end = i + 4) mean(w[w < 0])}) Hope this helps, Rui Barradas Em 26-09-2012 16:38, Eko andryanto Prakasa escreveu: haiii i want to know, is there any script in R to measure loopin

Re: [R] Reading multiple files

2012-09-26 Thread Jean V Adams
If your previously posted code worked with files all having the same number of columns, and if your data is read in correctly without the colClasses argument, then I think the following code should work. for(i in names){ filepath = file.path("~/Silvano/Dados", paste(i, ".raw", sep=""))

Re: [R] Reading multiple files

2012-09-26 Thread Bretschneider SIG-R
On 26 Sep 2012, at 16:11 , Silvano Cesar da Costa wrote: > Hi, > > I have 35 data files for reading. I would like get a program for > performing reading of 35 files at once. > All are of the type: Dados1.raw, Dados2.raw and so on. > > If the files have the same number of columns, I can read wit

Re: [R] replace string values with numbers

2012-09-26 Thread David Winsemius
On Sep 26, 2012, at 2:27 PM, David Winsemius wrote: > > On Sep 26, 2012, at 12:52 PM, JiangZhengyu wrote: >> >> Hi everyone, I have a data frame Gene with SNPs eg. P1 P2 P3 >> CG CG GG >> -- -- AC >> -- AC CC >> AC -- AC I tried to replace all the GG with a value 3. >> Gene[Gene=="GG

Re: [R] replace string values with numbers

2012-09-26 Thread David Winsemius
On Sep 26, 2012, at 12:52 PM, JiangZhengyu wrote: > > > > > Hi everyone, I have a data frame Gene with SNPs eg. P1 P2 P3 > CG CG GG > -- -- AC > -- AC CC > AC -- AC I tried to replace all the GG with a value 3. > Gene[Gene=="GG"]<-3 It always give me: Warning in `[<-.factor`(`*tmp

Re: [R] Removing duplicates without a for loop

2012-09-26 Thread David Winsemius
On Sep 26, 2012, at 11:23 AM, Rui Barradas wrote: > Hello, > > If I understand it correctly, something like this will get you what you want. > > > d <- Sys.Date() + 1:4 > d2 <- sample(d, 2) > dat <- data.frame(id = 1:6, date = c(d, d2), value = rnorm(6)) > > aggregate(dat, by = list(dat$date)

[R] Simple Question About Exporting Back to Excel

2012-09-26 Thread RCar
All, Relatively new R user so this is probably an easy question to answer. I am able to generate a cluster for my dataset using hclust() then ploting the data with plot(). This results in an image with a dendrogram with my sample names along the bottom. Great! However, I now need a way to get th

Re: [R] Removing duplicates without a for loop

2012-09-26 Thread Clint Bowman
?duplicated Clint BowmanINTERNET: cl...@ecy.wa.gov Air Quality Modeler INTERNET: cl...@math.utah.edu Department of Ecology VOICE: (360) 407-6815 PO Box 47600FAX:(360) 407-7534 Olympia, WA 98504-7600

Re: [R] Background color in a grid plot seems to interfere with plot()

2012-09-26 Thread Marius Hofert
Dear Paul, Many thanks, that solved it. Cheers, Marius Paul Murrell writes: > Hi > > On 25/09/2012 6:10 p.m., Marius Hofert wrote: >> Dear Paul, >> >> Thanks. Redrawing the points solves it for the minimal example, but >> what happens if you have plot(.., type="b") like below? > > You can use

[R] replace string values with numbers

2012-09-26 Thread JiangZhengyu
Hi everyone, I have a data frame Gene with SNPs eg. P1 P2 P3 CG CG GG -- -- AC -- AC CC AC -- AC I tried to replace all the GG with a value 3.Gene[Gene=="GG"]<-3 It always give me: Warning in `[<-.factor`(`*tmp*`, thisvar, value = 3) : invalid factor level, NAs generated Does a

Re: [R] Removing duplicates without a for loop

2012-09-26 Thread Rui Barradas
Hello, If I understand it correctly, something like this will get you what you want. d <- Sys.Date() + 1:4 d2 <- sample(d, 2) dat <- data.frame(id = 1:6, date = c(d, d2), value = rnorm(6)) aggregate(dat, by = list(dat$date), FUN = tail, 1) Hope this helps, Rui Barradas Em 26-09-2012 16:19,

[R] Help with invoking R

2012-09-26 Thread Li, Jianying (NIH/NIEHS) [C]
Hi, I encountered a very strange error with R (2.14.1). I tried to build an R package and eventually worked (passing all the checks etc.). Then, I tried this command "R CMD INSTALL --binary pkg", which supposedly "installs and produce a binary source archive (*.zip) for use on Windows only."

Re: [R] Removing duplicates without a for loop

2012-09-26 Thread Rui Barradas
Sorry, but in my previous post I've confused the columns. It's by REQ.NR, not by date REQ.NR <- 1:4 REQ.NR <- c(REQ.NR, sample(REQ.NR, 2)) dat <- data.frame(date = Sys.Date() + 1:6, REQ.NR = REQ.NR, value = rnorm(6)) aggregate(dat, by = list(dat$REQ.NR), FUN = tail, 1) Rui Barradas Em 26-09-

[R] R and sell buy stock

2012-09-26 Thread baycan global
Hi all, I have seen that R can be switched on to a Broker called IB. There is another one similar to IB that permits to make a "code" and send orders to broker to buy or sell stocks? Can be done trough R, writte in excel and trough API sell/buy to the broker? Can someone send me an example (eas

Re: [R] Reading multiple files

2012-09-26 Thread Jean V Adams
Will your data be read in correctly if you do away with the colClasses argument to read.delim (or read.table)? Jean "Silvano Cesar da Costa" wrote on 09/26/2012 09:11:33 AM: > > Hi, > > I have 35 data files for reading. I would like get a program for > performing reading of 35 files at once

Re: [R] Removing duplicates without a for loop

2012-09-26 Thread Jean V Adams
This might be quicker. Para.5C.sorted <- Para.5C[order(Para.5C[, 1]), ] Para.5C.final <- Para.5C.sorted[!duplicated(Para.5C.sorted$REQ.NR), ] If your data are already sorted by date, then you can skip the first step and just run Para.5C.final <- Para.5C[!duplicated(Para.5C$REQ.NR), ] Jean ww

Re: [R] specifying arguments in functions and calling functions, within functions

2012-09-26 Thread David L Carlson
Adding on to what Sarah has said, your function appears to limit the functions that can be passed to it, but it does not. The character strings "mean" and "median" will fail, but passing the function name directly will work: > Scale <- function(x, method=mean,...) { >scl <- method >scl(x,

Re: [R] Retrieve regression summary results after rq

2012-09-26 Thread David Winsemius
On Sep 26, 2012, at 8:50 AM, John Kane wrote: > Strange, I have never used it but presumably you are using the package > ‘survey’? The manual suggests summary(xx) should work. > > What results or error messages do you get? She didn't return a model object as fit1. She return only the results

Re: [R] specifying arguments in functions and calling functions, within functions

2012-09-26 Thread Rui Barradas
Hello, You define a 2nd version of Scale with the dots argument but do not use it. Scale2 <- function(x, method=c("mean", "median"),...) { scl <- match.fun(method) scl(x, ...) # Here! } Scale2(ex, method=median, na.rm=TRUE) # both return Scale2(ex, method="median", na.rm=TRUE) # the

Re: [R] how to know where you've been sourced from

2012-09-26 Thread Duncan Murdoch
On 26/09/2012 2:39 PM, Alexander Shenkin wrote: Hello All, I need a script to perform different actions depending on the file from which it was source()'d. Thus, my script needs a way to figure out from whence it was sourced. There seems to be some relevant information in sys.calls() (see belo

Re: [R] rows extraction

2012-09-26 Thread David Winsemius
On Sep 26, 2012, at 8:28 AM, David L Carlson wrote: >> subtest <- subset(test, Name. %in% c("PKB123", "PKB22", "PKB23", "PKB32", > "CTV19", "CTV20", "PKB11", "PKB11")) >> subtest >Name. Score performance Environment. > 10 CTV19 2 0.52740797 0.53639048 > 11 CTV20 3 0.05

[R] how to know where you've been sourced from

2012-09-26 Thread Alexander Shenkin
Hello All, I need a script to perform different actions depending on the file from which it was source()'d. Thus, my script needs a way to figure out from whence it was sourced. There seems to be some relevant information in sys.calls() (see below). However, I need to get at the name of the fil

Re: [R] Help with R invoking

2012-09-26 Thread Duncan Murdoch
On 26/09/2012 11:03 AM, Li, Jianying (NIH/NIEHS) [C] wrote: Hi, I encountered a very strange error with R (2.14.1). I tried to build an R package and eventually worked (passing all the checks etc.). Then, I tried this command "R CMD INSTALL --binary pkg", which supposedly "installs and produce

Re: [R] specifying arguments in functions and calling functions, within functions

2012-09-26 Thread Sarah Goslee
Hi, You have some basic confusion here, and a problem likely caused by an object named scl that exists in your global environment. On Wed, Sep 26, 2012 at 11:56 AM, K. Brand wrote: > Esteemed R UseRs, > > Regarding specifying arguments in functions and calling functions > within functions: > > #

[R] lme(y ~ ns(x, df=splineDF)) error

2012-09-26 Thread Jacob Wegelin
I would like to fit regression models of the form y ~ ns(x, df=splineDF) where splineDF is passed as an argument to a wrapper function. This works fine if the regression function is lm(). But with lme(), I get two different errors, depending on how I handle splineDF inside the wrapper function

[R] Specifying a response variable in a Bayesian network

2012-09-26 Thread Abraham Mathew
I'm trying to teach myself about Bayesian Networks and am working with the following data and the bnlearn package. I understand the conceptual aspects of BNs, but I'm not sure how to specify the response variables in R when constructing a dag plot. I've cecked ?hc and done numerous google searches

[R] Create an error logging text file

2012-09-26 Thread Sam Sturge
Hi, I am looking to run a script which calls other functions from other scripts. Such as in script 1 I may have function f1 which then calls functions f2, f3, f4 which are found in script 3 and then f4 also calls function f6 which can be found in script 3 etc. What I am looking to do is to create

Re: [R] factor expansion

2012-09-26 Thread Jose Bustos Melo
Thank you PIKAL Petr, This is used when you have a big data base of a national sample. So, this factor is a variable that uses the sample in order to obtain information about all the people of the country.  Similar of getting a real approach about what's going on in the total population. I don'

[R] Submit a new script after all parallel jobs have completed

2012-09-26 Thread francesca casalino
Dear R experts, I have an R script that creates multiple scripts and submits these simultaneously to a computer cluster, and after all of the multiple scripts have completed and the output has been written in the respective folders, I would like to automatically launch another R script that works

[R] Help with R invoking

2012-09-26 Thread Li, Jianying (NIH/NIEHS) [C]
Hi, I encountered a very strange error with R (2.14.1). I tried to build an R package and eventually worked (passing all the checks etc.). Then, I tried this command "R CMD INSTALL --binary pkg", which supposedly "installs and produce a binary source archive (*.zip) for use on Windows only."

[R] averageif and looping

2012-09-26 Thread Eko andryanto Prakasa
 haiii i want to know, is there any script in R to measure looping averageif (like in the excel) ... for example: i have a vector rowvalue 10 22 3-3 4-2 51 6-2 i want to measure the average of the vector for negative value with window esti

[R] Reading multiple files

2012-09-26 Thread Silvano Cesar da Costa
Hi, I have 35 data files for reading. I would like get a program for performing reading of 35 files at once. All are of the type: Dados1.raw, Dados2.raw and so on. If the files have the same number of columns, I can read with the following commands: rm(list=ls()) filenames = list.files(path="~/S

Re: [R] map two names into one

2012-09-26 Thread arun
HI, Try this: vec1<-"GALAXY ACE S 5830" vec2<-"S 5830 GALAXY ACE" vec3<-"R GALAXY 5812 ACE"  vec11<-paste(sort(unlist(strsplit(vec2," "))),collapse="_")  vec22<-paste(sort(unlist(strsplit(vec2," "))),collapse="_")  vec11 #[1] "5830_ACE_GALAXY_S"  vec22 #[1] "5830_ACE_GALAXY_S"  identical(vec11,

[R] Removing duplicates without a for loop

2012-09-26 Thread wwreith
I have several thousand rows of shipment data imported into R as a data frame, with two columns of particular interest, col 1 is the entry date, and col 2 is the tracking number (colname is REQ.NR). Tracking numbers should be unique but on occassion aren't because they get entered more than once.

[R] specifying arguments in functions and calling functions, within functions

2012-09-26 Thread K. Brand
Esteemed R UseRs, Regarding specifying arguments in functions and calling functions within functions: ## beginning ## ## some data ex <- rnorm(10) ex[5] <- NA ## example function Scale <- function(x, method=c("mean", "median")) { scl <- method scl(x) } ## both return NA Scale(ex, method=m

Re: [R] rows extraction

2012-09-26 Thread Jeff Newmiller
You need to use the match function if you want to specify result sort order or duplication. test[ match(c( "PKB123", "PKB22", "PKB23","PKB32", "CTV19", "CTV20", "PKB11", "PKB11" ),test$Name.), ] --- Jeff Newmiller

Re: [R] Latitude Longitude to SPDF

2012-09-26 Thread John Kane
I think I know considerably less than you do but have a look as the sp package. I think you are referring to and object type SpatialPolygonsDataFrame" from the package sp or which that package will produce. Good luck. Now to install rgdal. John Kane Kingston ON Canada > -Original Mes

Re: [R] boxplot of different colors

2012-09-26 Thread John Kane
Shamelessly stealling Richard Heiberger's data set I'd suggest another way using ggplot2 which you would need to install library(ggplot2) dataN <- data.frame(GE_distance=rnorm(260), Diet_B=factor(rep(1:13, each=20))) p <- ggplot(dataN , aes(Diet_B, GE_distance, colour = Di

Re: [R] Retrieve regression summary results after rq

2012-09-26 Thread John Kane
Strange, I have never used it but presumably you are using the package ‘survey’? The manual suggests summary(xx) should work. What results or error messages do you get? John Kane Kingston ON Canada > -Original Message- > From: cacamende...@gmail.com > Sent: Wed, 26 Sep 2012 12:39:46

Re: [R] Retrieve regression summary results after rq

2012-09-26 Thread Camila Mendes
This does not work at all... On Wed, Sep 26, 2012 at 12:04 PM, John Kane wrote: > summary(fit1) perhaps/ > > John Kane > Kingston ON Canada > > >> -Original Message- >> From: cacamende...@gmail.com >> Sent: Wed, 26 Sep 2012 11:39:30 -0300 >> To: r-help@r-project.org >> Subject: [R] Retrie

Re: [R] geom_line: How to plot two data sets having different maximum X-axis values in a single plot?

2012-09-26 Thread John Kane
Clumsy but this should do it. aa$set <- rep("a", length(aa$position)) bb$set <- rep("b", length(bb$position)) (mydata <- rbind(aa,bb)) p <- ggplot( mydata , aes( position, count, colour = set )) + geom_line() p John Kane Kingston ON Canada > -Original Message- > From: jim

Re: [R] rows extraction

2012-09-26 Thread David L Carlson
> subtest <- subset(test, Name. %in% c("PKB123", "PKB22", "PKB23", "PKB32", "CTV19", "CTV20", "PKB11", "PKB11")) > subtest Name. Score performance Environment. 10 CTV19 2 0.52740797 0.53639048 11 CTV20 3 0.05298615 0.04856818 12 PKB11 4 0.90037809 0.79427806 1

Re: [R] Retrieve regression summary results after rq

2012-09-26 Thread John Kane
summary(fit1) perhaps/ John Kane Kingston ON Canada > -Original Message- > From: cacamende...@gmail.com > Sent: Wed, 26 Sep 2012 11:39:30 -0300 > To: r-help@r-project.org > Subject: [R] Retrieve regression summary results after rq > > Hi all, > > I am using quantile regression with svy

Re: [R] Plotting of regsubsets adjr2 values not correct

2012-09-26 Thread Greg Snow
Does your dataset have any missing data? (without a reproducible example we can only guess). If it does then you may be fitting the same model to different subsets of the data between the 2 methods. On Tue, Sep 25, 2012 at 9:03 AM, Maximilian Lklweryc wrote: > Hi, > I want to make model selectio

Re: [R] Interaction scatterplots in ggplot with multiple regression lines

2012-09-26 Thread John Kane
Some like this help? mydata$modnew <- cut(mydata$moderator, 7) ggplot(mydata, aes(x=predictor, y=outcome, color=modnew)) + geom_point() + stat_smooth(method=lm, se=TRUE, fullrange=T) John Kane Kingston ON Canada > -Original Message- > From: dadr...@gmail.com > Sent: Wed, 26 Sep 2012

[R] Retrieve regression summary results after rq

2012-09-26 Thread Camila Mendes
Hi all, I am using quantile regression with svy design. I want to retrieve summary regression statistics (std error, p-value), since I don't have any in my output: Commands: clus1_d<- svydesign(id=~cd002_co, weights=~wtper, strata=~str, data=data) bclus1<-as.svrepdesign(clus1_d,type="bootstrap",

Re: [R] RCURL ftp upload - ASCII or Binary type?

2012-09-26 Thread Ben Tupper
Hi, On Sep 26, 2012, at 8:07 AM, Magnus Eriksson wrote: > I'm trying to upload a file using RCURL:s ftpUpload() to a ftp-server using > the following command: > >> ftpUpload("'VERY.ODD.FILE.NAME(+1)'",to="ftp://x.x.x.x/",";' >> VERY.ODD.FILE.NAME(+1)'",userpwd="USER:PASSWORD") > OK > 0 > > T

Re: [R] gbinom function

2012-09-26 Thread Berend Hasselman
I have forwarded your message to the R-help list. You should also send your replies to the R-help list and not just to the person(s) who replied. Berend On 26-09-2012, at 15:44, Kizito Omala wrote: > Hello Berend, > > I got the code from google, pasted in the script editor run it and all is

[R] Interaction scatterplots in ggplot with multiple regression lines

2012-09-26 Thread Isaac Petersen
I'm trying to treat a continuous variable as discrete for plotting multiple regression lines in a scatterplot as a function of the level on the moderating variable. In the example below, there is only one regression line plotted to the whole data. I would like a separate regression line for each

Re: [R] calculation of diversity confidence interval

2012-09-26 Thread Jean V Adams
Mike, You could use bootstrapping. See for example the function boot() in pacakge boot. library(boot) ?boot Jean Michael Eisenring wrote on 09/25/2012 04:54:29 AM: > > Dear R-help members. > Maybe this is not the right platform to ask this, but I'm looking > desperately for a test which

Re: [R] gbinom function

2012-09-26 Thread Berend Hasselman
On 26-09-2012, at 13:24, Kizito Omala wrote: > Dear all, > > I have just downloaded a package 'prob' and also loaded it using > library(prob). Whereas function 'tosscoin' works very well the other > functions like 'gbinom' for graphing density functions does not work. > I get the message: > >

Re: [R] average environmental data if AnimalID and Time is duplicated

2012-09-26 Thread Tagmarie
Thank you! Am 26.09.2012 13:31, schrieb Jim Lemon [via R]: > On 09/26/2012 08:53 PM, Tagmarie wrote: > > > Hello, > > I tried for about three hours now to solve this problem but I can't > figure > > it out. I am sure someone knows how do it. At least I hope so. > > > > I have a data frame somewha

Re: [R] create new column in a DF according to values from another column

2012-09-26 Thread arun
HI, Try this:  DF$Station[DF$number%in%c(1,7,11,16)]<-"V1"  DF$Station[DF$number%in%c(4,14,20)]<-"V2"  DF$Station[DF$number%in%c(3,17,19)]<-"V3"  DF #   number data Station #1   1    1  V1 #2   4    2  V2 #3   7    3  V1 #4   3    4  V3 #5  11    5  V1 #6

[R] RCURL ftp upload - ASCII or Binary type?

2012-09-26 Thread Magnus Eriksson
I'm trying to upload a file using RCURL:s ftpUpload() to a ftp-server using the following command: > ftpUpload("'VERY.ODD.FILE.NAME(+1)'",to="ftp://x.x.x.x/",";' > VERY.ODD.FILE.NAME(+1)'",userpwd="USER:PASSWORD") OK 0 The file I'm trying to upload is a very simple text-file but with a bit we

Re: [R] average environmental data if AnimalID and Time is duplicated

2012-09-26 Thread arun
HI, Just to add to Jim's solution with data.table() myframe<- data.frame (ID=c("Ernie", "Ernie", "Bert", "Bert"),  Timestamp=c("24.09.2012 09:00", "24.09.2012 09:00", "24.09.2012 10:00",  "25.09.2012 10:00"), Hunger=c("1","5","2","2"), Temp=c("25","30","27","28")  ) library(data.table) myframe1<

Re: [R] create new column in a DF according to values from another column

2012-09-26 Thread Rui Barradas
Hello, 'if' is not vectorized, it only uses the first value of the multiple condition. 'ifelse' is vectorized and in your case use nested ifelses. DF <- data.frame(number=c(1,4,7,3,11,16,14,17,20,19),data=c(1:10)) v1 <- c(1,7,11,16) v2 <- c(4,14,20) v3 <- c(3,17,19) DF$Station <- ifelse(DF$n

[R] gbinom function

2012-09-26 Thread Kizito Omala
Dear all, I have just downloaded a package 'prob' and also loaded it using library(prob). Whereas function 'tosscoin' works very well the other functions like 'gbinom' for graphing density functions does not work. I get the message: > gbinom(20,0.3) Error: could not find function "gbinom" How d

[R] Jointly distributed random variables in R

2012-09-26 Thread Kizito Omala
Dear all, is there a specific package and reference book for plotting Jointly distributed random variables? Kindly help. Kizito. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://

Re: [R] create new column in a DF according to values from another column

2012-09-26 Thread jeff6868
Yes this is it! Thank you for your help Berend! -- View this message in context: http://r.789695.n4.nabble.com/create-new-column-in-a-DF-according-to-values-from-another-column-tp4644217p4644225.html Sent from the R help mailing list archive at Nabble.com.

[R] RV: problems for making grids from lmer models

2012-09-26 Thread MARIA OLGA VIEDMA SILLERO
Dear colleagues: I am working with binary mixed models using lme4 package and everything works fine until I try to spatialize the fitted models using grids predictors. I have used the "predict" function from RASTER package and the RSAGA functionalities, but always I have the same error: "Error

Re: [R] Extrapolating Cox predicted risk

2012-09-26 Thread Terry Therneau
On 09/26/2012 05:00 AM, r-help-requ...@r-project.org wrote: I generated predicted risk of death for each subject in the study by means of Cox proportional hazards model at 8 year of follow-up, a time point at which follow-up was more than 90% complete. It is possible to extrapolate to 10-year t

Re: [R] Change in order of names after applying "plyr" package

2012-09-26 Thread jim holtman
Here is one of the places that you need a 'factor' to create the ordering you want; notice the statement that I added: > equity_data = data.frame(security_id = c("Air", "Air", "Air", "Air" + , "Air", "Air", "Air", "Air", "Air", "Air", "Air", "Air", "AB" + , "AB", "AB", "AB", "AB",

Re: [R] create new column in a DF according to values from another column

2012-09-26 Thread jim holtman
Here is another technique to use, especially if you have a long list of replacement values: > DF <- data.frame(number=c(1,4,7,3,11,16,14,17,20,19),data=c(1:10)) > > # create a list of replacement values; if you have a lot and > # you can create them automagically, then it is easier > replace <- l

Re: [R] average environmental data if AnimalID and Time is duplicated

2012-09-26 Thread Rui Barradas
Hello, Why do you have Hunger and Temp recorded as characters? Between double quotes? myframe <- data.frame (ID=c("Ernie", "Ernie", "Bert", "Bert"), Timestamp=c("24.09.2012 09:00", "24.09.2012 09:00", "24.09.2012 10:00", "25.09.2012 10:00"), Hunger=c("1","5","2","2"), Temp=c("25","30","27","2

Re: [R] Creating x*y different contigency tables

2012-09-26 Thread Berend Hasselman
On 26-09-2012, at 09:59, Loukia Spineli wrote: > Dear all, > > I am trying to construct 25x31 different matrices of 2x2 dimension. Here > is the problem: > > we have the following matrix > matrix(c(54+s0, > 43+s1, 56-s0, 67-s1), nrow=2, nc

Re: [R] Running different Regressions using for loops

2012-09-26 Thread Rui Barradas
Hello, Try the following. #cnames <- names(tryout) # in your code, use this one cnames <- c("Volume", "Price1", "Price2", "Price3", "Price4", "Price5", "Trend", "Seasonaliy") price <- cnames[grep("Price", cnames)] resp <- cnames[1] regr <- cnames[7:8] #lm.list <- vector("list", 5) for(i in 1

Re: [R] average environmental data if AnimalID and Time is duplicated

2012-09-26 Thread Jim Lemon
On 09/26/2012 08:53 PM, Tagmarie wrote: Hello, I tried for about three hours now to solve this problem but I can't figure it out. I am sure someone knows how do it. At least I hope so. I have a data frame somewhat like this: myframe<- data.frame (ID=c("Ernie", "Ernie", "Bert", "Bert"), Timestam

Re: [R] lattice dotplot reorder contiguous levels

2012-09-26 Thread Deepayan Sarkar
On Wed, Sep 26, 2012 at 3:36 PM, maxbre wrote: > sorry for my slow reply, this is what I worked out so far… > > my reproducible example and the code > > test<-structure(list(site = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 2L, > 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, > 3L, 3L, 3

Re: [R] create new column in a DF according to values from another column

2012-09-26 Thread Berend Hasselman
On 26-09-2012, at 12:49, jeff6868 wrote: > Hi everyone, > > I have a small problem in my R-code. > > Imagine this DF for example: > > DF <- data.frame(number=c(1,4,7,3,11,16,14,17,20,19),data=c(1:10)) > > I would like to add a new column "Station" in this DF. This new column must > be automa

[R] Change in order of names after applying "plyr" package

2012-09-26 Thread Vincy Pyne
Dear R helpers I have following two data.frames viz. equity_data and param. equity_data = data.frame(security_id = c("Air", "Air", "Air", "Air", "Air", "Air", "Air", "Air", "Air", "Air", "Air", "Air", "AB", "AB", "AB", "AB", "AB", "AB", "AB", "AB", "AB", "AB", "AB", "AB", "AD",  "AD", "AD", "AD

[R] average environmental data if AnimalID and Time is duplicated

2012-09-26 Thread Tagmarie
Hello, I tried for about three hours now to solve this problem but I can't figure it out. I am sure someone knows how do it. At least I hope so. I have a data frame somewhat like this: myframe <- data.frame (ID=c("Ernie", "Ernie", "Bert", "Bert"), Timestamp=c("24.09.2012 09:00", "24.09.2012 09:

Re: [R] add a data frame to my data frame

2012-09-26 Thread Tagmarie
Thanks to all of you. The three advices helped me a lot - solved my problem and thank you Sarah for the hint with rseek.org. Didn't know that one. Have a great day, Tagmarie -- View this message in context: http://r.789695.n4.nabble.com/add-a-data-frame-to-my-data-frame-tp4644122p4644206.htm

  1   2   >