Re: [R] averaging X of specific Y (latitude)

2012-12-17 Thread Elaine Kuo
Hello David, Thank you for the response. I changed the e-mail format to text via gmail setting. 1. the butterfly names You are right that the butterfly names are stored in the original data. However, in your code, it is necessary to input the names for the command structure. The method I used

Re: [R] rms R code

2012-12-17 Thread David Winsemius
On Dec 17, 2012, at 7:30 PM, Frank Harrell wrote: > In http://biostat.mc.vanderbilt.edu/RmS see the section marked "R Code". The > zip file there doesn't contain code for all of the book yet; I will be > adding code for the rest of the chapters in the next few months. Are you working on a sec

Re: [R] rms R code

2012-12-17 Thread Frank Harrell
In http://biostat.mc.vanderbilt.edu/RmS see the section marked "R Code". The zip file there doesn't contain code for all of the book yet; I will be adding code for the rest of the chapters in the next few months. Frank stephenb wrote > I have used the errata from there, but have not found whe

Re: [R] averaging X of specific Y (latitude)

2012-12-17 Thread David L Carlson
You should change your email format to text (you keep sending messages in html format). Where are the butterfly names? Are they not in your original data? Create your data.frame from the original data (which presumably has the butterfly names in it already). Then use dput() if you need to email th

[R] Wald Test for rqpd package

2012-12-17 Thread Fernando Parmagnani
Dear all, I'm trying to run a Wald Test for the Penalized Fixed Effects using the rqpd package. Actually, I'd like to test if the coefficients associated to the same variable are statistically different among the quantiles. The usual wald.test, waldtest or anova.rq don't work for rqpd. I would app

Re: [R] subset handling

2012-12-17 Thread Rui Barradas
Hello, You could have attached the output of dput(), it's much, much better. I have tried the following and it works. sp <- lapply(split(agg, agg$st), function(x) x[order(x$year, x$month), ]) sp <- lapply(sp, function(x) data.frame(year = x$year + x$month/12, Population = x$Population)) # Plot i

Re: [R] ggplot add a legend?

2012-12-17 Thread Jeff Newmiller
Ask on the ggplot mailing list? Normally you use melted data (see the reshape2 package) and let the scales feature build the legend for you. --- Jeff NewmillerThe . . Go Live... DCN:

Re: [R] ggplot add a legend?

2012-12-17 Thread Ista Zahn
Map year to an aesthetic and let ggplot do it for you: df2010$year <- 2010 df2011$year <- 2011 df2012$year <- 2012 dfAll <- rbind(df2010, df2011, df2010) ggplot(dfAll, aes(x=Price, y=percenCapacity, color=year) + scale_x_log10() Best, Ista On Mon, Dec 17, 2012 at 6:03 PM, jcrosbie wrote: > > H

Re: [R] averaging X of specific Y (latitude)

2012-12-17 Thread Elaine Kuo
Thank you, David. Now I know how to use dput. Two more questions conjured up when running the code: 1. If there are about 500 species of butterflies, please kindly advise if it is possible to input the butterfly names (for .Label) using code, instead of keying in them one by one. 2. Aggr

[R] ggplot add a legend?

2012-12-17 Thread jcrosbie
How to I go about adding a legend to the following plot? ggplot() + geom_line(aes(x=df2010$Price,y=df2010$percentCapacity), colour = "red") + geom_line(aes(x=df2011$Price,y=df2011$percentCapacity), colour = "green") +geom_line(aes(x=df2012$Price,y=df2012$percentCapacity), colour = "blue") +sc

Re: [R] Manipulation of longitudinal data by row

2012-12-17 Thread arun
Hi Jean, Just to clarify whether it is a 'typo' or not. data2 <- data.frame( id = rep(data1$ID, 3), visit = rep(1:3, rep(dim(data1)[1], 3)), date = as.Date(c(data1$V1Date, data1$V2date, data1$V3date), "%m/%d/%y"), dva = c(data1$V1a, data1$V2a, data1$V3a), dvb = c(data1$V1a, data1$V2a, data1$V3a),#

Re: [R] Code works standalone, yet same code fails when part of package

2012-12-17 Thread Martin Morgan
Hi Mick -- On 12/17/2012 02:01 PM, WATSON Mick wrote: Hi I'm missing something here but I cannot figure out what. What I can see is that the same code works when I load it via source(...) yet fails when I execute it after loading the package I have built (which includes the code. Below is a

[R] subset handling

2012-12-17 Thread eliza botto
Dear Rui and UseRs,[a text file has also been attached, in case the format of my email is difficult to get]I am extremely sorry that I am bothering you once again, but I’ll have to get to the bottom of it. The following command sp <- lapply(split(agg, agg$st), function(x) x[order(x$year, x$mont

Re: [R] split character line into rows

2012-12-17 Thread arun
Hi, This could be read using the first method I suggested.  The ?substr() method was suggested as I thought that there will be square brackets in each line. dat1<-read.table("preila.txt",sep="",header=FALSE,fill=TRUE,dec=",",stringsAsFactors=FALSE) dat2<-na.omit(dat1)  dat2$Date<-as.POSIXct(paste

[R] Code works standalone, yet same code fails when part of package

2012-12-17 Thread WATSON Mick
Hi I'm missing something here but I cannot figure out what. What I can see is that the same code works when I load it via source(...) yet fails when I execute it after loading the package I have built (which includes the code. Below is a transcript of my R session. First I load the code from

Re: [R] Manipulation of longitudinal data by row

2012-12-17 Thread Adams, Jean
I had some difficulty getting the data read in using the code you included in your email, although I'm not sure why. I'm pasting in the code that worked for me, below. I think that the calculations that you want to make would be easier if you rearranged your data first. I used your example data

Re: [R] mean of each month in data

2012-12-17 Thread Rui Barradas
Hello, Better yet, with 'agg' as given in my first post: sp <- lapply(split(agg, agg$st), function(x) x[order(x$year, x$month), ]) plot(agg$year, agg$population, type = "n") lapply(seq_along(sp), function(i) lines(sp[[i]]$year, sp[[i]]$population, col = i)) Hope this helps, Rui Barradas Em

Re: [R] split character line into rows

2012-12-17 Thread Sarah Goslee
On Mon, Dec 17, 2012 at 4:43 PM, Simonas Kecorius wrote: > Hey Sarah, > thanks for quick response and your kind help. I appreciate it a lot. > You are completely right. When I input data as Arun suggested, there is no > problems. But when I try to read it from txr file - something wrong happens. >

Re: [R] R beginner: matrix algebra

2012-12-17 Thread William Dunlap
diff(x) will returns the diff's of each column when x is a matrix, so there is no need for the apply call. E.g., > d <- ts(cbind(SQRE=(1:7)^2, CUBE=(1:7)^3), start=2012.25, deltat=1/4) > d SQRE CUBE 2012 Q211 2012 Q348 2012 Q49 27 2013 Q1 16 64 2013 Q2 25 125

Re: [R] mean of each month in data

2012-12-17 Thread Rui Barradas
Hello, You want to draw 2 + 67 lines in the same graph? The result should be confusing... As for the graph itself, you can use ?matplot, it's meant for that sort of problem. Hope this helps, Rui Barradas Em 17-12-2012 20:54, eliza botto escreveu: Dear Arun and Rui,thanks indeed. it really

Re: [R] R beginner: matrix algebra

2012-12-17 Thread Richard M. Heiberger
I think this is what you are looking for. > tmp <- matrix(sample(20), 5, 4) > tmp [,1] [,2] [,3] [,4] [1,]6 15 18 20 [2,]45 10 19 [3,]7913 [4,]8 14 11 13 [5,] 17 12 162 > t(apply(tmp, 1, diff)) [,1] [,2] [,3] [1,]932 [

Re: [R] split character line into rows

2012-12-17 Thread David L Carlson
To combine the date/time fields into one and rename the variables, use this: > dta V1 V2 V3V4 V5 1 2010.12.26 00:00:52 688.88 11.69 43 2 2010.12.26 00:01:52 696.19 11.69 43 > dta <- data.frame(date=strptime(paste(dta$V1, dta$V2), "%Y.%m.%d %H:%M:%S"), V2=dta$V3, V3=d

Re: [R] rms R code

2012-12-17 Thread Bond, Stephen
I have used the errata from there, but have not found where to download working R code from. Stephen -Original Message- From: Sarah Goslee [mailto:sarah.gos...@gmail.com] Sent: Monday, December 17, 2012 4:22 PM To: Bond, Stephen Cc: r-help@r-project.org Subject: Re: [R] rms R code Did

Re: [R] rms R code

2012-12-17 Thread Sarah Goslee
Did you try the website for the book? http://biostat.mc.vanderbilt.edu/wiki/Main/RmS On Mon, Dec 17, 2012 at 4:06 PM, Bond, Stephen wrote: > Greetings, useRs. > > Does anybody have replication of the examples from the RMS book by Harrell > coded in R? I find that most the code does not work a

[R] rms R code

2012-12-17 Thread Bond, Stephen
Greetings, useRs. Does anybody have replication of the examples from the RMS book by Harrell coded in R? I find that most the code does not work and it takes too much time to debug. For example from p.276 > age.t <- w[,"age"] > f.full <- > lrm(cvd~scored(rx)+rcs(dtime,5)+age.t+wt.t+pf.t+hx+sbp

Re: [R] Formatting a path for unix with gsub

2012-12-17 Thread William Dunlap
Use either > gsub(" ", " ", "one two three") # double space after 'two' [1] "one\\ two\\ \\ three" or > gsub(" ", "\\ ", "one two three", fixed=TRUE) [1] "one\\ two\\ \\ three" When 'fixed' is not TRUE then a backslash gives a special meaning to the next character in the replacement

Re: [R] Merge more than 2 dataframe

2012-12-17 Thread David Winsemius
On Dec 17, 2012, at 8:03 AM, Vasilchenko Aleksander wrote: > Hello. > I have for example 4 or more dataframe which like such this example: > date value > 2006-11 0.4577647 > 2006-12 NaN > 2006-10 0.1577647 > 2006-11 0.3577647 > 2006-12 NaN > 2007-01 NaN > 2007-02 NaN

Re: [R] How to test whether is.element() returns only TRUE's

2012-12-17 Thread Atte Tenkanen
I found one: sum(is.element(c(1,4,2),c(1,2,3)))==length(c(1,4,2)) Are there others and perhaps more elegant ways? Atte Tenkanen, FT, MuM http://users.utu.fi/attenka/ Lähettäjä: Atte Tenkanen Lähetetty: 17. joulukuuta 2012 22:24 Vastaanottaja: r-help@r-pro

Re: [R] split character line into rows

2012-12-17 Thread arun
Hi, This could also work:  max(nchar(txt)) #[1] 58 res<-read.table(text=substr(txt[nchar(txt)>20],5,58),sep="",dec=",",header=FALSE,stringsAsFactors=FALSE)  res #  V1   V2 V3    V4 V5 #1 2010.12.26 00:00:52 688.88 11.69 43 #2 2010.12.26 00:01:52 696.19 11.69 43 A.K. - Origin

Re: [R] Formatting a path for unix with gsub

2012-12-17 Thread David Winsemius
On Dec 17, 2012, at 9:44 AM, Nathan Skene wrote: > I have a path: > > path = "/nfs/users/nfs_n/ns9/ > Phenotype Analysis/Results/Run_AmplRatio_neg > BinaryAll trained without akapn+tnik.csv" > > I wish to replace the spaces with "\ " so that it can be read by a system > call to unix. > > Using

Re: [R] mean of each month in data

2012-12-17 Thread eliza botto
Dear Arun and Rui,thanks indeed. it really worked out. i was wondering that can i draw the curve of stations "Sa" , "Ta" and remaining 67 stations on the same axis, for comparison? more precisely, taking years on axis, starting from the least year in my data and ending at latest, while taking

Re: [R] Triple Integration in R

2012-12-17 Thread David Winsemius
On Dec 17, 2012, at 9:38 AM, KoopaTrooper wrote: > I'm using Kernel Utilization distributions to estimate overlap in animal > territories. There are various ways to calculate this overlap and one of the > equations is : V.I. = ∫∫∫ min (f1 (x,y,z), f2 (x,y,z)) dxdy where f1 = > utilization distr

Re: [R] How to test whether is.element() returns only TRUE's

2012-12-17 Thread Bert Gunter
?all On Mon, Dec 17, 2012 at 12:24 PM, Atte Tenkanen wrote: > Hi, > > How can I test, whether all the values that is.element() -function returns > are TRUE's > > Eg. > > (is.element(c(1,4,2),c(1,2,3))) > [1] TRUE FALSE TRUE > > This doesn't work: > > > (is.element(c(1,4,2),c(1,2,3)))==TRUE > [

Re: [R] How to test whether is.element() returns only TRUE's

2012-12-17 Thread Sarah Goslee
With all(). > all(is.element(c(1,4,2),c(1,2,3))) [1] FALSE Sarah On Mon, Dec 17, 2012 at 3:24 PM, Atte Tenkanen wrote: > Hi, > > How can I test, whether all the values that is.element() -function returns > are TRUE's > > Eg. >> (is.element(c(1,4,2),c(1,2,3))) > [1] TRUE FALSE TRUE > > This d

Re: [R] Why does matrix selection behave differently when using which?

2012-12-17 Thread Berend Hasselman
On 17-12-2012, at 21:03, Asis Hallab wrote: > Dear R experts, > > please accept my apologies for the missing information. > > You need to call sumRows in the following manner: > > sumRows(t, sort( unique( t[,"Domain.Architecture.Distance"] ) ) ) > > Thank you Berend and David for pointing ou

[R] How to test whether is.element() returns only TRUE's

2012-12-17 Thread Atte Tenkanen
Hi, How can I test, whether all the values that is.element() -function returns are TRUE's Eg. > (is.element(c(1,4,2),c(1,2,3))) [1] TRUE FALSE TRUE This doesn't work: > (is.element(c(1,4,2),c(1,2,3)))==TRUE [1] TRUE FALSE TRUE Best, Atte Tenkanen, FT, MuM http://users.utu.fi/attenka/ ___

Re: [R] Merge more than 2 dataframe

2012-12-17 Thread arun
Hi, You could use either: Reduce(function(...) merge(...,by="date"),list(dat1,dat2,dat3,dat4)) #or library(reshape) merge_recurse(list(dat1,dat2,dat3,dat4), by="date") A.K.   - Original Message - From: Vasilchenko Aleksander To: r-help@r-project.org Cc: Sent: Monday, December 17

[R] Triple Integration in R

2012-12-17 Thread KoopaTrooper
I'm using Kernel Utilization distributions to estimate overlap in animal territories. There are various ways to calculate this overlap and one of the equations is : V.I. = ∫∫∫ min (f1 (x,y,z), f2 (x,y,z)) dxdy where f1 = utilization distribution for bird 1 in 3 spatial dimensions (x,y,z). I can p

[R] R beginner: matrix algebra

2012-12-17 Thread kevj1980
Hi, I have an n x m matrix of numerical observations. ie. stock prices I wish to convert the matrix of observations to a matrix of simple returns (by taking the differences between (column) observations.) Can any good soul suggest a function for this? -- View this message in context: http://

Re: [R] mean of each month in data

2012-12-17 Thread arun
HI, May be this helps: dat1<-read.table("Eliza.txt",sep="",header=TRUE,stringsAsFactors=FALSE) library(reshape2)  res<-lapply(split(dat1,dat1$st.),function(x) dcast(x,month~year,mean,value.var="population_in_million")) res $Sa #   month 1955 1956 1957 1958 #1  1 2.40  NaN  NaN

[R] Formatting a path for unix with gsub

2012-12-17 Thread Nathan Skene
I have a path: path = "/nfs/users/nfs_n/ns9/ Phenotype Analysis/Results/Run_AmplRatio_neg BinaryAll trained without akapn+tnik.csv" I wish to replace the spaces with "\ " so that it can be read by a system call to unix. Using gsub I try: > gsub(" ","\\ ",path) [1] "/nfs/users/nfs_n/ns9/Phenotyp

Re: [R] split character line into rows

2012-12-17 Thread David Winsemius
On Dec 17, 2012, at 4:04 AM, Simonas Kecorius wrote: > Hey R users, > > suppose we have data: > txt <- readLines(textConnection("[1] 2010.12.26 00:00:52688,88 11,69 43,00 [2] 11,69 43,00 [3] 11,69 43,00 [4] 11,69 43,00 [5] 11,69 43,00 [6] 11,69 43,00

Re: [R] Why does matrix selection behave differently when using which?

2012-12-17 Thread Asis Hallab
Dear R experts, please accept my apologies for the missing information. You need to call sumRows in the following manner: sumRows(t, sort( unique( t[,"Domain.Architecture.Distance"] ) ) ) Thank you Berend and David for pointing out my mistake. Kind regards and again: Your help is very much app

Re: [R] Why does matrix selection behave differently when using which?

2012-12-17 Thread David Winsemius
On Dec 17, 2012, at 11:22 AM, Asis Hallab wrote: > Dear R community, > > I have a medium sized matrix stored in variable "t" and a simple function " > countRows" (see below) to count the number of rows in which a selected > column "C" matches a given value. If I count all rows matching all pairw

Re: [R] Why does matrix selection behave differently when using which?

2012-12-17 Thread Berend Hasselman
On 17-12-2012, at 20:22, Asis Hallab wrote: > Dear R community, > > I have a medium sized matrix stored in variable "t" and a simple function " > countRows" (see below) to count the number of rows in which a selected > column "C" matches a given value. If I count all rows matching all pairwise >

[R] Why does matrix selection behave differently when using which?

2012-12-17 Thread Asis Hallab
Dear R community, I have a medium sized matrix stored in variable "t" and a simple function " countRows" (see below) to count the number of rows in which a selected column "C" matches a given value. If I count all rows matching all pairwise distinct values in the column "C" and sum these counts up

Re: [R] ggplot geom_smooth colour

2012-12-17 Thread Josh Lemaitre
Fortunately for you and your embarrassment, the members of this list are a nurturing and supportive group that truly cares first and foremost about submitters' success. On 12/17/12 12:16 PM, "soon yi" wrote: >Thank you. > >Rather embarrassed. Its fair to say i had rather over comlicated my >atte

Re: [R] mean of each month in data

2012-12-17 Thread David L Carlson
A slight modification to Rui's answer would give you a list containing separate matrices for each station: > aggwide <- reshape(agg, direction = "wide", idvar = c("st", "month"), + timevar = "year", v.names = "population") > aggsplit <- split(aggwide[,colnames(aggwide)!="st"], aggwide$st) > a

[R] FW: How to make Ordinary Kriging using gstat predict?

2012-12-17 Thread DIMITRIS KARAKOSTIS
> > > Thanks for the answer. I have already read the gstat manual and I had > constructed the empirical and theoretical variogram like this: g <- gstat(id="tec", formula=TEC ~ 1, data=data)v <- variogram(g)mod<-vgm(sill=var(data$TEC),model="Sph",range=200,nugget=10)v.fit <- fit.variogram(v,

Re: [R] mean of each month in data

2012-12-17 Thread Rui Barradas
Hello, Something like this? dat <- structure(list(st = structure(c(2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1

Re: [R] ggplot geom_smooth colour

2012-12-17 Thread Jose Iparraguirre
Try something along these lines: > library(ggplot2) > cbPalette <- c("#99", "#E69F00") > df<-data.frame(y=rnorm(100,30,10),x=rnorm(100,20,5),treat=factor(rbinom(100,1,0.5))) > p1<-ggplot(df, aes(x=x, y=y,group=treat)) + theme_bw() + + geom_smooth(aes(linetype=treat, colour="black"),method

Re: [R] How to make Ordinary Kriging using gstat predict?

2012-12-17 Thread DIMITRIS KARAKOSTIS
Thanks for the answer. I have already read the gstat manual and I had constructed the empirical and theoretical variogram like this: g <- gstat(id="tec", formula=TEC ~ 1, data=data)v <- variogram(g)mod<-vgm(sill=var(data$TEC),model="Sph",range=200,nugget=10)v.fit <- fit.variogram(v, model=mod

Re: [R] Merge more than 2 dataframe

2012-12-17 Thread Greg Snow
One option is to put all the data frames into a list then use the Reduce function. On Mon, Dec 17, 2012 at 9:03 AM, Vasilchenko Aleksander < vasilchenko@gmail.com> wrote: > Hello. > I have for example 4 or more dataframe which like such this example: > date value > 2006-11 0.4577647

Re: [R] How to make Ordinary Kriging using gstat predict?

2012-12-17 Thread S Ellison
> -Original Message- > My problem is that instead of Ordinary kriging, when I run > the algorithm I get: Inverse distance weighted interpolation. > Why is that? What am I missing or doing wrong? The gstat manual at http://www.gstat.org/gstat.pdf says on p16 that "When no variograms ar

Re: [R] Problems with building R from sources

2012-12-17 Thread Duncan Murdoch
On 17/12/2012 12:04 PM, Uwe Ligges wrote: On 17.12.2012 17:31, Laura Skylaki wrote: > Hello all, > > I'm trying to build R 32bit from source in a Windows 64 machine. I have > followed the steps in "R Installation and Adiministration" ( > http://cran.r-project.org/doc/manuals/R-admin.html#Getting

Re: [R] ggplot geom_smooth colour

2012-12-17 Thread soon yi
Thank you. Rather embarrassed. Its fair to say i had rather over comlicated my attempts to do this. sy soon yi wrote > Hi > > I am using geom_smooth to fit linear regression lines over a scatterplot > for two treatment groups. The default colour for the two lines are blue. I > have been unable t

[R] mean of each month in data

2012-12-17 Thread eliza botto
Dear R users, [in case the format of email is changed or you dont finf it easy to understand, i have attached a text file of my question] i have the data in the following format and i want to convert it in the format given at the end. Ta ans Sa are the names of certain cities. there are 69 citie

Re: [R] Problems with building R from sources

2012-12-17 Thread Uwe Ligges
On 17.12.2012 17:31, Laura Skylaki wrote: Hello all, I'm trying to build R 32bit from source in a Windows 64 machine. I have followed the steps in "R Installation and Adiministration" ( http://cran.r-project.org/doc/manuals/R-admin.html#Getting-the-source-files) or at least I think I did every

Re: [R] average X value of specific Y

2012-12-17 Thread Greg Snow
Look at the tapply function. Possibly using round or cut if needed. Other tools that may be useful (but probably overkill for the simple problem) include aggregate, ave, and the plyr package. On Sat, Dec 15, 2012 at 9:12 PM, Elaine Kuo wrote: > Hello > > > > I have a table describing butterfl

Re: [R] xlim/ylim problem

2012-12-17 Thread Greg Snow
It is best to reply to the whole list, you are likely to get answers quicker and possibly better that way and if other people have your same question and search the archives they will see the whole conversation. It looks like the plot method for hexbin objects does not honor the ylim argument. In

Re: [R] calculate a "rolling mean" including standard deviation

2012-12-17 Thread Rui Barradas
Hello, Something like this? d <- myframe2$distance n <- length(d) mu <- rep(NA, n - 1) mu[n - 1] <- m <- mean(d[(n - 1):n]) s <- sd(d[(n - 1):n]) ex <- 0 for(i in rev(seq_len(n))[-(1:2)]){ if(d[i] < m + s){ ex <- 0 mu[i] <- m }else{ ex <- ex + 1 if(ex >=

Re: [R] save to file

2012-12-17 Thread Felipe Carrillo
I actually got it to do what I want running my R routine through a batch file. It saves to a file everything on the console. Thanks for your suggestions. Felipe D. Carrillo Supervisory Fishery Biologist Department of the Interior US Fish & Wildlife Service California, USA http://www.fws.gov/redb

Re: [R] ggplot geom_smooth colour

2012-12-17 Thread Rui Barradas
Hello, Inline. Em 17-12-2012 15:44, soon yi escreveu: Hi Yes i had look at this but it doesnt quite do what i am wanting. I do not want the smoothed line to be coloured, or dependant on a factor or the default blue. An example, library(ggplot2) df<-data.frame(y=rnorm(100,30,10),x=rnorm(100,2

[R] How to make Ordinary Kriging using gstat predict?

2012-12-17 Thread DIMITRIS KARAKOSTIS
Hi, I am new in R and trying to implement an algorithm which makes ordinary kriging by using gstat library and the predict method. I use the predict method as following: First, I create an object g: g <- gstat(id="tec", formula=TEC ~ 1, data=data) ## Create gstat object called g And then

Re: [R] split character line into rows

2012-12-17 Thread arun
Hi, Just to add: dat1<-read.table(text="  2010.12.26 00:00:52    688,88 11,69    43,00   11,69    43,00    11,69    43,00    11,69    43,00    11,69    43,00  2010.12.26 00:01:52    696,19    11,69    43,00 ",sep="",header=FALSE,fill=TRUE,dec=",",stringsAsFactors=FALSE)  dat2<-na.omit(dat1)  dat2$

[R] Problems with building R from sources

2012-12-17 Thread Laura Skylaki
Hello all, I'm trying to build R 32bit from source in a Windows 64 machine. I have followed the steps in "R Installation and Adiministration" ( http://cran.r-project.org/doc/manuals/R-admin.html#Getting-the-source-files) or at least I think I did everything described. I am not sure if I have insta

Re: [R] split character line into rows

2012-12-17 Thread arun
Hi, It would be helpful if you dput() the data. If I read your data like this: dat1<-read.table(text="  2010.12.26 00:00:52    688,88 11,69    43,00   11,69    43,00    11,69    43,00    11,69    43,00    11,69    43,00  2010.12.26 00:01:52    696,19    11,69    43,00 ",sep="",header=FALSE,fill=TR

[R] Merge more than 2 dataframe

2012-12-17 Thread Vasilchenko Aleksander
Hello. I have for example 4 or more dataframe which like such this example: date value 2006-11 0.4577647 2006-12 NaN 2006-10 0.1577647 2006-11 0.3577647 2006-12 NaN 2007-01 NaN 2007-02 NaN 2007-03 0.2956429 2007-01 0.3677647 2007-02 NaN They have the

Re: [R] calculate a "rolling mean" including standard deviation

2012-12-17 Thread Tagmarie
Now I played around in Excel for the last two hours or so and solved my problem there. I know it is not really liked here but it worked. So I do not really need your help on this problem. If anyone knows on how to do it anyway I'd be very happy though!!! Nobody taught me more about R than this m

Re: [R] averaging X of specific Y (latitude)

2012-12-17 Thread David L Carlson
You are only using dput to create a version of your data that you can post in your email along with your question. You do not use it in your analysis. You originally posted a table of your data that requires extra steps for us to convert into a useable form so I suggested you use dput in the future

Re: [R] split character line into rows

2012-12-17 Thread Sarah Goslee
Certainly. But you'd be better advised to use dput(head(yourdata, 20)) to provide data, since we don't actually know what's in your data after it has passed through print, copy, and email. How you got it into R may also be relevant. Also, I don't see how you get from the given data to the desired

Re: [R] A question on list and lapply

2012-12-17 Thread MacQueen, Don
If you don't need the "P" element in the output, then I think the answers you've already received are good. But if you do want to retain the "P" element, then I think it's better to simply add the missing elements back in after using lapply. The code will be easier to understand a year from now. H

Re: [R] simplifying code

2012-12-17 Thread David Winsemius
On Dec 17, 2012, at 5:15 AM, Rui Barradas wrote: Hello, Try the following. cp <- sapply(1:4, function(n) output0*exp(-0.3*TIME1[n])) plot(TIME1, cp) That appears to be more complex than necessary. Even R-newbs should use vectorized approaches if they are easily available: cp <- outpu

Re: [R] ggplot geom_smooth colour

2012-12-17 Thread soon yi
Hi Yes i had look at this but it doesnt quite do what i am wanting. I do not want the smoothed line to be coloured, or dependant on a factor or the default blue. An example, library(ggplot2) df<-data.frame(y=rnorm(100,30,10),x=rnorm(100,20,5),treat=factor(rbinom(100,1,0.5))) p1

Re: [R] How to get transparent colors to sum to complete opacity?

2012-12-17 Thread S Ellison
> -Original Message- > Superposing a finite set of semi-transparent dots will never > give an opaque one (and that is true of physical dots too). Indeed not; this is an ideal case of the Beer-Lambert law. Nice to know that basic chemistry has applications in computational graphics ...

Re: [R] averaging X of specific Y (latitude)

2012-12-17 Thread arun
HI Elaine, You only provided an object "datam" and the dput(dta).  I don't know what is inside "datam".  Your question "how to use the object "datam" in connection with the code ..." is very confusing.  Do you want to find if datam is a subset of dta or something else?  Regarding your other q

Re: [R] Splitting up of a dataframe according to the type of variables

2012-12-17 Thread arun
Hi, You could also use ?colwise() from library(plyr) set.seed(50) dat1<-data.frame(Col1=sample(1:20,10,replace=TRUE),Col2=sample(LETTERS[1:10],10,replace=TRUE),Col3=sample(LETTERS[11:20],10,replace=TRUE),Col4=sample(40:60,10,replace=TRUE))  dat1[unlist(colwise(is.factor)(dat1))] #   Col2 Col3 #1   

[R] split character line into rows

2012-12-17 Thread Simonas Kecorius
Hey R users, suppose we have data: [1] 2010.12.26 00:00:52688,88 11,69 43,00 [2] 11,69 43,00 [3] 11,69 43,00 [4] 11,69 43,00 [5] 11,69 43,00 [6] 11,69 43,00 [7] 11,69 43,00 [8] 11,69 43,00 [9] 11,69 43,00 [10] 11,69 43,00 [11]

[R] Specific structure of variance-covariance matrix in the lme function for a linear mixed effect models

2012-12-17 Thread Caroline Bazzoli
Dear all, We are using lme function to estimate a mixed effect model. The data are obtained from the following experience: 15 subjects were required to press maximally ledges with four fingers and magnitudes of the 4 fingers are measured simultaneously for three different positions. Three repe

Re: [R] plotting log regression

2012-12-17 Thread mrkooper
Thank you for your help! i'm still wondering if it's possible to transfer the results of the log regression into a plot with the nonlog values. -- View this message in context: http://r.789695.n4.nabble.com/plotting-log-regression-tp4653087p4653279.html Sent from the R help mailing list ar

Re: [R] looping through spatial points and getting counts of spatial points in spatial grid in R

2012-12-17 Thread Tilottama Ghosh
Hi, Following Anthony's reply I am attaching two of the POI shapefiles and the code for creating the spatial grid. I am not being able to read the list of these shapefiles and then perform the points in spatial grid function. If someone can help, I will be very grateful. Here is my code for crea

[R] calculate a "rolling mean" including standard deviation

2012-12-17 Thread Tagmarie
Hello everyone, I have a data frame somewhat like this one: myframe <- data.frame (Timestamp=c( "24.09.2012 06:00", "24.09.2012 07:00", "24.09.2012 08:00", "24.09.2012 09:00", "24.09.2012 10:00", "24.09.2012 11:00", "24.0

Re: [R] ggplot geom_smooth colour

2012-12-17 Thread Jose Iparraguirre
"... A search online has not suggested any solution / work around." Really? Have a look at this: http://docs.ggplot2.org/current/geom_smooth.html Regards, José Iparraguirre Chief Economist Age UK -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]

[R] ggplot geom_smooth colour

2012-12-17 Thread soon yi
Hi I am using geom_smooth to fit linear regression lines over a scatterplot for two treatment groups. The default colour for the two lines are blue. I have been unable to change this with the usual options. A search online has not suggested any solution / work around. Is there a solution to this?

Re: [R] plotting log regression

2012-12-17 Thread Andrews, Chris
Your example seems strange because a line fits on the x-y scale; not on the log(x)-log(y) scale. Anyway, here is my example. You can build on it for more general data. x <- exp(1:10) y <- exp(10:1 + rnorm(10)) logmod <- lm(log(y)~log(x)) logypred <- predict(logmod) plot(y~x) lines(exp(logy

Re: [R] simplifying code

2012-12-17 Thread Rui Barradas
Hello, Try the following. cp <- sapply(1:4, function(n) output0*exp(-0.3*TIME1[n])) plot(TIME1, cp) Hope this helps, Rui Barradas Em 17-12-2012 13:04, Andras Farkas escreveu: > Dear All, > > I was wondering if you could help me with the following: > I have the code: > > tin <-0.5 > tau <

Re: [R] simplifying code

2012-12-17 Thread Gergely Daróczi
Hello Andras, what about: plot(TIME1, output0*exp(-0.3*TIME1)) Best, Gergely On Mon, Dec 17, 2012 at 2:04 PM, Andras Farkas wrote: > Dear All, > > I was wondering if you could help me with the following: > I have the code: > > tin <-0.5 > tau <-24 > output0 <-10 > TIMELOW <-tin > TIMEHIGH <-1*

Re: [R] How to import the large dataset into R

2012-12-17 Thread Tammy Ma
does anybody can help me on this? From: metal_lical...@live.com To: r-help@r-project.org Subject: How to import the large dataset into R Date: Fri, 14 Dec 2012 11:01:03 +0300 HI, R Users, I met the following problem: I was trying to import data of one table in .accdb database into my ODBC

[R] simplifying code

2012-12-17 Thread Andras Farkas
Dear All,   I was wondering if you could help me with the following: I have the code:   tin <-0.5 tau <-24 output0 <-10 TIMELOW <-tin TIMEHIGH <-1*tau TIME1 <-c(seq(TIMELOW,TIMEHIGH, by = sign(TIMEHIGH-TIMELOW)*(tau-tin)/3))   then I would like to calculate:   cp1 <-output0*exp(-0.3*TIME1[1]) cp2 <

Re: [R] How to get transparent colors to sum to complete opacity?

2012-12-17 Thread Prof Brian Ripley
Look up 'alpha-blending' to see how this works. And remember that the sRGB colorspace used has non-linear transformations too. Superposing a finite set of semi-transparent dots will never give an opaque one (and that is true of physical dots too). On 17/12/2012 08:55, Andrew Crane-Droesch wr

Re: [R] Splitting up of a dataframe according to the type of variables

2012-12-17 Thread Rui Barradas
Hello, Try the following. dat <- data.frame(X = rnorm(10), Y = factor(sample(letters, 10)), Z = 1:10) num <- sapply(dat, is.numeric) dat[num] # or dat[, num] Hope this helps, Rui Barradas Em 17-12-2012 10:02, Martin Spindler escreveu: Dear R users, I have a dataframe which consists of var

Re: [R] looping through spatial points and getting counts of spatial points in spatial grid in R

2012-12-17 Thread John Kane
Sample data? Please supply some sample data and code. The easiest way to supply data is to use the dput() function. Example with your file named "testfile": dput(testfile) Then copy the output and paste into your email. For large data sets, you can just supply a representative sample.

Re: [R] averaging X of specific Y (latitude)

2012-12-17 Thread Elaine Kuo
Another question (I am sure it is the last one tentatively): After creating a text.file using dput (let's name the created file "datam"), please kindly advise how to use the text file in writing the code using "structure" like below. Thank you. code dta <- structure(list(Species = structure(1:11

Re: [R] averaging X of specific Y (latitude)

2012-12-17 Thread Elaine Kuo
One more question: Please kindly explain why it is written as "row.names = c(NA, -11L))." (in the code below) I am unsure why it is "negative" 11. Thank you . Elaine code dta <- structure(list(Species = structure(1:11, .Label = c("Butterfly A1", + "Butterfly A2", "Butterfly A3", "Butterfly A4

Re: [R] averaging X of specific Y (latitude)

2012-12-17 Thread Elaine Kuo
Thank you, Berend. I tried 1. dput (datam, "datam") 2. dput (datam) both worked Elaine On Mon, Dec 17, 2012 at 7:30 PM, Berend Hasselman wrote: > > On 17-12-2012, at 12:06, Elaine Kuo wrote: > > > Hello, > > > > Thank you again, David. > > > > I tried with the first step of the command "depu

Re: [R] averaging X of specific Y (latitude)

2012-12-17 Thread Berend Hasselman
On 17-12-2012, at 12:06, Elaine Kuo wrote: > Hello, > > Thank you again, David. > > I tried with the first step of the command "deput" as followed > It's "dput" not "deput". > datam <-read.csv ('H:/Butterfly_RS_20121217.csv',header=T, row.names=1) > dput(datam, Migrant_RS_L_txt) > > However

Re: [R] averaging X of specific Y (latitude)

2012-12-17 Thread Elaine Kuo
Hello, Thank you again, David. I tried with the first step of the command "deput" as followed datam <-read.csv ('H:/Butterfly_RS_20121217.csv',header=T, row.names=1) dput(datam, Migrant_RS_L_txt) However, there is a error message that "the object Migrant_RS_L_txt is not found." I read the exam

Re: [R] Splitting up of a dataframe according to the type of variables

2012-12-17 Thread Jessica Streicher
f<-factor(c(1,1,2,3)) n<-c(1,1,2,3) df<-data.frame(f,n) sapply(df,is.factor) f n TRUE FALSE df[sapply(df,is.factor)] f 1 1 2 1 3 2 4 3 df[sapply(df,is.numeric)] n 1 1 2 1 3 2 4 3 something like that? On 17.12.2012, at 11:02, Martin Spindler wrote: > Dear R users, > > I have a dataf

Re: [R] Splitting up of a dataframe according to the type of variables

2012-12-17 Thread Jim Holtman
most likely the 'split' function, but exactly how would depend on the data which you did not provide. Sent from my iPad On Dec 17, 2012, at 5:02, "Martin Spindler" wrote: > Dear R users, > > I have a dataframe which consists of variables of type numeric and factor. > What is the easiest way t

[R] Splitting up of a dataframe according to the type of variables

2012-12-17 Thread Martin Spindler
Dear R users, I have a dataframe which consists of variables of type numeric and factor. What is the easiest way to split up the dataframe to two dataframe which contain all variables of the type numeric resp. factors? Thank you very much for your efforts in advance! Best, Martin

  1   2   >