Re: [R] If Command in Plot
Thanks Arun. Have two way to solve the question now. Bhupendrasinh Thakre Sent from my Mac On Sep 22, 2012, at 11:52 PM, arun wrote: > HI, > I guess you want to plot with a subset of your data z1. > z1[with(z1,e>0),] > plot(y~x,data=z1[with(z1,e>0),]) > A.K. > > > > > > > - Original Message - > From: Bhupendrasinh Thakre > To: r-help > Cc: > Sent: Saturday, September 22, 2012 11:48 PM > Subject: [R] If Command in Plot > > Hi Team, > > I am trying to very simple plot with command plot. > > Question : I am trying to plot (x,y) based on the value of Column e. > If column e value is greater than 0 then plot(x,y) otherwise do not plot it. > > Data : > > structure(list(x = c(1, 1, 1, 2, 2, 2, 3, 3, 3), y = c(1, 2, > 3, 1, 2, 3, 1, 2, 3), e = c(0, -1, -2, 1, 0, -1, 2, 1, 0)), row.names = c(NA, > -9L), .Names = c("x", "y", "e"), class = "data.frame") > > System Info : > > R version 2.15.1 (2012-06-22) > Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit) > > locale: > [1] C/en_US.UTF-8/C/C/C/C > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > other attached packages: > [1] SemiPar_1.0-3MASS_7.3-18 nlme_3.1-104 > cluster_1.14.2 > [5] RSVGTipsDevice_1.0-4 maptools_0.8-16 lattice_0.20-6 > foreign_0.8-50 > [9] rgdal_0.7-18 sp_0.9-99 > > loaded via a namespace (and not attached): > [1] RCurl_1.91-1grid_2.15.1 tools_2.15.1twitteR_0.99.19 > > It's very simple but I am not able to plot it with following commands > > for (i in 1:9) {ifelse(z1$e[[i]] > 0 , plot(z1$x,z1$y),plot(z1$x,z1$e))} > Or > ifelse(z1$e > 0,plot(z1$x,z1$y),plot(z1$x,z1$e)) > > > Bhupendrasinh Thakre > > > > > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Creating multiple maps so points don't overlap
Not sure whether you are asking for individual map in form like interactive or pdf. However packages like rgdal, plotGoogleMaps might be helpful. It will be good if you can provide some data with the question. Best, Bhupendrasinh Thakre On Sep 22, 2012, at 5:38 PM, Tyler Petroelje wrote: > Hello, > > I am working within package 'maptools' to plot a number of collared animal > locations by reading in shapefiles of locations, roads, hydrology, and > landownership as imported layers. > > The trouble I have is that some individual locations are overlapping and I > would like to "zoom" into or create new plots for overlapping points/points > that are too close together. I will be making many of these maps, so I > would like to not have to manually select the limits for each area where > points are overlapping. > > I would be grateful for any information on how to code for a new plot to be > created or zoomed in upon when points are "x" close together. > > Thank you, > > - MIPP > > Please see image for visual explanation > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] If Command in Plot
Thanks Dr. Heiberger.. that solves my problem. Bhupendrasinh Thakre On Sep 22, 2012, at 10:58 PM, "Richard M. Heiberger" wrote: > Think matrix, not scalar. > > > tmp <- structure(list(x = c(1, 1, 1, 2, 2, 2, 3, 3, 3), y = c(1, 2, > + 3, 1, 2, 3, 1, 2, 3), e = c(0, -1, -2, 1, 0, -1, 2, 1, 0)), row.names = > c(NA, > + -9L), .Names = c("x", "y", "e"), class = "data.frame") > > > > tmp > x y e > 1 1 1 0 > 2 1 2 -1 > 3 1 3 -2 > 4 2 1 1 > 5 2 2 0 > 6 2 3 -1 > 7 3 1 2 > 8 3 2 1 > 9 3 3 0 > > plot( y ~ x, data=tmp, subset=(e>0) ) > > > > On Sat, Sep 22, 2012 at 11:48 PM, Bhupendrasinh Thakre > wrote: > Hi Team, > > I am trying to very simple plot with command plot. > > Question : I am trying to plot (x,y) based on the value of Column e. > If column e value is greater than 0 then plot(x,y) otherwise do not plot it. > > Data : > > structure(list(x = c(1, 1, 1, 2, 2, 2, 3, 3, 3), y = c(1, 2, > 3, 1, 2, 3, 1, 2, 3), e = c(0, -1, -2, 1, 0, -1, 2, 1, 0)), row.names = c(NA, > -9L), .Names = c("x", "y", "e"), class = "data.frame") > > System Info : > > R version 2.15.1 (2012-06-22) > Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit) > > locale: > [1] C/en_US.UTF-8/C/C/C/C > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > other attached packages: > [1] SemiPar_1.0-3MASS_7.3-18 nlme_3.1-104 > cluster_1.14.2 > [5] RSVGTipsDevice_1.0-4 maptools_0.8-16 lattice_0.20-6 > foreign_0.8-50 > [9] rgdal_0.7-18 sp_0.9-99 > > loaded via a namespace (and not attached): > [1] RCurl_1.91-1grid_2.15.1 tools_2.15.1twitteR_0.99.19 > > It's very simple but I am not able to plot it with following commands > > for (i in 1:9) {ifelse(z1$e[[i]] > 0 , plot(z1$x,z1$y),plot(z1$x,z1$e))} > Or > ifelse(z1$e > 0,plot(z1$x,z1$y),plot(z1$x,z1$e)) > > > Bhupendrasinh Thakre > > > > > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] If Command in Plot
Think matrix, not scalar. > tmp <- structure(list(x = c(1, 1, 1, 2, 2, 2, 3, 3, 3), y = c(1, 2, + 3, 1, 2, 3, 1, 2, 3), e = c(0, -1, -2, 1, 0, -1, 2, 1, 0)), row.names = c(NA, + -9L), .Names = c("x", "y", "e"), class = "data.frame") > > tmp x y e 1 1 1 0 2 1 2 -1 3 1 3 -2 4 2 1 1 5 2 2 0 6 2 3 -1 7 3 1 2 8 3 2 1 9 3 3 0 > plot( y ~ x, data=tmp, subset=(e>0) ) > On Sat, Sep 22, 2012 at 11:48 PM, Bhupendrasinh Thakre < vickytha...@gmail.com> wrote: > Hi Team, > > I am trying to very simple plot with command plot. > > Question : I am trying to plot (x,y) based on the value of Column e. > If column e value is greater than 0 then plot(x,y) otherwise do not plot > it. > > Data : > > structure(list(x = c(1, 1, 1, 2, 2, 2, 3, 3, 3), y = c(1, 2, > 3, 1, 2, 3, 1, 2, 3), e = c(0, -1, -2, 1, 0, -1, 2, 1, 0)), row.names = > c(NA, > -9L), .Names = c("x", "y", "e"), class = "data.frame") > > System Info : > > R version 2.15.1 (2012-06-22) > Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit) > > locale: > [1] C/en_US.UTF-8/C/C/C/C > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > other attached packages: > [1] SemiPar_1.0-3MASS_7.3-18 nlme_3.1-104 > cluster_1.14.2 > [5] RSVGTipsDevice_1.0-4 maptools_0.8-16 lattice_0.20-6 > foreign_0.8-50 > [9] rgdal_0.7-18 sp_0.9-99 > > loaded via a namespace (and not attached): > [1] RCurl_1.91-1grid_2.15.1 tools_2.15.1twitteR_0.99.19 > > It's very simple but I am not able to plot it with following commands > > for (i in 1:9) {ifelse(z1$e[[i]] > 0 , plot(z1$x,z1$y),plot(z1$x,z1$e))} > Or > ifelse(z1$e > 0,plot(z1$x,z1$y),plot(z1$x,z1$e)) > > > Bhupendrasinh Thakre > > > > > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] If Command in Plot
Hi Team, I am trying to very simple plot with command plot. Question : I am trying to plot (x,y) based on the value of Column e. If column e value is greater than 0 then plot(x,y) otherwise do not plot it. Data : structure(list(x = c(1, 1, 1, 2, 2, 2, 3, 3, 3), y = c(1, 2, 3, 1, 2, 3, 1, 2, 3), e = c(0, -1, -2, 1, 0, -1, 2, 1, 0)), row.names = c(NA, -9L), .Names = c("x", "y", "e"), class = "data.frame") System Info : R version 2.15.1 (2012-06-22) Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit) locale: [1] C/en_US.UTF-8/C/C/C/C attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] SemiPar_1.0-3MASS_7.3-18 nlme_3.1-104 cluster_1.14.2 [5] RSVGTipsDevice_1.0-4 maptools_0.8-16 lattice_0.20-6 foreign_0.8-50 [9] rgdal_0.7-18 sp_0.9-99 loaded via a namespace (and not attached): [1] RCurl_1.91-1grid_2.15.1 tools_2.15.1twitteR_0.99.19 It's very simple but I am not able to plot it with following commands for (i in 1:9) {ifelse(z1$e[[i]] > 0 , plot(z1$x,z1$y),plot(z1$x,z1$e))} Or ifelse(z1$e > 0,plot(z1$x,z1$y),plot(z1$x,z1$e)) Bhupendrasinh Thakre [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Creating multiple maps so points don't overlap
Hello, I am working within package 'maptools' to plot a number of collared animal locations by reading in shapefiles of locations, roads, hydrology, and landownership as imported layers. The trouble I have is that some individual locations are overlapping and I would like to "zoom" into or create new plots for overlapping points/points that are too close together. I will be making many of these maps, so I would like to not have to manually select the limits for each area where points are overlapping. I would be grateful for any information on how to code for a new plot to be created or zoomed in upon when points are "x" close together. Thank you, - MIPP Please see image for visual explanation [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] timeIsInterval function not found
hello i'm trying the script of gstat course of munich "Spatial and spacetime classes in R " in http://geostat-course.org/Topic_Bivand_2012 the code is follow ... but a in timeIsInterval(dts) the script failed the message is "timeIsInterval function not found" i'm updated R and package spacetime but has not worked any suggestions? thanks setwd("C:/Documents and Settings/bob/Documenti/tuesday") library(rgdal) dts0 <- c("19980401", "19980701", "19981001", "19990101") fn <- "_Gambia__the_Extract.tif" ndv_gambia <- readGDAL(paste("NDV_", dts0[1], fn, sep="")) for (i in dts0[2:4]) ndv_gambia <- cbind(ndv_gambia, readGDAL(paste("NDV_", i, fn, sep=""))) names(ndv_gambia) <- paste("ndv", dts0, sep="_") dts <- as.Date(dts0, "%Y%m%d") #dal testo della data tiri fuori la data vera e propria dims <- dim(ndv_gambia) #le dimesioni dello spatial griddtaframe tot celle X 4 strati ndvi ds <- slot(ndv_gambia, "data")#per estrarre il dataframe che sta sotto data@ ed è uno spatial grid dataframe ### ### code chunk number 23: tuesday_slidesB.Rnw:306-312 ### df <- reshape(ds, varying=list(1:4), v.names="ndv", direction="long", times=dts, ids=1:dims[1])#traspone le misure in colonne separate dello stesso record in misure ripeture in record diversi library(spacetime) timeIsInterval(dts) <- TRUE stNDVF <- STFDF(as(ndv_gambia, "SpatialPixels"), dts, df) library(RColorBrewer) Grns <- brewer.pal(7, "Greens") -- View this message in context: http://r.789695.n4.nabble.com/timeIsInterval-function-not-found-tp4643906.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] efficient overlapping average curve on original curves
Dear Arun, Rui and David, thankyou very much. i learnt alot from your replies. eliza botto > Date: Fri, 21 Sep 2012 18:58:18 -0700 > From: smartpink...@yahoo.com > To: ruipbarra...@sapo.pt > CC: r-help@r-project.org > Subject: Re: [R] efficient overlapping average curve on original curves > > HI, > > Modified version of ggplot() > library(ggplot2) > set.seed(1) > mat1<-melt(mat) > new1<-aggregate(mat1,list(mat1$X1),function(x) mean(x))[,4] > > mat2<-within(mat1,{X2<-as.factor(X2)}) > > ggplot(data=mat2,aes(x=X1,y=value,group=X2))+geom_line(aes(colour=X2))+geom_line(data=mat2,aes(y=new1),colour="darkred")+opts(legend.position="none") > > > A.K. > > > > - Original Message - > From: Rui Barradas > To: arun > Cc: eliza botto ; R help > Sent: Friday, September 21, 2012 9:18 PM > Subject: Re: [R] efficient overlapping average curve on original curves > > And with ggplot2. > > > library(ggplot2) > library(scales) > > dat <- data.frame(id = seq_len(nrow(mat)), mat) > dm <- reshape2::melt(dat, id = "id") > dm$variable <- as.ordered(dm$variable) > dm$avg <- rowMeans(mat) > > p <- ggplot(dm, aes(x = id, y = value, group = variable)) > p + geom_line(data = dm, colour = alpha("blue", 1/5)) + > geom_line(data = dm, aes(y = avg), colour = "darkblue") > > Rui Barradas > Em 22-09-2012 02:02, arun escreveu: > > HI, > > > > Similar graph in xyplot: > > set.seed(1) > > > > mat <- matrix(rnorm(100*37), ncol = 37) > > mat <- apply(mat, 2, cumsum) > > mat1<-melt(mat) > > > > > > library(latticeExtra) > > p0<-xyplot(value~X1,group=X2,data=mat1,type="l",ylab="mat1") > > p1<-xyplot(aggregate(mat1,list(mat1$X1),function(x) > > mean(x))[,4]~X1,data=mat1,type="l",col="black",lwd=2) > > p0+p1 > > > > A.K. > > > > > > > > - Original Message - > > From: Rui Barradas > > To: eliza botto > > Cc: "r-help@r-project.org" > > Sent: Friday, September 21, 2012 7:33 PM > > Subject: Re: [R] efficient overlapping average curve on original curves > > > > Hello, > > > > Something like this? > > > > > > # Make up some data > > mat <- matrix(rnorm(100*37), ncol = 37) > > mat <- apply(mat, 2, cumsum) > > avg <- rowMeans(mat) > > > > # matplot - matrix plot > > matplot(mat, type = "l") > > lines(avg, lwd = 2) > > > > > > I've also seen some very nice graphics for ploting many lines in ggplot2 > > using transparency in order to give a visual picture of where there are > > more lines. > > > > Hope this helps, > > > > Rui Barradas > > Em 22-09-2012 00:11, eliza botto escreveu: > >> Dear useRs, > >> > >> my question could be very basic for which i apologize in advance. > >> Each column of a matrix with dimensions 365 rows and 37 columns was drawn > >> against another matrix of dimensions 365 rows and 1 column. with that i > >> was able to draw 37 curves on the same axis. > >> now i want to draw an average curve of these 37 curves on the same axis in > >> such a way that all the curves (average and 37 curves) should appear on > >> the same axis at the same time. > >> i used > >> > >>> par(new=TRUE) > >> But it has 2 limitations > >> > >> 1- it completly distorted y-axis values > >> 2- it was not very efficient as average curve in no overlapped the > >> original curves. > >> > >> can any1 advise me what to do? > >> thanks in advance for you time. > >> > >> eliza botto > >> > >> > >> [[alternative HTML version deleted]] > >> > >> __ > >> R-help@r-project.org mailing list > >> https://stat.ethz.ch/mailman/listinfo/r-help > >> PLEASE do read the posting guide > >> http://www.R-project.org/posting-guide.html > >> and provide commented, minimal, self-contained, reproducible code. > > __ > > R-help@r-project.org mailing list > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > > and provide commented, minimal, self-contained, reproducible code. > > > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Decision Tree: Am I Missing Anything?
Vik, On Fri, Sep 21, 2012 at 12:42 PM, Vik Rubenfeld wrote: > Max, I installed C50. I have a question about the syntax. Per the C50 manual: > > ## Default S3 method: > C5.0(x, y, trials = 1, rules= FALSE, > weights = NULL, > control = C5.0Control(), > costs = NULL, ...) > > ## S3 method for class ’formula’ > C5.0(formula, data, weights, subset, > na.action = na.pass, ...) > > I believe I need the method for class 'formula'. But I don't yet see in the > manual how to tell C50 that I want to use that method. If I run: > > respLevel = read.csv("Resp Level Data.csv") > respLevelTree = C5.0(BRAND_NAME ~ PRI + PROM + REVW + MODE + FORM + FAMI + > DRRE + FREC + SPED, data = respLevel) > > ...I get an error message: > > Error in gsub(":", ".", x, fixed = TRUE) : > input string 18 is invalid in this locale You're not doing it wrong. Can you send me the results of sessionInfo()? I think there are a few issues with the function on windows, so a reproducible example would help solve the issue. -- Max __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Decision Tree: Am I Missing Anything?
My pleasure. As a part of R team we are always here to help each other. Best Regards, Bhupendrasinh Thakre Sent from my iPhone On Sep 22, 2012, at 1:46 PM, Vik Rubenfeld wrote: > Bhupendrashinh, thanks again for telling me about RWeka. That made a big > difference in a job I was working on this week. > > Have a great weekend. > > > -Vik __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Decision Tree: Am I Missing Anything?
Bhupendrashinh, thanks again for telling me about RWeka. That made a big difference in a job I was working on this week. Have a great weekend. -Vik __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to determine R version?
Thanks, Berend, that works. Cheers, Marius Berend Hasselman writes: > On 22-09-2012, at 19:32, Marius Hofert wrote: > >> Hi, >> >> What's the best approach to determine if a user uses an R version before >> 2.15.1 >> patched? >> I know that the sessionInfo() command provides details, but I'm not sure how >> the output of sessionInfo() is best used to determine R versions. This seems >> to >> work, but a) there is certainly a better way and b) I'm not sure where the >> "patched" will appear in the string. >> >> if(sessionInfo()$R.version$minor < "15.1") ... > > ?getRversion > > is an option > > Berend > __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to determine R version?
On 22-09-2012, at 19:32, Marius Hofert wrote: > Hi, > > What's the best approach to determine if a user uses an R version before > 2.15.1 > patched? > I know that the sessionInfo() command provides details, but I'm not sure how > the output of sessionInfo() is best used to determine R versions. This seems > to > work, but a) there is certainly a better way and b) I'm not sure where the > "patched" will appear in the string. > > if(sessionInfo()$R.version$minor < "15.1") ... ?getRversion is an option Berend __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] How to determine R version?
Hi, What's the best approach to determine if a user uses an R version before 2.15.1 patched? I know that the sessionInfo() command provides details, but I'm not sure how the output of sessionInfo() is best used to determine R versions. This seems to work, but a) there is certainly a better way and b) I'm not sure where the "patched" will appear in the string. if(sessionInfo()$R.version$minor < "15.1") ... Cheers, Marius __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Change boxplot color
Thanks! I missed that argument... :) 2012/9/22 Bert Gunter : > ?boxplot > ... and note the "border" argument > > -- Bert > > On Fri, Sep 21, 2012 at 6:57 PM, Simone Gabbriellini > wrote: >> Hello, >> >> I would like to change the color of the borders of my boxplot. Using col= I >> am able only to change the inside background of the boxplot, while I would >> like to have it transparent andchange the border instead. >> >> Any hint aamore than welcome, >> >> Best, >> Simone >> >> Inviato da iPhone >> __ >> R-help@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. > > > > -- > > Bert Gunter > Genentech Nonclinical Biostatistics > > Internal Contact Info: > Phone: 467-7374 > Website: > http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm -- Simone Gabbriellini, PhD PostDoc@DISI, University of Bologna mobile: +39 340 39 75 626 email: simone.gabbriell...@unibo.it home: www.digitaldust.it DigitalBrains srl Amministratore mobile: +39 340 39 75 626 email: simone.gabbriell...@digitalbrains.it home: www.digitalbrains.it __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] translating SAS proc mixed into R lme()
Zoya Pyrkina gmail.com> writes: > I need help with translating these SAS codes into R with lme()? I have a > longitudinal data with repeated measures (measurements are equally spaced > in time, subjects are measured several times a year). I need to allow slope > and intercept vary. > > SAS codes are: > > proc mixed data = survey method=reml; > > class subject var1 var3 var2 time; > > model score = var2 score_base var4 var5 var3 var6 var7 var1 time/ noint > solution; > > random intercept timecontinious / subject=subject type=un g gcorr v vcorr; > > run; > You might have more luck submitting this to r-sig-mixed-models r-project.org. Have you looked at the lme documentation and examples (and Pinheiro and Bates's 2000 book)? You probably want something *approximately* like lme(score~var2+score_base+var4+var5+var3+var6+var7+var1+time-1, random=~time|subject, data=...) A reproducible example would be nice too. Ben Bolker __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] __FILE__ object in R
On 12-09-21 3:27 PM, Peter Waltman wrote: Hi - I'm curious if there is a way to get access to the location of the calling script within R. I found one way of accessing it from this thread, https://stat.ethz.ch/pipermail/r-devel/2008-April/048914.html, which recommends using either: parent.frame(2)$ofile Or FILE <- (function() { attr(body(sys.function()), "srcfile") })()$filename However, those suggestions only work when you source a script from within the actual R shell, itself. They will both fail, though, if you try to use them within an executable Rscript using the shebang format (i.e. #!/usr/bin/Rscript or #!/usr/bin/env Rscript). Is there any way to get access to the actual file location if you are using an executable R script? I'm asking b/c I'd like to use an R script that I've written for use w/in a workflow environment (Galaxy, to be specific). Because Galaxy places the executables within a user-specified directory, we can't hard-code that location if we want these to be general purpose, and would like access to that within the script, themselves, because in some cases, they need to be able to access each other. Those both lead to R being run with the command line option --file=script>. As far as I can see, R doesn't save the filename in that case, it just opens the file and starts reading from it as though you were entering those lines in the console, but it does save the command line, so you can parse it yourself. For example, - #!/usr/bin/Rscript getFilename <- function() { args <- commandArgs() filearg <- grep("^--file=", args, value=TRUE) if (length(filearg)) sub("^--file=", "", filearg) else invisible(NULL) } getFilename() - Duncan Murdoch __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] New Submission to CRAN note
After uploading your package via ftp, in your email to c...@r-project.org you need to state that you agree to the CRAN repository policy (http://cran.r-project.org/web/packages/policies.html) Hadley On Sat, Sep 22, 2012 at 1:02 AM, Christopher Desjardins wrote: > Hi, > I want to submit a package to CRAN and I am getting the following Note: > > * checking CRAN incoming feasibility ... NOTE > New submission > > How can I take care of this? And/or is it a big deal? > > > Thanks and sorry if this is something that I easily overlooked I have > googled this topic for a while and found nothing. > > Chris > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- RStudio / Rice University http://had.co.nz/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.