[R] Raster in parallel computing?

2014-01-07 Thread Camilo Mora
Hi everyone, I am using the package "raster" to interpolate a large number of rasters (~1million) of different resolutions to a unique 1degree resolution grid and wonder if you know if it is possible to do this in parallel computer?. My code (example below) works like a charm but it will

[R] Different colours for LatticeExtra graphs

2014-01-07 Thread Alvaro
Hello, I am using the "panel.3dpolygon" function from the LatticeExtra package. I am graphing a matrix. I can't find a way in which each polygon is presented in a different color. The description of the function says that the "col" argument permits vectors (the components of which are colors) to

Re: [R] Patterns on postal codes

2014-01-07 Thread Frede Aakmann Tøgersen
Hi Something like this. ## 4 valid zips + 4 invalid zips zipcode <- c("22942-0173", "32601", "N9YZE6", "S7V 1J9", "0022942-0173", "32-601", "NN9YZE6", "S7V 1J9") tmp <- gsub("[[:space:]]", "_", zipcode) tmp <- gsub("[[:alpha:]]", "A", tmp) tmp <- gsub("[[:digit:]]", "N", tmp) tmp ## [1] "

Re: [R] Implementing A Formula

2014-01-07 Thread Frede Aakmann Tøgersen
Hi Is is something like this that you want? mydata <- data.frame(a=1:10, b=11:20, c=21:30, d=31:40, e=41:50) myfun <- function(a,b,c)a*b+c mydata$cool <- do.call(myfun, mydata[,c("a", "b", "c")]) mydata ## a b c d e cool ## 1 1 11 21 31 41 32 ## 2 2 12 22 32 42 46 ## 3 3 13

[R] Patterns on postal codes

2014-01-07 Thread Jeff Johnson
Hi all, I'm pretty new to R and have a question. I have a postal_code field which can have a variety of values such as: For US postal codes: 22942-0173 or 32601 For Canada postal codes: N9YZE6 or S7V 1J9 What I want to do is represent these as patterns, such as: US: N- or N Canada: AN

[R] Implementing A Formula

2014-01-07 Thread Norman McBride
Hello R Mailing List Members, My name is Peter. I am a high school student who is doing a senior thesis in statistical analysis. As you can see that I have chosen R. So for the project I am working with a member of the US Navy and analyzing some data. So for this data I am using a formula to

Re: [R] Dataset to single column matrix

2014-01-07 Thread arun
Hi, You could try: mat1 <- matrix(1:(272*12),ncol=12,byrow=TRUE)  mat2 <- t(mat1)  dim(mat2) <- c(272*12,1) #or mat3 <- matrix(as.vector(mat2),ncol=1) identical(mat2,mat3) #[1] TRUE A.K. Hello, I am pretty new to R and would like to transform my 272x12 matrix into a 3264X1. I'm trying to ha

Re: [R] How to detect a sequence of NA values?

2014-01-07 Thread arun
Hi, Try: rl <- rle(is.na(a))  max(rl$lengths[rl$values]) #[1] 3 A.K. Hi, I'd like to detect whether a vector contains a sequence of NA values of a certain length. So, for example, if I have a vector a = c(1,NA,NA,4,NA,NA,NA,5); how can I find what the longest sequence of NAs is (in this ca

Re: [R] Dataset to single column matrix

2014-01-07 Thread Rolf Turner
On 08/01/14 15:09, Ista Zahn wrote: On Tue, Jan 7, 2014 at 8:30 PM, Pete Brecknock wrote: Krishia wrote Hello, I am pretty new to R and would like to transform my 272x12 matrix into a 3264X1. I'm trying to have the setup change from: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 13,14,15,16,17,1

Re: [R] How do I perform conditional annotation of lattice panel plots?

2014-01-07 Thread Duncan Mackay
Hi George If you did not want a line through the point try this xyplot(Activity ~ Day | Subject, data = Data,pch = ifelse(is.na(Data$EventA), 1,16), col = ifelse(is.na(Data$EventA), 4,2)) You could make a column of it otherwise change EventA to numeric - easier to work with Regards Duncan Du

Re: [R] Dataset to single column matrix

2014-01-07 Thread Ista Zahn
On Tue, Jan 7, 2014 at 8:30 PM, Pete Brecknock wrote: > Krishia wrote >> Hello, >> I am pretty new to R and would like to transform my 272x12 matrix into a >> 3264X1. I'm trying to have the setup change from: >> >> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 >> 13,14,15,16,17,18,19,20,21,22, 23, 24

Re: [R] Dataset to single column matrix

2014-01-07 Thread Pete Brecknock
Krishia wrote > Hello, > I am pretty new to R and would like to transform my 272x12 matrix into a > 3264X1. I'm trying to have the setup change from: > > 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 > 13,14,15,16,17,18,19,20,21,22, 23, 24 > etc. > > to > > 1 > 2 > 3 > 4 > 5 > 6 > 7 > 8 > 9 > 10 >

Re: [R] Levelplots with non-continuous x-axis breaks

2014-01-07 Thread Adams, Jean
Patrick, You should cc r-help on all correspondence so that others can follow the thread. The color range will be matched to the "x" argument you provide to the color.scale function (in package plotrix). So you don't need to manually provide the min and max yourself. If for some reason you did

Re: [R] about R

2014-01-07 Thread Greg Snow
Look at the mvrnorm function in the MASS package. The within or transform functions may also be of use to you in creating the data as a combination of the factors that you create using mvrnorm. On Tue, Jan 7, 2014 at 2:15 PM, sevda datlı wrote: > Hello, > > I am a master student in Educational

[R] about R

2014-01-07 Thread sevda datlı
Hello, I am a master student in Educational Measurement and Evaluation, my thesis subject is “comparison of estimation methods used for confirmatory factor analysis”. For my thesis study, I need to generate datas that provides some features. I will generate these datas by changing correlation betw

Re: [R] A calculation in data.frame

2014-01-07 Thread arun
HI, May be this helps: library(reshape2)  df1 <- dcast(DF,A2~A1,value.var="A3") z <- function(a,b,c){a+2*b+c}   within(df1, newCol <- z(a,b,c)) #  A2 a b c newCol #1  m 1 4 7 16 #2  n 2 5 8 20 #3  p 3 6 9 24 On Tuesday, January 7, 2014 4:15 PM, Ron Michael wrote: Hi, I have to

Re: [R] A calculation in data.frame

2014-01-07 Thread Duncan Murdoch
On 14-01-07 3:21 PM, Ron Michael wrote: Hi, I have to perform some formula driven calculation in a data.frame (as defined below). Let say I have following DF: DF <- data.frame(A1 = c('a', 'a', 'a', 'b', 'b', 'b', 'c', 'c', 'c'), A2 = c('m', 'n', 'p', 'm', 'n', 'p', 'm', 'n', 'p'), A3 = c(1,2

[R] A calculation in data.frame

2014-01-07 Thread Ron Michael
Hi, I have to perform some formula driven calculation in a data.frame (as defined below). Let say I have following DF: > DF <- data.frame(A1 = c('a', 'a', 'a', 'b', 'b', 'b', 'c', 'c', 'c'), A2 = > c('m', 'n', 'p', 'm', 'n', 'p', 'm', 'n', 'p'), A3 = c(1,2,3,4,5,6,7,8,9)) > DF   A1 A2 A3 1  a  

Re: [R] Packaging: Doubt in relation with "R CMD Rd2pdf packagename"

2014-01-07 Thread Duncan Murdoch
On 14-01-07 3:35 PM, Eva Prieto Castro wrote: Hi Rich, Hi everybody I have solved the problem!. I installed MikTeX 2.9 again, but this time I chose basic installation (the other one I had chosen complete installation). I noticed a diference if we compare with the previous situation: now R and

Re: [R] Packaging: Doubt in relation with "R CMD Rd2pdf packagename"

2014-01-07 Thread Eva Prieto Castro
Hi Rich, Hi everybody I have solved the problem!. I installed MikTeX 2.9 again, but this time I chose basic installation (the other one I had chosen complete installation). I noticed a diference if we compare with the previous situation: now R and MikTeX are installed in the same folder (Progra

Re: [R] Levelplots with non-continuous x-axis breaks

2014-01-07 Thread Adams, Jean
Patrick, You were pretty close. To fix the code you have, just change "matrix" to "mymatrix" in two places, and either specify the argument data= or place the heat.colors bit first in the matrix function. Or ... you could use the array() function instead, to shorten up the code a little. myc

Re: [R] Packaging: Doubt in relation with "R CMD Rd2pdf packagename"

2014-01-07 Thread Eva Prieto Castro
Hi again: Rich, I see your messages but they are sent to another mail address so I have to write from here without using your answer. I think the problem is that inconsolata.sty is not found, and zi4.sty is not found. I have read several documents in www about this question but I can not solve

Re: [R] with() and within() functions inside lapply() not seeing outside of its environment?

2014-01-07 Thread peter dalgaard
On 07 Jan 2014, at 19:19 , Duncan Murdoch wrote: > I wouldn't call it a bug, but it's a documented limitation, if you know how > to read it. As documented, the expression is evaluated with the caller's > environment as the parent environment. But here the caller is some code in > lapply, no

Re: [R] How to "apply" correctly.

2014-01-07 Thread Keith S Weintraub
Thanks Patrick, That did the trick. Oddly enough (or maybe not that oddly) I was looking through "The R Inferno" to try and find the answer. Since I often forget that there are other parameters available to '[' I never made it to 8.1.44 on dropping dimensions. Hopefully this lesson will stick

Re: [R] How to "apply" correctly.

2014-01-07 Thread Patrick Burns
I think you will be okay if you change one line to: defMat<-sapply(defData[,-1, drop=FALSE], function(x) breakUpFun(freq, x)) In your example that doesn't work you are ending up with a vector rather than a one column data frame. Pat On 07/01/2014 17:44, Keith S Weintraub wrote: Folks, # I h

Re: [R] with() and within() functions inside lapply() not seeing outside of its environment?

2014-01-07 Thread Duncan Murdoch
On 07/01/2014 10:35 AM, Pavel N. Krivitsky wrote: Hi, I have a list of sublists, and I want to add and/or remove elements in each sublist in accordance with a code snippet. I had thought that an elegant way to do that is using a combination of lapply() and within(). However, the code in the with

Re: [R] Packaging: Doubt in relation with "R CMD Rd2pdf packagename"

2014-01-07 Thread Richard M. Heiberger
The image suggests that you are missing a font. Someone else might be able to help with that. On Tue, Jan 7, 2014 at 12:50 PM, Eva Prieto Castro wrote: > Thanks Rich. I used your indications, but it was correctly in PATH variable. > My path is C:\Program Files (x86)\MiKTeX 2.9\miktex\bin. > > I

Re: [R] Packaging: Doubt in relation with "R CMD Rd2pdf packagename"

2014-01-07 Thread Eva Prieto Castro
Thanks Rich. I used your indications, but it was correctly in PATH variable. My path is C:\Program Files (x86)\MiKTeX 2.9\miktex\bin. I send you a print. Do you have any other idea?. Thanks again. Eva El Lunes 6 de enero de 2014 23:36, Eva Prieto Castro escribió: Hi everybody, I ha

[R] How to "apply" correctly.

2014-01-07 Thread Keith S Weintraub
Folks, # I have the following function: breakByFreq<-function(freq, defData) { breakUpFun<-function(freq, defs) { if(freq != 1) { defs<-diff(c(0, defs)) defs<-cumsum(rep(defs/freq, each = freq)) } defs } defMat<-sapply(defData[,-1], function(x) breakUpFun(freq, x))

[R] Question regarding the package rugarch

2014-01-07 Thread Grünenfelder Corina
Dear all, I have a question regarding the package rugarch. I would like to fit a garch model with exogenous variables using rugarch. My code is as follows, where data.reg is a time series object where the first column corresponds to the response variable and the remainder columns are the exoge

[R] with() and within() functions inside lapply() not seeing outside of its environment?

2014-01-07 Thread Pavel N. Krivitsky
Hi, I have a list of sublists, and I want to add and/or remove elements in each sublist in accordance with a code snippet. I had thought that an elegant way to do that is using a combination of lapply() and within(). However, the code in the within() call doesn't seem to be able to see objects out

Re: [R] How do I perform conditional annotation of lattice panel plots?

2014-01-07 Thread Ken Knoblauch
Chen, George roswellpark.org> writes: > My apologies for asking this question that may have been asked before. I am trying to plot activity > dependent on time conditioned by the subject. Code for sample data below. > So I have something like this > xyplot(Activity~Time|Subject). > This works fi

Re: [R] help

2014-01-07 Thread PIKAL Petr
Hi You have got an extensive explanation by Frede Aakmann Tøgersen. I consider it pretty strightforward and I do not have anything to add. Do not expect that somebody can change your result, if your data does not support it. Regards Petr > -Original Message- > From: r-help-boun...@r-

Re: [R] NAs introduced by coercion warning, while plotting data

2014-01-07 Thread Baro
thank you sir, it works On Tue, Jan 7, 2014 at 7:27 AM, jim holtman wrote: > You may want to understand how your data is coming out of Excel. You > are getting just a single character string. Here is code to convert > the string to numerics and plot: > > x <- " 7.0121, -0.673354, 0.749622, -0

Re: [R] NAs introduced by coercion warning, while plotting data

2014-01-07 Thread PIKAL Petr
Hi I usually read data from Excel this way. open Excel file mark values you want to copy press Ctrl-C type in R command window datalist <- read.delim("clipboard") in that case datalist shall be data.frame with probably one column so plot(datalist[,1],type="l",ylim=c(-1,+1)) shall do what you

Re: [R] NAs introduced by coercion warning, while plotting data

2014-01-07 Thread jim holtman
You may want to understand how your data is coming out of Excel. You are getting just a single character string. Here is code to convert the string to numerics and plot: x <- " 7.0121, -0.673354, 0.749622, -0.549641, 0.435662, -0.328995, 0.0869976, -0.0851428, -0.191019, 0.188799, -0.373707, 0.4

Re: [R] NAs introduced by coercion warning, while plotting data

2014-01-07 Thread Baro
I am reading only one Cell of Excel On Tue, Jan 7, 2014 at 7:18 AM, Dániel Kehl wrote: > Hi, > > are you reading only one cell of your Excel file? > It seems your datalist is not numeric but text. > Try saving your Excel file as csv or text, reading in data might be much > more straightforward!

Re: [R] help

2014-01-07 Thread javad bayat
I apologies for asking this question; I run the codes but why all the prediction for pH in 21-25 month are so close? station month pH 1 21 8.275635958 2 21 8.275635962 3 21 8.275635963 4 21 8.275635963 5 21 8.275635963

Re: [R] NAs introduced by coercion warning, while plotting data

2014-01-07 Thread Dániel Kehl
Hi, are you reading only one cell of your Excel file? It seems your datalist is not numeric but text. Try saving your Excel file as csv or text, reading in data might be much more straightforward! best daniel Feladó: r-help-boun...@r-project.org [r-help-b

Re: [R] NAs introduced by coercion warning, while plotting data

2014-01-07 Thread Baro
Thank you sir: If I am tying str(datalist) I have this output chr " 7.0121, -0.673354, 0.749622, -0.549641, 0.435662, -0.328995, 0.0869976, -0.0851428, -0.191019, 0.188799, -0.373707, 0.434814, "| __truncated__ and if I try: dput(datalist) I have: " 7.0121, -0.673354, 0.749622, -0.549641, 0.

Re: [R] NAs introduced by coercion warning, while plotting data

2014-01-07 Thread jim holtman
>From your output, it looks like 'datalist' is a character string and not a numeric vector as you expect. Try doing: str(datalist) to see the structure and to use dput(datalist) to post the data. Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you

Re: [R] NAs introduced by coercion warning, while plotting data

2014-01-07 Thread Baro
thank you for your answer, I am reading my Data from an excel File. This is my R code: srow<-2421 wb <- loadWorkbook("C:\\users\\Babak\\Desktop\\spalte205.xls") dat <-readWorksheet(wb, sheet=getSheets(wb)[1], startRow=srow, endRow=srow, startCol=spalte, endCol=spalte,header=FALSE) datalist<-dat[,1

Re: [R] NAs introduced by coercion warning, while plotting data

2014-01-07 Thread PIKAL Petr
Hi I did not get any error with your data plot(test) dput(test) c(7.0121, -0.673354, 0.749622, -0.549641, 0.435662, -0.328995, 0.0869976, -0.0851428, -0.191019, 0.188799, -0.373707, 0.434814, -0.51979, 0.61944, -0.554766, 0.662571, -0.557779, 0.543724, -0.452397, 0.293651, -0.248438, 0.053278

[R] NAs introduced by coercion warning, while plotting data

2014-01-07 Thread Baro
Hi all I have such a Data and I want to plot them but I get this warning Warning message: In xy.coords(x, y, xlabel, ylabel, log) : NAs introduced by coercion " 7.0121, -0.673354, 0.749622, -0.549641, 0.435662, -0.328995, 0.0869976, -0.0851428, -0.191019, 0.188799, -0.373707, 0.434814, -0.51979

[R] How do I perform conditional annotation of lattice panel plots?

2014-01-07 Thread Chen, George
My apologies for asking this question that may have been asked before. I am trying to plot activity dependent on time conditioned by the subject. Code for sample data below. So I have something like this xyplot(Activity~Time|Subject). This works fine, but now I want to show where on these activ

[R] The R Journal, Volume 5, Issue 2

2014-01-07 Thread Hadley Wickham
Dear all, The latest issue of The R Journal is now available at http://journal.r-project.org/archive/2013-2/ Many thanks to all contributors. Hadley -- Editor-in-chief, The R Journal ___ r-annou...@r-project.org mailing list https://stat.ethz.ch/mail

Re: [R] help

2014-01-07 Thread Frede Aakmann Tøgersen
Dear Javad Bayat I think that people on this list has been most helpful to your with your questions about how to use neural networks in R. Now you have come to the point where you need a more statistical understanding of your data before you can decide whether neural network methods is really

Re: [R] how to plot the spectrum by log-log axis

2014-01-07 Thread Jie Tang
I use windlog=log10(windspec) plot(windlog) it seems good but stupid is there any better method ? 2014/1/7 Jie Tang > Futher more > > When I write as below :,the result is still not satisfied . > asp=spectrum(ww_spec) > windspec=data.frame(asp) > plot(windspec,log="dB") > > > 2014/1/7 Ji

Re: [R] help

2014-01-07 Thread PIKAL Petr
Hi and what is wrong with e.g. fit <- neuralnet(pH~station+month, data=yourdata) As I said I am not an expert in neural nets but here is some explanation how it works http://gekkoquant.com/2012/05/26/neural-networks-with-r-simple-example/ based on that after fitting you could do compute(fit

Re: [R] how to plot the spectrum by log-log axis

2014-01-07 Thread Jie Tang
Futher more When I write as below :,the result is still not satisfied . asp=spectrum(ww_spec) windspec=data.frame(asp) plot(windspec,log="dB") 2014/1/7 Jie Tang > hi > I have a wind dataset and I want to analze its spectrum with > the x-axis and y-axis in log .But I found that > when I set

[R] how to plot the spectrum by log-log axis

2014-01-07 Thread Jie Tang
hi I have a wind dataset and I want to analze its spectrum with the x-axis and y-axis in log .But I found that when I set log="dB" in spectrum as shown below,what I can get is a figure by log y-axis. How could I get a log-axis figure both in x-axis and y-axis ? thank you . yylab<-c("Wind Spectrum(