[R] t.test of matching columns from two datasets using plyr

2014-08-12 Thread Felipe Carrillo
Hi, I Have two datasets df1 and df2 with 3 matching columns. I need to do a t.test of sp1, sp2 and sp3� and var1, var2 and var3 where the year, month and location match. I can do it with sapply or mapply but I want the end result to be a data.frame. I prefer to do it with plyr or dplyr as I have

[R] ddply question

2014-08-30 Thread Felipe Carrillo
I apologize about cross posting but my question keeps bouncing back from the list How come pct doesn't work in this ddply call? I am trying to get a percent of 'TotalCount' by SampleDate and Age library(plyr) b <- structure(list(SampleDate = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .La

[R] how to interpret t.test output

2008-08-09 Thread Felipe Carrillo
# Hi all: #I got a vector with fish lengths(mm) # Can someone help me interpret the output of # a t.test in plain english? # Based on the t.test below I can say that # I reject the null hypothesis because # the p-value is smaller than the the significance # leve

Re: [R] how to interpret t.test output

2008-08-09 Thread Felipe Carrillo
Hi Ted: Thanks for your prompt reply and explanation. That's what I was wondering, why would one need to test mu=0 ,which is the t.test default. But reading Peter Dalgaard's book and looking at some examples online, I saw t.test being used like that; t.test(datasetname) with no other arguments.

[R] how to interpret t.test output

2008-08-09 Thread Felipe Carrillo
I take it back, Peter Dalgaard's book uses t.test with mu=7725 and no mu=0. I got the script online. Hi Ted: Thanks for your prompt reply and explanation. That's what I was wondering, why would one need to test mu=0 ,which is the t.test default. But reading Peter Dalgaard's book and looking at

[R] detect if data is normal or skewed (without a boxplot)

2008-08-10 Thread Felipe Carrillo
Hello all: Is there a way to detect in R if a dataset is normally distributed or skewed without graphically seeing it? The reason I want to be able to do this is because I have developed and application with Visual Basic where Word,Access and Excel "talk" to each other and I want to integrate R

Re: [R] detect if data is normal or skewed (without a boxplot)

2008-08-11 Thread Felipe Carrillo
st) if(sf.test(fishlength)$p.value>0.05) t.test(fishlength) else wilcox.test(fishlength) Jim > Felipe Carrillo yahoo.com> > writes: > > > > > Hello all: > > Is there a way to detect in R if a dataset is normally > distributed or skewed > without graph

Re: [R] How do I plot a line followed by two forecast points?

2009-08-08 Thread Felipe Carrillo
Try this, it plots two points ahead based on the existing data of a month apart. # Sample dates xValues <- seq.Date(as.Date("1990-01-31"), to=as.Date("1992-12-31"), by="month") # Sample y value yValues <- seq(0.1, length=length(xValues)) mydf <- data.frame(xValues,yValues);mydf mydf[,1] li

Re: [R] ggplot and RExcel

2009-08-18 Thread Felipe Carrillo
Hi Elaine: I developed an application that includes MS Access,RExcel and R. It is all automated, RExcel conects to MS Access in the background and imports custom data, after performing some calculations, RExcel sends the data to R to perform further calculations and then R returns the final

Re: [R] ggplot2: mixing colour and linetype in geom_line

2009-09-09 Thread Felipe Carrillo
Is this what you want? x <- structure(list(Temp = c(25.9765, 26.57025, 27.164, 27.7565, 28.34892, 28.94142, 29.53125, 30.12233, 30.71483, 31.30983, 31.90233, 32.49475, 33.08458, 33.67575, 34.26558, 34.85933, 35.45183, 36.04683, 36.63933, 37.23042, 37.82417, 38.414), X22 = c(4.62e-12, 4.73e-12,

Re: [R] bar chart with means - using ggplot

2009-09-11 Thread Felipe Carrillo
Like this? # example using qplot library(ggplot2) meanprice <- tapply(diamonds$price, diamonds$cut, mean);meanprice cut <- factor(levels(diamonds$cut), levels = levels(diamonds$cut)) qplot(cut, meanprice, geom="bar", stat="identity", fill = I("grey50")) dev.new() # create a new graph to compare wi

Re: [R] Reading a data frame from R to excel

2009-09-15 Thread Felipe Carrillo
I use sep="\t" for Excel files and sep="," for csv files. # Save to Excel write.table(objectname, file = "C:/Documents andSettings/Desktop/myfile.xls",sep="\t") Felipe D. Carrillo Supervisory Fishery Biologist Department of the Interior US Fish & Wildlife Service California, USA --- On

[R] ggplot2 X axis levels

2010-02-19 Thread Felipe Carrillo
Hi all: I've done this before with factors but can't figure how to do it with a continuous variable. I am trying to reorder the sequence of my weeks along the X axis. I want to start with week 27 to 52 and then 1 to 26. I guess I could use levels along with seq() but doesn't seem to work for me. Th

Re: [R] ggplot2 X axis levels

2010-02-24 Thread Felipe Carrillo
To: r-help@r-project.org > Sent: Sat, February 20, 2010 2:56:14 AM > Subject: Re: [R] ggplot2 X axis levels > > Felipe Carrillo wrote: > > Hi all: > I've done this > before with factors but can't figure how to do it with > a continuous > variable. I am

Re: [R] adding row ID numbers by group

2010-03-02 Thread Felipe Carrillo
Like this? group<- c(1,1,1,1,2,2,2,2,2,3,3,3,3,3,3) var2<- c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15) data<-data.frame(group, var2) data ddply(data,"group",transform,ID=1:length(group))   Felipe D. Carrillo Supervisory Fishery Biologist Department of the Interior US Fish & Wildlife Service California,

Re: [R] GGPlot 2 and odfweave

2009-07-24 Thread Felipe Carrillo
Hi John: Use print before qplot or ggplot. Something like this: <>= print(qplot(subscriber,data=TV09,geom="bar",fill=subscriber, xlab=NULL,ylab=NULL)+coord_flip()+ opts(legend.position="none")) @ Felipe D. Carrillo  Supervisory Fishery Biologist  Department of the Interior  US Fi

Re: [R] USGS stream flow data automatic download R

2009-07-30 Thread Felipe Carrillo
An Excel Web query will also do what you want. From an Excel Workbook create a web query and link it to the USGS website. You can schedule downloads or the query will download data up-to-date everytime the workbook is open. Felipe D. Carrillo Supervisory Fishery Biologist Department of the

Re: [R] Scatter Plot

2009-07-30 Thread Felipe Carrillo
Tri this for both, points and text.. library(ggplot2) qplot(x=1:5,y=1:5) + geom_text(label=1:5) Felipe D. Carrillo Supervisory Fishery Biologist Department of the Interior US Fish & Wildlife Service California, USA --- On Thu, 7/30/09, amna khan wrote: > From: amna khan > Subject: [

Re: [R] making scatter plot points fill semi-transparent

2009-08-06 Thread Felipe Carrillo
You can also use ggplot2: library(ggplot2) x <- rnorm(1);y <- rnorm(x);myplot <- data.frame(x,y) qplot(x,y,data= myplot,colour=I(alpha("blue",1/25))) Felipe D. Carrillo Supervisory Fishery Biologist Department of the Interior US Fish & Wildlife Service California, USA --- On Wed, 8

[R] ggplot2-ddply question

2009-08-07 Thread Felipe Carrillo
Hi all: I am trying to use the ddply function to estimate the mean of 'Total','Fry','Smolt' and 'Fry.Eq' columns without success. I have the dput of my dataset below. I wonder if someone can give me a hand with this function. # dput(winter) winter <-structure(list(IDDate = structure(c(37L, 48L,

Re: [R] ggplot2-ddply question

2009-08-07 Thread Felipe Carrillo
> On Aug 7, 2009, at 3:36 PM, Felipe Carrillo wrote: > > > Hi all: > > I am trying to use the ddply function to estimate the > mean of 'Total','Fry','Smolt' and 'Fry.Eq' columns without > success. I have the dput of my dataset be

Re: [R] data.frame and ddply

2010-04-16 Thread Felipe Carrillo
You can do something like this after the output from opfut opfut <- data.frame(opfut$CONTRAT,opfut$POSITION,opfut$SETTLEMENT) names(opfut) <- c('CONTRAT','POSITION','SETTLEMENT') opfut   Felipe D. Carrillo Supervisory Fishery Biologist Department of the Interior US Fish & Wildlife Service Californi

[R] how to lmport this dataframe into R

2010-04-24 Thread Felipe Carrillo
Hi: I need help with a dataframe(see pic attached). is a mix of dates and text. I want to create a table either using latex function from hmisc or xtable. I already know how to do this but the problem is getting the dataframe into R. I don't have a reproducible example but I am hoping that the pic

[R] how to import a dataframe with mixed text and numbers

2010-04-24 Thread Felipe Carrillo
Hi: I need help with a dataframe. is a mix of dates and text. I want to create a table either using latex function from hmisc or xtable. I already know how to do this but the problem is getting the dataframe into R. I don't have a reproducible example . If someone is interested in helping with thi

[R] replace question mark with a dash

2010-04-25 Thread Felipe Carrillo
Hi: I have the following dataset in R( thanks Gabor for your help) but now the problem is that all the dashes are converted to questions marks ("?") I am trying to get the dashes back using: mydf <- data.frame(lapply(mydf,function(x) replace(mydf,"?"(x),"-"))) but isn't working. I also tried:

[R] results=hide?

2010-04-28 Thread Felipe Carrillo
Hi: I am using Sweave and texi2dvi to generate a LaTeX document but can't find the way to hide the graphics while the R chunks are being executed. I thought results=hide would do it but that't not the case. If I do: \begin{figure}[h] <>= a < rnorm(1000) plot(a) @ \caption{Weekly estimates.} \label

[R] Sweave question

2010-04-28 Thread Felipe Carrillo
Hi: I am using Sweave and texi2dvi to generate a LaTeX document but can't find the way to hide the graphics while the R chunks are being executed. I thought results=hide would do it but that't not the case. If I do: \begin{figure}[h] <>= a < rnorm(1000) plot(a) @ \caption{Weekly estimates.} \label

Re: [R] Sweave question

2010-04-29 Thread Felipe Carrillo
ice California, USA - Original Message > From: Duncan Murdoch > To: Felipe Carrillo > Cc: r-h...@stat.math.ethz.ch > Sent: Thu, April 29, 2010 4:12:58 AM > Subject: Re: [R] Sweave question > > On 28/04/2010 11:31 PM, Felipe Carrillo wrote: > Hi: > I am using > Swe

Re: [R] Question re: interpolation

2010-05-02 Thread Felipe Carrillo
Are you looking for something like this? data <- data.frame(first= c(1,2,3,4,5,6,7,8), zehn = c(15,NA,NA,NA,NA,18,NA,25), second = c(4,NA,7,9,NA,10.2,NA,12),     third= c(6,7,NA,NA,10,12,NA,16))   data     library(zoo)     data2 <-na.approx(data,na.rm=F)     data2 ?na.approx   Felipe D. Carri

[R] How to download from github

2009-09-24 Thread Felipe Carrillo
Hi: Is my first attempt to try to download from github. Nothing happens by clicking on the 'download' button. Could anyone give me a hint on how to get all the files from the link below? Thanks http://github.com/hadley/ggplot2-bayarea/tree/0a8bf71dea38cfbf2d928eb713d24dfd928359fc Felipe D.

Re: [R] How to download from github

2009-09-25 Thread Felipe Carrillo
e: > From: Charlie Sharpsteen > Subject: Re: [R] How to download from github > To: "Felipe Carrillo" > Cc: r-help@r-project.org > Date: Thursday, September 24, 2009, 9:06 PM > Hmm, clicking on the 'Download' > button and then on either the 'TAR&#

Re: [R] How to download from github

2009-09-25 Thread Felipe Carrillo
Henrique: It worked nicely, I am using IE 6.0. Thanks a lot for your help --- On Fri, 9/25/09, Henrique Dallazuanna wrote: > From: Henrique Dallazuanna > Subject: Re: [R] How to download from github > To: "Felipe Carrillo" > Cc: "Charlie Sharpsteen" , r-h

Re: [R] Apply R in Excel through RExcel

2009-10-05 Thread Felipe Carrillo
ryusuke: It sounds like you need to have (D)COM server to be able to work on the background. As for the foreground, rcom is what you need and it appears to be working OK. I am out of my office right now but I'll back to work next week and I will be able to explain in more detail how the applicat

Re: [R] Placing text in a ggplot

2009-10-10 Thread Felipe Carrillo
John: The 'year' dataset has 366 rows, I used the 'line.count' without the '1' to come up with 12 rows to match the mlabs and then used line.count to draw the labels. Is this close to what you want? line.count <- c(cumsum(as.vector((table(year$monthnum);line.count namposts <- line.count;namp

Re: [R] change order of bar plot categories

2009-10-14 Thread Felipe Carrillo
Is this what you want? temp<-c(rep("Low",2),rep("Medium",2),rep("High",2)) light<-rep(c("Dark","light"),3) avg<-dat.avg2[,3] # se<-dat.avg2[,4] dat.avg.temp<-data.frame(cbind(avg,se)) dat.avg.temp<-data.frame(cbind(temp,light,dat.avg.temp)) dat.plot<-qplot(light,avg, fill=factor(temp),data=dat.avg

Re: [R] two graphs 1 x-axis

2009-10-16 Thread Felipe Carrillo
You can use ggplot2. library(ggplot2) a<-c(1,2,3,4,5,6) b<-c(3,5,4,6,1,1) c<-c(1,1,1,1,1,1) dframe = data.frame(a,b,c);dframe melt.dframe <- melt(dframe, id= "a");melt.dframe qplot(a,value,data=melt.dframe) + facet_grid(variable~.,scales="free") Felipe D. Carrillo Supervisory Fishery Biologis

Re: [R] RODBC sqlSave does not append the records to a DB2 table

2009-10-17 Thread Felipe Carrillo
Elaine: Try this. It works for me using my own database. Perhaps you don't have admin rights. Good luck library(RODBC) myDB <- odbcConnectAccess("DB2.mdb",uid="admin",pwd="") sqlSave(myDB,se2,rownames=FALSE,append=TRUE) close(myDB) Felipe D. Carrillo Supervisory Fishery Biologist

[R] ggplot2-caption on graphics

2009-10-29 Thread Felipe Carrillo
Hi: I am trying to add some caption at the bottom of the graphic by using the 'xlab' and just adding a new line to it. Is there another way to do this or this is the correct way? Thanks library(ggplot2) library(effects) df <- data.frame( x = c(3, 1, 5), y = c(2, 4, 6), label = c("a","b","

Re: [R] yeroon.net/ggplot2 web application v0.11

2009-12-07 Thread Felipe Carrillo
Hi Jeroen: This is great for someone who is point and click oriented. Can this program be downloaded to be used offline or its just web based? My field crew usually take toughbooks to the field and since they don't know how to program it will be nice to make the graphics just by pointing and cli

Re: [R] simple data manipulation question

2009-12-10 Thread Felipe Carrillo
Or like this: d = data.frame(gender=c("m","f","unkown"), x=rnorm(300)) ddply(d,"gender",summarise,mean=mean(x)) Felipe D. Carrillo Supervisory Fishery Biologist Department of the Interior US Fish & Wildlife Service California, USA --- On Thu, 12/10/09, smu wrote: > From: smu > Subje

[R] sqlSave()

2009-05-09 Thread Felipe Carrillo
Hi all: I have created a MS Access table named 'PredictedValues' through the statement below: myDB <- odbcConnectAccess("C:/Documents and Settings/Owner/Desktop/Rpond Farming.mdb",uid="admin",pwd="") sqlSave(myDB,PredictedValues,rownames=FALSE) close(myDB) But if I run the code again

[R] sqlSave()

2009-05-09 Thread Felipe Carrillo
Sorry, I'am resending it because I forgot to send my system info(below) Hi all: I have created a MS Access table named 'PredictedValues' through the statement below: myDB <- odbcConnectAccess("C:/Documents and Settings/Owner/Desktop/Rpond Farming.mdb",uid="admin",pwd="") sqlSave(myDB,Predi

[R] ggplot2 legend

2009-05-28 Thread Felipe Carrillo
Hi: I need some help with the legend. I got 14 samples(Muestreo) and I am trying to plot a smooth line for each sample. I am able to accomplish that but the problem is that the legend only displays every other sample. How can I force the legend to show all of my Muestreos? Thanks in advance.

Re: [R] ggplot2 legend

2009-05-28 Thread Felipe Carrillo
Thanks for your help Mike, it works like a charm now!! --- On Thu, 5/28/09, Mike Lawrence wrote: > From: Mike Lawrence > Subject: Re: [R] ggplot2 legend > To: "Felipe Carrillo" > Cc: r-h...@stat.math.ethz.ch > Date: Thursday, May 28, 2009, 1:06 PM > First, your e

[R] Can I Compile R with MS Access 2003 Developer Extensions?

2009-05-31 Thread Felipe Carrillo
Hi: I have an application that uses MS Access as front end interacting with Excel,Word,Sigmaplot and R in the background. I use the programs to do different tasks but I mainly use R to create graphics on my Access forms without having to manually open R. To make this short, I was wondering if R

[R] Can I Compile R with MS Access 2003 Developer Extensions?

2009-05-31 Thread Felipe Carrillo
Hi: I have an application that uses MS Access as front end interacting with Excel,Word,Sigmaplot and R in the background. I use the programs to do different tasks but I mainly use R to create graphics on my Access forms without having to manually open R. To make this short, I was wondering if R

[R] ggplot2-legend overlaps with strip

2009-06-02 Thread Felipe Carrillo
Hi: See the attached pdf graphic. The legend overlaps a little bit with the strip. Is there a way to move it over a half a cm? Felipe D. Carrillo Supervisory Fishery Biologist Department of the Interior US Fish & Wildlife Service California, USA Europe.pdf Description: Adobe PD

[R] legend problem

2009-06-03 Thread Felipe Carrillo
Hi: See the attached pdf graphic. The legend overlaps a little bit with the strip. Is there a way to move it over half a cm? Felipe D. Carrillo Supervisory Fishery Biologist Department of the Interior US Fish & Wildlife Service California, USA Europe.pdf Description: Adobe PDF d

[R] ggplot2-geom_text()

2009-03-30 Thread Felipe Carrillo
Hi: I need help with geom_text(). I would like to count the number of Locations and put the sum of it right above each bar. x <- "Location Lake_dens Fish Pred Lake1 1.132 1 0.115 Lake1 0.627 1 0.148 Lake1 1.324 1 0.104 Lake1 1.265

Re: [R] ggplot2-geom_text()

2009-03-30 Thread Felipe Carrillo
com > Cc: r-h...@stat.math.ethz.ch > Date: Monday, March 30, 2009, 2:46 PM > Hi > > > Felipe Carrillo wrote: > > Hi: I need help with geom_text(). > > I would like to count the number of Locations > > and put the sum of it right above each bar. > &g

Re: [R] two monitors

2009-03-30 Thread Felipe Carrillo
Hi: I use two monitors and I didn't have to do nothing to do what you want done. Try to print an R graph then drag it to the second screen. If that doesn't work, you may need to go to your settings and identify screen one and screen two from the dialog box. Good luck Felipe D. Carrillo Super

Re: [R] help with ggplot2 -- ggpoint function missing?

2009-04-02 Thread Felipe Carrillo
Did you load the package after installing it? install.packages("ggplot2") library(ggplot2) Felipe D. Carrillo Supervisory Fishery Biologist Department of the Interior US Fish & Wildlife Service California, USA --- On Wed, 4/1/09, haettulegur wrote: > From: haettulegur > Subject: [R]

[R] predicting values into the future

2009-04-04 Thread Felipe Carrillo
Hi: I have usually used the GROWTH() excel function to do this but now want to see if I can do this with R. I want to predict values into the future, possibly with the predict.arima Function. I have the following weekly fish weight averages: weight <- c("2.1","2.4","2.8","3.6","4.1","5.2","6.3

Re: [R] predicting values into the future

2009-04-05 Thread Felipe Carrillo
rame(week = seq(1, 10, len = 1000)) > with(lData, lines(week, predict(wModel, lData), col = > "blue")) > > Now that we have over-analysed this miniscule data set > to blazes, > perhaps it's time for a beer! > > __ > &g

Re: [R] predicting values into the future

2009-04-05 Thread Felipe Carrillo
Thank you Bill and Gabor: I do have a few years of fish sizes data (from larvae to juvenile). If I melt them together how can I create the best model to predict future weights. My weeks go up to 16 right now, but I want to predict weights for week 17 to 20. Based on both of you examples it was

[R] extract values from summary

2009-04-06 Thread Felipe Carrillo
Hi: # How can I extract the 'Forecasts' from the 'summary(predicted)' from the example below? library(forecast) weightData <- data.frame(weight = c(2.1,2.4,2.8,3.6,4.1,5.2,6.3),week= 1:7) weight <- as.numeric(weightData$weight) predicted <- forecast(weight,h=3,level=95) # see the predicted sum

Re: [R] Mischief on legend when size=1 added to geom_line

2009-04-17 Thread Felipe Carrillo
Hi Arthur: # Just move size outside 'aes' like this: p <- ggplot(df1, aes(Year, PctProf, group = Group)) p + geom_line(aes(color = Group),size=1) # to make the background white just use the black and white theme: p <- ggplot(df1, aes(Year, PctProf, group = Group)) p + geom_line(aes(color = Group)

[R] RODBC inside MS Access Sub

2009-04-29 Thread Felipe Carrillo
HI: Is it possible to use the RODBC package within MS Access. I have been using from R but was just wondering if it could be used along with R(D)COM. Something like this: Dim dbs As DAO.Database Dim rst As DAO.Recordset Dim myApp As StatConnector Set myApp = New StatConnector myApp.GetErrorText

[R] odbcConnectAccess in Access sub

2009-04-30 Thread Felipe Carrillo
HI: Is it possible to use the RODBC package within MS Access. I have been using from R but was just wondering if it could be used along with R(D)COM. Something like this: Dim dbs As DAO.Database Dim rst As DAO.Recordset Dim myApp As StatConnector Set myApp = New StatConnector myApp.GetErrorText

[R] odbcConnectAccess function

2009-04-30 Thread Felipe Carrillo
HI: Is it possible to use the RODBC package within MS Access. I have been using from R but was just wondering if it could be used along with R(D)COM. Something like this: Dim dbs As DAO.Database Dim rst As DAO.Recordset Dim myApp As StatConnector Set myApp = New StatConnector myApp.GetErrorText

Re: [R] odbcConnectAccess function

2009-04-30 Thread Felipe Carrillo
nps.gov > Office (305) 224 - 4282 > Fax (305) 224 - 4147 > > > > > Felipe Carrillo > > > ahoo.com> >To >

Re: [R] median of grouped data

2010-01-27 Thread Felipe Carrillo
Like this? d = read.table(textConnection("ID PM adt_01 25.255 adt_01 225.36 adt_01 14.2325 adt_02 15 adt_02 12.3 adt_03 15.2 adt_03 148.3 adt_03 25.5 adt_03 14.25"),head=T) d d$PM <- as.numeric(d$PM) ddply(d,.(ID),numcolwise(median)) Felipe D. Carrillo Supervisory Fishery Biologist

Re: [R] how to read this data file into R?

2010-02-02 Thread Felipe Carrillo
Convert the file into a csv file( myfile.csv), delete some of the unwanted rows before importing into R. Save the file on your working directory and then import into R: x <- read.csv("myfile.csv") # Change column names names(x) <- LETTERS[1:ncol(x)];x Change your column names to whatever you w

Re: [R] how to read this data file into R?

2010-02-03 Thread Felipe Carrillo
That's strange because I was able to read the file into R just fine --- On Tue, 2/2/10, David Winsemius wrote: > From: David Winsemius > Subject: Re: [R] how to read this data file into R? > To: "Felipe Carrillo" > Cc: r-help@r-project.org, "song song"

Re: [R] diagnostic plots

2010-02-03 Thread Felipe Carrillo
Or just click on the "Enter" key to see the following graphic Felipe D. Carrillo Supervisory Fishery Biologist Department of the Interior US Fish & Wildlife Service California, USA --- On Wed, 2/3/10, jim holtman wrote: > From: jim holtman > Subject: Re: [R] diagnostic plots > To: "Tr

Re: [R] readJPEG function cannot open jpeg files

2013-01-14 Thread Felipe Carrillo
I have used the biOps package to read pictures and it works fine. For example you can plot a pic just by: library(biOps) x <- readJpeg("mypic.jpg")  ##mypic should be in you working directory plot(x) Notice that is only one uppercase letter on "readJpeg" and mypic is "jpg" not "jpeg" Felipe D.

Re: [R] Summary of data for each year

2013-02-01 Thread Felipe Carrillo
 Here is another option using plyr:   library(plyr) creek <- read.csv("creek.csv")  library(ggplot2)  creek[1:10,]  colnames(creek) <- c("date","flow")  creek$date <- as.Date(creek$date, "%m/%d/%Y")   ddply(creek,"year",summarise,MED=median(flow),MEAN=mean(flow),SD=sd(flow),MIN=min(flow)) Felipe D

Re: [R] print multiple plots to jpeg, one lattice and one ggplot2

2013-05-03 Thread Felipe Carrillo
Something like this? library(gridExtra) grid.arrange(one,two) Felipe D. Carrillo Supervisory Fishery Biologist Department of the Interior US Fish & Wildlife Service California, USA http://www.fws.gov/redbluff/rbdd_jsmp.aspx > >From: Christophe Bouffioux >To: "r-

Re: [R] mean of a value of the last 2 hours

2012-10-25 Thread Felipe Carrillo
Or using ddply from plyr,   library(plyr) myframe <- data.frame (ID=c("Ernie", "Ernie", "Ernie", "Bert", "Bert", "Bert"), Timestamp=c("24.09.2012 09:00", "24.09.2012 10:00", "24.09.2012 11:00"), Hunger=c(1,1,1,2,2,1) ) myframe myframestime <- as.POSIXct (strptime(as.character(myframe$Timestamp), "%

Re: [R] arrange data

2012-11-11 Thread Felipe Carrillo
Something like this...untested I think cbind recicles the last value(31) since nov and dec are of different length nov <- kuantan.dt[(kuantan.dt$Bulan >=11);nov dec <- kuantan.dt[(kuantan.dt$Bulan >=12);dec both <- cbind(nov,dec) # get the first 30 records both <- head(both,30);both Felipe D. Ca

Re: [R] arrange data

2012-11-12 Thread Felipe Carrillo
om: Roslina Zakaria >To: Felipe Carrillo >Sent: Sunday, November 11, 2012 10:56 PM >Subject: Re: [R] arrange data > > >Thank you so much Felipe, I'll try your suggestion. > > >From: Felipe Carrillo >To: Roslina Zakaria ; "r-help@r-project.org"

[R] simple subset question

2012-12-02 Thread Felipe Carrillo
 Hi, Consider the small dataset below, I want to subset by two variables in one line but it wont work...it works though if I subset separately. I have to be missing something obvious that I did not realize before while using subset.. fish <- structure(list(IDWeek = c(27L, 28L, 29L, 30L, 31L, 32L,

Re: [R] simple subset question

2012-12-02 Thread Felipe Carrillo
http://www.fws.gov/redbluff/rbdd_jsmp.aspx From: R. Michael Weylandt >To: Felipe Carrillo >Cc: "r-help@r-project.org" >Sent: Sunday, December 2, 2012 9:42 AM >Subject: Re: [R] simple subset question > >On Sun, Dec 2, 2012 at 5:21 PM, Felipe Carrillo > wrote: >> 

Re: [R] simple subset question

2012-12-02 Thread Felipe Carrillo
USA http://www.fws.gov/redbluff/rbdd_jsmp.aspx From: arun >To: Felipe Carrillo >Cc: R help ; R. Michael Weylandt > >Sent: Sunday, December 2, 2012 10:29 AM >Subject: Re: [R] simple subset question > >Hi, >I am getting this: >x<-subset(fish,Year==2012 & Tota

Re: [R] simple subset question

2012-12-02 Thread Felipe Carrillo
ks for your help and will try to figure out why subset returns an empty row Felipe D. Carrillo Supervisory Fishery Biologist Department of the Interior US Fish & Wildlife Service California, USA http://www.fws.gov/redbluff/rbdd_jsmp.aspx From: William Dunlap >To: Felipe Carrillo ; arun &

Re: [R] simple subset question

2012-12-02 Thread Felipe Carrillo
alifornia, USA http://www.fws.gov/redbluff/rbdd_jsmp.aspx From: David Winsemius >To: Felipe Carrillo >Cc: William Dunlap ; arun ; R help > >Sent: Sunday, December 2, 2012 11:54 AM >Subject: Re: [R] simple subset question > >The reason I suggested the alternative that I did was bec

Re: [R] simple subset question

2012-12-02 Thread Felipe Carrillo
oming in to the weeks of interest (weeks 45 to 52) and put a point on the 2012 max catch which is week 37     windows()   test + coord_cartesian(xlim=c(45,52)) + scale_x_continuous(breaks=c(45,47,49,51)) +   scale_y_continuous(limits=c(0,35)) + opts(title="Zooming in to weeks 45 to 52&q

Re: [R] simple subset question

2012-12-02 Thread Felipe Carrillo
or US Fish & Wildlife Service California, USA http://www.fws.gov/redbluff/rbdd_jsmp.aspx > >From: David L Carlson >To: 'Felipe Carrillo' ; 'arun' > >Cc: 'R help' >Sent: Sunday, December 2, 2012 2:54 PM >Su

Re: [R] Count cell Count by her frequency

2012-12-10 Thread Felipe Carrillo
And another way: library(plyr) ddply(dta,"A",summarise,B=length(B)) Felipe D. Carrillo Supervisory Fishery Biologist Department of the Interior US Fish & Wildlife Service California, USA http://www.fws.gov/redbluff/rbdd_jsmp.aspx From: David L Carlson >To: 'Mat' ; r-help@r-project.org >Sent: M

[R] save to file

2012-12-16 Thread Felipe Carrillo
 Hi, What's the equivalent of "Save to File" from the R console File menu on an R routine? Just trying to capture the whole R console into a text file when my code fails. Felipe D. Carrillo Supervisory Fishery Biologist Department of the Interior US Fish & Wildlife Service California, USA http

Re: [R] save to file

2012-12-16 Thread Felipe Carrillo
I did check that link but it doesn't do what I want..thanks for trying though. Felipe D. Carrillo Supervisory Fishery Biologist Department of the Interior US Fish & Wildlife Service California, USA http://www.fws.gov/redbluff/rbdd_jsmp.aspx From: arun >To: Felipe Carrillo &

Re: [R] save to file

2012-12-16 Thread Felipe Carrillo
  Would it work?  >The reason I am saying is that with 1000s of lines of code, this will be still >easier. >A.K. > > > > > > > >From: Felipe Carrillo >To: arun ; "r-h...@stat.math.ethz.ch" > >Sent: Sunday, Decembe

Re: [R] save to file

2012-12-17 Thread Felipe Carrillo
.gov/redbluff/rbdd_jsmp.aspx > >From: Vivek Singh >To: David Winsemius >Cc: Felipe Carrillo ; r-help help > >Sent: Sunday, December 16, 2012 11:35 PM >Subject: Re: [R] save to file > > >try the following. it works for linux: > >

[R] predicted values

2014-02-01 Thread Felipe Carrillo
Consider this dummy dataset. My real dataset with over 1000 records has scatter large and small values. I want to predict for values with NA but I get negative predictions. Is this a normal behaviour or I am missing a gam argument to force the model to predict positive values. library(mgcv) test <-

Re: [R] predicted values

2014-02-03 Thread Felipe Carrillo
ght forward 'force' the >model to be positive only. > >Best, > >Joshua > > > >On Sat, Feb 1, 2014 at 5:05 PM, Felipe Carrillo > wrote: >> Consider this dummy dataset. >> My real dataset with over 1000 records has >> scatter large and small value

Re: [R] Plotting Data on a Map

2010-06-23 Thread Felipe Carrillo
er fortify area_mod #Not sure how to proceed from here to fit the 'mod1' model to all #the 5 states.   > >From: Tom Hopper >To: Felipe Carrillo >Sent: Tue, June 22, 2010 9:40:19 PM >Subject: Re: Plotting Data on a Map > >Felipe, > > >I am just learning the

Re: [R] Plotting Data on a Map

2010-06-23 Thread Felipe Carrillo
For some reason the shapefile can't get attached. The shapefile is too large to put it in dput..Is there another way to do this? - Original Message > From: Felipe Carrillo > To: Tom Hopper > Cc: r-h...@stat.math.ethz.ch; ggpl...@googlegroups.com > Sent: Wed, June 23

[R] rgdal-maptools

2010-06-23 Thread Felipe Carrillo
The shapefile data can be downloaded from the link below: download all the six files and save them on your working directory and make sure the dsn path is set to where the files are saved. My shapefiles are saved on C:/Data. https://secure.filesanywhere.com/fs/v.aspx?v=897263875a6472a99baa Hi: I

[R] predict newdata question

2010-06-25 Thread Felipe Carrillo
Hi: I am using a subset of the below dataset to predict PRED_SUIT for the whole dataset but I am having trouble with 'newdata'. The model was created with 153 records and want to predict for 208 records. wolf2 <- structure(list(gridcell = c(367L, 444L, 533L, 587L, 598L, 609L, 620L, 629L, 641L, 6

Re: [R] predict newdata question

2010-06-25 Thread Felipe Carrillo
will > see two extra columns. -Original Message- From: > ymailto="mailto:r-help-boun...@r-project.org"; > href="mailto:r-help-boun...@r-project.org";>r-help-boun...@r-project.org > [mailto:> > href="mailto:r-help-boun...@r-project

Re: [R] predict newdata question

2010-06-26 Thread Felipe Carrillo
ilto:> href="mailto:> ymailto="mailto:r-help-boun...@r-project.org"; > href="mailto:r-help-boun...@r-project.org";>r-help-boun...@r-project.org">> > ymailto="mailto:r-help-boun...@r-project.org"; > href="mailto:r-hel

[R] R2wd- how to open an existing document

2010-07-06 Thread Felipe Carrillo
Hi: How can one open an existing word document with wdGet() I am getting an error message when trying to open it like this: wdGet(filename="myDoc.doc",path="c/mydata") Looking at Tal Galili's website example it appears that double backslashes are used but i tried it and didn't work either. Thanks

Re: [R] R2wd- how to open an existing document

2010-07-06 Thread Felipe Carrillo
he Interior US Fish & Wildlife Service California, USA - Original Message > From: Erik Iverson > To: Felipe Carrillo > Cc: r-h...@stat.math.ethz.ch > Sent: Tue, July 6, 2010 3:03:31 PM > Subject: Re: [R] R2wd- how to open an existing document > > Having no cl

[R] How to select the column header with \Sexpr{}

2010-07-12 Thread Felipe Carrillo
Hi: Since I work with a few different fish runs my column headers change everytime I start a new Year. I have been using \Sexpr{} for my row and columns and now I am trying to use with my report column headers. \Sexpr{1,1} is row 1 column 1, what can I use for headers? I tried \Sexpr{0,1} but swea

Re: [R] How to select the column header with \Sexpr{}

2010-07-12 Thread Felipe Carrillo
and so on, but I can't access my column headers with \Sexpr{} because I can't find the way to reference run1,run2,run3 and run4. Sorry if I am not explain myself really well.   - Original Message ---- > From: Duncan Murdoch > To: Felipe Carrillo > Cc: r-h...@stat.math.eth

Re: [R] How to select the column header with \Sexpr{}

2010-07-12 Thread Felipe Carrillo
p;890 (32 ? 47)&0 ( ? )&0 ( ? )\tabularnewline 2&3/13/2010&n (0 ? 0)&n (0 ? 0)&n (0 ? 0)&n (0 ? 0)&n (0 ? 0)\tabularnewline 3&3/14/2010&893 (110 ? 146)&337 (67 ? 74)&10,602 (32 ? 52)&0 ( ? )&0 ( ? )\tabularnewline 4&3/15/2010&140 (111 ? 150)&

Re: [R] How to select the column header with \Sexpr{}

2010-07-13 Thread Felipe Carrillo
(34 ? 66)"  $ Run4   : chr  "0 ( ? )" "n (0 ? 0)" "0 ( ? )" "0 ( ? )"  $ Run5   : chr  "0 ( ? )" "n (0 ? 0)" "0 ( ? )" "0 ( ? )"  names(report)[1]  # I can extract the column name here [1] "Date" But after

[R] Wrap column headers caption

2010-07-13 Thread Felipe Carrillo
Hi: Using this dataframe with quite long column headers, how can I wrap the text so that the columns are narrower. I was trying to use strwrap without success. Thanks reportDF <- structure(list(IDDate = c("3/12/2010", "3/13/2010", "3/14/2010", "3/15/2010"), FirstRunoftheYear = c("33 (119 ? 119)"

[R] latex table question

2010-07-13 Thread Felipe Carrillo
Hi: My head is spinning with this latex doc so hopefully after I align my tables to the left of the page my headache are going to be over. I always use: \hspace*{-0.1in} to move my figures horizontally to the left margin of the page but the table below doesn't move at all, but instead it gets sid

Re: [R] export tables to excel files on multiple sheets with titles for each table

2010-07-13 Thread Felipe Carrillo
Check the WriteXLS package, I think it does that and also saves each R object on a different excel sheet.   Felipe D. Carrillo Supervisory Fishery Biologist Department of the Interior US Fish & Wildlife Service California, USA - Original Message > From: eugen pircalabelu > To: R-help

  1   2   3   >