Re: [R] Days to solstice calculation

2013-12-01 Thread Pascal Oettli
Hello, It seems that this kind of calculations are done in package 'insol'. Regards, Pascal On 2 December 2013 15:26, White, William Patrick wrote: > Hello, > I've come across a problem in developing a set of custom functions to > calculate the number of hours of daylight at a given latitude,

[R] Days to solstice calculation

2013-12-01 Thread White, William Patrick
Hello, I've come across a problem in developing a set of custom functions to calculate the number of hours of daylight at a given latitude, and the number of days a date precedes or secedes the summer solstice. I discovered an inconsistency concerning leap years between my derived values and tho

Re: [R] Multiple regressions with changing dependent variable and time span

2013-12-01 Thread arun
Hi, I guess you wanted something like this: res2 <- do.call(cbind,lapply(lst2,  function(x) rollapply(x,width=32,FUN=function(z) {z1 <- as.data.frame(z); if(!sum(!!rowSums(is.na(z1 {l1 <-lm(r~F.1+F.2+F.3,data=z1); c(coef(l1), pval=summary(l1)$coef[,4], rsquare=summary(l1)$r.squared) } else

Re: [R] Multiple regressions with changing dependent variable and time span

2013-12-01 Thread arun
Hi, Try: dat1 <- read.table(text="A    B C D r.1  x1    x2   x3 r.1  x4    x5    x6 r.2  x7    x8    x9 r.2  x10  x11 x12 r.3  x13  x14 x15 r.3  x16  x17 x18",header=TRUE,stringsAsFactors=FALSE)  dat2 <- do.call(cbind,split(dat1,dat1$A)) colnames(dat2) <- gsub(".*\\.","",colnames(dat2)) A.

Re: [R] Multiple regressions with changing dependent variable and time span

2013-12-01 Thread nooldor
Yes. Thank you once again. With this: > res2 <- do.call(cbind,lapply(lst2, > function(x) > rollapply(x,width=32,FUN=function(z) {z1 <- as.data.frame(z); > if(!sum(!!rowSums(is.na(z1 {l1 <-lm(r~F.1+F.2+F.3,data=z1); > c(coef(l1), pval=summary(l1)$coef[,4], rsquare=summary(l1)$r.squared) } > el

[R] (no subject)

2013-12-01 Thread Francisco J. Zagmutt
Hey! http://expertiza-tv.ru/_1b3a_your.time.came_e5c2_.html?hicjpocix148039 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE

Re: [R] Problems dealing with matrices

2013-12-01 Thread David Winsemius
On Nov 30, 2013, at 8:45 PM, halim10-fes wrote: > Hi Arun, > > Thank you very much for your kind response. Sorry for my delayed response. > Your solutions for the first two questions are quite good for my purpose. > Since nobody responded, can you please have a look at the 3rd question? After

Re: [R] Code Help

2013-12-01 Thread Rolf Turner
On 12/02/13 03:04, jeet chandvaniya wrote: Hi, sir i want help to develop code for outlier detection in r language, so help me for this. I recall that Monty Python did a skit that seems relevant here. The skit involved instructions on how to learn to play the flute and how to solve all the

Re: [R] Removing NAs from matrix

2013-12-01 Thread arun
Hi, Try: ?rowMeans rowMeans(mat,na.rm=TRUE) A.K. On Sunday, December 1, 2013 1:15 PM, Amie Hunter wrote: Hello R users, I'm new to R so apologies if this question seems simple. I have a matrix which is 35000 columns by 35000 rows and I’m wanting to work out the mean of each row. I've tried

Re: [R] factor() in lm

2013-12-01 Thread Gary Dong
Thanks, Bert. It seems I got these NAs because I already had MSA population controlled for in my model, besides the fixed effect variable, which led to overestimation. Those NAs disappeared after I dropped the population variable. Gary On Sun, Dec 1, 2013 at 10:27 AM, Bert Gunter wrote: > You

Re: [R] Removing NAs from matrix

2013-12-01 Thread Rui Barradas
Hello, Your code corrected would be mean.matrix[, 1] <- apply(mat, 1, mean, na.rm = TRUE) (No need for the for loop). Even better would be to avoid loops and use the base R function ?rowMeans. mean.matrix[, 1] <- rowMeans(mat, na.rm = TRUE) Hope this helps, Rui Barradas Em 01-12-2013 12:16

Re: [R] factor() in lm

2013-12-01 Thread Bert Gunter
You may wish to talk to a local statistician or read up on linear models, as you appear to not understand some basics. Anyway, either 1. You have other covariates in your model that you haven't shown and your model is overdetermined. 2. You have NA's in your data that causes 1) to occur. As an e

[R] How to create polygons representing sampled forest plots, and how to compute D1 matrix between these polygons ?

2013-12-01 Thread David Bauman
Hi everyone, I am facing a problem I really do not know how to resolve about detecting significant spatial structures in a region I am studying. The study is about the Miombo forest (wooded savanna). I am working in a 10 ha permanent forest plot, where all trees are mapped and identified. I sampl

[R] Fw: Problems dealing with matrices

2013-12-01 Thread arun
Hi Halim, I tried, but couldn't come up with a solution. Regards, Arun On Sunday, December 1, 2013 1:26 AM, halim10-fes wrote: Hi Arun, Thank you very much for your kind response. Sorry for my delayed response. Your solutions for the first two questions are quite good for my purpose.

[R] Code Help

2013-12-01 Thread jeet chandvaniya
Hi, sir i want help to develop code for outlier detection in r language, so help me for this. Thanks, Jitendra R Chandvaniya BE Computer,(M.TECH(Pursuing)). RK University, 9824567443 Gujarat. __ R-help@r-project.org mailing list https://stat.ethz.ch/ma

Re: [R] the wilcox.test() and pairwise.wilcox.test are producing different results

2013-12-01 Thread Adel
Thanks Arun! It was simple as that. You suggestion solved it. Best Adel -- View this message in context: http://r.789695.n4.nabble.com/the-wilcox-test-and-pairwise-wilcox-test-are-producing-different-results-tp4681375p4681423.html Sent from the R help mailing list archive at Nabble.com.

[R] Removing NAs from matrix

2013-12-01 Thread Amie Hunter
Hello R users, I'm new to R so apologies if this question seems simple. I have a matrix which is 35000 columns by 35000 rows and I’m wanting to work out the mean of each row. I've tried using the code below on a smaller version of the matrix, but receive an error: > mat   [,1]  [,2] [,

[R] factor() in lm

2013-12-01 Thread Gary Dong
Dear R users, I am running a linear regression in R. My observations are Census Tracts in several metropolitan areas (MSAs). In my data set, each MSA has at least 50 observations. I use factor(msa_code) in the lm formula to control for metropolitan fixed effects. But I kept getting something like

Re: [R] How to vectorize plot graphic?

2013-12-01 Thread Alexander Shenkin
Thanks Jeff. I'm not sure to which manual you are referring. Nothing like what you mention is found here: http://cran.r-project.org/manuals.html . Perhaps you're referring to The Data Import/Export Manual, but that wouldn't make sense. Googling "R Input/Output manual" doesn't help. Regarding t

Re: [R] How to vectorize plot graphic?

2013-12-01 Thread Alexander Shenkin
Thanks Carl. Yeah, I can get vectorized graphics out via ggsave("temp.pdf") too. But I need to add the graphic to a word doc on windows. Hence the desire to use wmf, which should induce a vector format (shouldn't it?). On 12/1/2013 10:39 AM, Carl Witthoft wrote: > Off the top of my head, I'd s

Re: [R] How to vectorize plot graphic?

2013-12-01 Thread Jeff Newmiller
You have mentioned nothing about the device you are writing the plot to. If to the default and you are copying it from there as a bitmap, then what you are describing sounds as expected. Read the R Input/Output manual (again) for other output options.

Re: [R] How to get the proportions of data with respect to two variables in R?

2013-12-01 Thread jim holtman
Here is an example using data.table to get the proportion for the Length/Width: > input <- read.table(text = "'ID' 'Class' 'Length' 'Width' + 2 2 13.5 4.5 + 2 2 13.5 4.5 + 2 2 13.5 4.5 + 2 2 13.5 4.5 + 3 2 13.5 4.0 + 3 2 13.5 4.0 + 3 2 13.5 4.0 + 3 2 13.5 4.0 + 4 2 10.0 4.5 + 4 2 10.0 4.5 + 4 2 10

Re: [R] GotoBLAS2 with multiple cores

2013-12-01 Thread Stefan Evert
Your report sounds somewhat similar to problems I encountered with OpenBLAS on Ubuntu Linux (which is a maintained version of GotoBLAS; I couldn't get the latter to compile properly). OpenBLAS uses OpenMP for parallelization. Once linked into R, other OpenMP-based code would only use a single

Re: [R] How to vectorize plot graphic?

2013-12-01 Thread Carl Witthoft
Off the top of my head, I'd suggest trying ggsave() with the extension ".svg" . I realize that SVG files are not recognized by some image display apps (Microsoft Windows I'm looking at YOU), but IMHO it's the best choice for vectorized images. Alexander Shenkin wrote > Hi Folks, > > Using gg

[R] How to vectorize plot graphic?

2013-12-01 Thread Alexander Shenkin
Hi Folks, Using ggplot, I've produced the following graphic: http://i.imgur.com/39a139C.png The graphics in the plot seem to be bitmapped and not vectorized. That is, the vertical and horizontal lines jump rows of pixels instead of having just nice, angled lines. Any thoughts about how to get t

Re: [R] How to get the proportions of data with respect to two variables in R?

2013-12-01 Thread umair durrani
Thanks for your answers Arun. Unfortunately the code didn't work and I am getting the error: arguments must have same length. Here are sample input and output: INPUT: Vehicle ID Vehicle Class Vehicle Length Vehicle Width 2 2 13.5 4.5 2 2 13.5 4.5 2 2 13.5 4.5 2 2 13.5 4.5 3 2 13.5 4.0 3 2 13.5 4.