[R] Read ADCP data in R

2013-03-19 Thread Janesh Devkota
I have ADCP measured data for a river and I am wondering if it is possible to read the ADCP file in R. I found a package called oce but I couldn't read the ADCP file. The function I found in oce package is as follows: read.oce read.adp I have uploaded the sample file here

[R] How can I eliminate a loop over a data.table?

2013-03-19 Thread Matteo Richiardi
I've two data.tables as shown below: *** N = 10 A.DT - data.table(a1 = c(rnorm(N,0,1)), a2 = NA)) B.DT - data.table(b1 = c(rnorm(N,0,1)), b2 = 1:N) setkey(A.DT,a1) setkey(B.DT,b1) *** I tried to change my previous data.frame implementation to a data.table implementation by changing the for-loop

Re: [R] quadprog issues---how to define the constriants

2013-03-19 Thread Enrico Schumann
Hi Jiting, On Fri, 15 Mar 2013, Jiting Xu jiting...@gmail.com writes: Hi list: This is my first time to post my question on the list. Thanks for your help. I am solving a quadratic programming using R. Here is my question: w = arg min 0.5*w'Mw - w'N s. t. sum(w) = 1; w0

Re: [R] How can I eliminate a loop over a data.table?

2013-03-19 Thread Blaser Nello
It seems like this is what you want to do, although there is probably a better way to do it. A.DT - data.table(a1 = A.DT[,a1], a2=sort(ifelse(B.DT[,b2] = N/2 B.DT[,b1] A.DT[nrow(A.DT):1,a1], B.DT[nrow(A.DT):1,b1],

Re: [R] Why stacking rasters return NAs?

2013-03-19 Thread PIKAL Petr
Hi You use several functions which are not base without mentioning their source, therefore you probably won't get much help. I wonder that you do not get error with stack. AFAIK you will get a character vector in dir2. stack a character vector results in error stack(letters) Error in

[R] Online resources for beginners

2013-03-19 Thread Rob Knell
Dear all Just a note to say that I've put up a page of R resources for beginners which some people might find useful here: http://www.introductoryr.co.uk/R_Resources_for_Beginners.html It does include a shameless plug for my book but there's a lot of useful other material as well. Regards

Re: [R] creating a new variable.

2013-03-19 Thread R. Michael Weylandt
On Tue, Mar 19, 2013 at 4:33 AM, Nicole Ford nicole.f...@me.com wrote: Hello, all. The following is for my own research. I have attached the relevant data in pdf from Transparency International. I am only interested in the CPI 2010 scores column. I am interested in creating a variable

[R] xzfile() cannot open the connection, lzma encoder error 5.

2013-03-19 Thread Wang Ming
Dear guangchuang, I was stopped by the following error when using Package: clusterProfiler on R 2.15.3 on windows 7. Error in xzfile(file, “wb”, compression = 9) : Cannot open the connection In addition: warning message: cannot initialize lzma encoder, error 5 The too functions:

Re: [R] Superscript followed by number then superscript in text

2013-03-19 Thread Benjamin Gillespie
Thanks to Dennis, Thomas and Rui - I was missing the ~. Many thanks, Ben Gillespie Research Postgraduate From: Dennis Murphy [djmu...@gmail.com] Sent: 18 March 2013 20:47 To: Benjamin Gillespie Subject: Re: [R] Superscript followed by number then

Re: [R] Why stacking rasters return NAs?

2013-03-19 Thread Jonsson
Thanks. Could you please tell me how to stack all those files properly? -- View this message in context: http://r.789695.n4.nabble.com/Why-stacking-rasters-return-NAs-tp4661706p4661784.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] Fit a mixture of lognormal and normal distributions

2013-03-19 Thread Marc Girondot
Le 18/03/13 16:24, To . . a écrit : x.1-rnorm(6000, 2.4, 0.6)x.2-rlnorm(1, 1.3,0.1)X-c(x.1, x.2) hist(X,100,freq=FALSE, ylim=c(0,1.5))lines(density(x.1), lty=2, lwd=2)lines(density(x.2), lty=2, lwd=2)lines(density(X), lty=4) Here is a solution: x.1-rnorm(6000, 2.4, 0.6) x.2-rlnorm(1,

Re: [R] Why stacking rasters return NAs?

2013-03-19 Thread PIKAL Petr
Hi Please describe what do you mean by stacking files? Stack takes each numeric column of data frame and transform it to two column data frame with one column being numeric value and the other column an indicator based on column name. see head(iris) Sepal.Length Sepal.Width Petal.Length

Re: [R] Why stacking rasters return NAs?

2013-03-19 Thread Jonsson
stacking the rasters will make them as multi layers as they have the same dimension exten ... so as one layer. so we can do calculation with them. -- View this message in context: http://r.789695.n4.nabble.com/Why-stacking-rasters-return-NAs-tp4661706p4661787.html Sent from the R help mailing

Re: [R] R web application development

2013-03-19 Thread Marc Girondot
Take a look at this package: http://www.rstudio.com/shiny/ Sincerely Marc Girondot Le 19/03/13 00:55, John linux-user a écrit : Dear all, I am wondering if what would be the simple way to develop a simple web application that runs R. That is, the web application allows any user upload a

Re: [R] Why stacking rasters return NAs?

2013-03-19 Thread Michael Sumner
Jonsson: you do yourself no favours by repeating bad questions on multiple forums. https://stat.ethz.ch/pipermail/r-sig-geo/2013-March/017830.html http://stackoverflow.com/questions/15496681/calculate-the-moving-average-across-binary-files (For others, the original q is about raster::stack,

Re: [R] Why stacking rasters return NAs?

2013-03-19 Thread PIKAL Petr
Hi -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Jonsson Sent: Tuesday, March 19, 2013 11:56 AM To: r-help@r-project.org Subject: Re: [R] Why stacking rasters return NAs? stacking the rasters will make them as multi

[R] Copying rows in data frames

2013-03-19 Thread Sahana Srinivasan
Hi, I'm trying to copy the first row of one data frame to another. This is the statement I am using : df2[1,]-df1[1,]; I have printed them out separately: df1[1,] = A C D E F But after copying: df2[1,] = 96 29 88 122 68 Why isn't it copying? They are both data frames, and as.character isn't

Re: [R] Copying rows in data frames

2013-03-19 Thread Ista Zahn
show us the data. On Tue, Mar 19, 2013 at 7:55 AM, Sahana Srinivasan sahanasrinivasan...@gmail.com wrote: Hi, I'm trying to copy the first row of one data frame to another. This is the statement I am using : df2[1,]-df1[1,]; I have printed them out separately: df1[1,] = A C D E F But

Re: [R] Copying rows in data frames

2013-03-19 Thread Sahana Srinivasan
I.. did? Here is the whole thing: Output dataframe, df2: (NA is because I haven't filled those cells in yet, but they will have numeric values) 1462696298812268108381201091254781626868918410126662NANANANANANANANANANANANA NANANANANANANANANA Input dataframe, df1:

Re: [R] Copying rows in data frames

2013-03-19 Thread Berend Hasselman
On 19-03-2013, at 13:06, Sahana Srinivasan sahanasrinivasan...@gmail.com wrote: I.. did? Here is the whole thing: Output dataframe, df2: (NA is because I haven't filled those cells in yet, but they will have numeric values)

Re: [R] Copying rows in data frames

2013-03-19 Thread arun
Hi, set.seed(25)  df1- as.data.frame(matrix(sample(LETTERS[1:10],20,replace=TRUE),ncol=5),stringsAsFactors=FALSE)  df1 #  V1 V2 V3 V4 V5 #1  E  B  A  J  F #2  G  J  C  F  H #3  B  G  D  G  E #4  I  D  D  B  H  str(df1) #'data.frame':    4 obs. of  5 variables: # $ V1: chr  E G B I # $ V2: chr  B

Re: [R] Copying rows in data frames

2013-03-19 Thread Sahana Srinivasan
Sorry the result is long, the dimensions of the data frama are 4626x21. I didn't know if I should truncate anything. dput(head(df2)) structure(list(X1 = c(4626, NA, NA, NA, NA, NA), X2 = c(96, NA, NA, NA, NA, NA), X3 = c(29, NA, NA, NA, NA, NA), X4 = c(88, NA, NA, NA, NA, NA), X5 = c(122, NA,

[R] Cumulative Frequency Graph

2013-03-19 Thread Shane Carey
Hi, I am trying to create a Cumulative Frequency graph and I am using the following example: http://www.r-tutor.com/elementary-statistics/quantitative-data/cumulative-frequency-graph When I plot this data, how do I put in real values on the x-axis, rather than the values that are used for the

Re: [R] R web application development

2013-03-19 Thread Andreas Recktenwald
Am 19.03.2013 01:11, schrieb John linux-user: Thanks for reply, but which archives? Thanks again. John From: Stephen Sefick ssef...@gmail.com Cc: r-help@r-project.org r-help@r-project.org Sent: Monday, March 18, 2013 8:02 PM Subject: Re: [R] R web

Re: [R] data.frame with NA

2013-03-19 Thread Pietro
Yes, colClasses is the solution. Thank you very much. However i found a very strange thing. If i use: Foglio1 - read.xlsx2(mydb.xlsx, 1, colClasses=c(Date, rep(numeric,14))) i get numeric dataframe, as you said. I also get NaN (and not NA). At this point i use the function: Foglio1 =

[R] Eror : OutOfMemoryError (Java): Java heap space

2013-03-19 Thread sisi26
Hi, i want to create xlsx sheet, all things seems to be perfect until this erro message Erreur : OutOfMemoryError (Java): Java heap space i have xp system, (32bit) I tried the following syntax options(java.parameters = -Xmx1000m) options(java.parameters = -Xms=3670K) writeWorksheet(wb,

[R] fisher.alpha warnings

2013-03-19 Thread Kulupp
I have two vectors (a and b) with counts of animals and wanted to calculate fisher's alpha: library(vegan) a - c(2043, 1258, 52, 1867, 107, 1624, 2, 157, 210, 402, 5, 107, 267, 2, 13683) b - c(2043, 1258, 52, 1867, 107, 1624, 2, 157, 210, 402, 5, 107, 267, 2, 3000) fisher.alpha(a)

Re: [R] try/tryCatch

2013-03-19 Thread jim holtman
I would assume that if the code were as follows that the error could the caught and the loop continued: metatrials-function(mydata){ a-matrix(data=NA, nrow=dim(mydata)[3], ncol=5) colnames(a)=c(sens, spec, corr, sens_se, spec_se) for(ii in 1:dim(mydata)[3]){ tmp-mydata[,,ii]

Re: [R] Copying rows in data frames

2013-03-19 Thread arun
Hi, In your original message, you were trying to copy the colnames of df1.  I am not sure that is what you wanted.  Also, there were some spaces between the columns, which I had to delete. This is how your dataset looks like now:

Re: [R] data.frame with NA

2013-03-19 Thread David L Carlson
Try this instead: Foglio1[,2:ncol(Foglio1)] - na.locf(Foglio1[,2:ncol(Foglio1)],fromLast=T) str(Foglio1) 'data.frame': 1489 obs. of 15 variables: $ Date: Date, format: 2001-08-17 2001-08-20 ... $ a : num 202 201 202 201 202 ... $ b : num 231 230 230 230 232 ... $ c : num 177 179

Re: [R] data.frame with NA

2013-03-19 Thread PIKAL Petr
Hi -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Pietro Sent: Tuesday, March 19, 2013 12:10 PM To: dcarl...@tamu.edu; dcarl...@tamu.edu Cc: r-h...@stat.math.ethz.ch Subject: Re: [R] data.frame with NA Yes, colClasses is

Re: [R] Copying rows in data frames

2013-03-19 Thread arun
Just by reading your dataset (without any modifications) datNew- read.table(data.seq.ptseq.rescount.txt,sep=\t) str(datNew) 'data.frame':    4625 obs. of  22 variables:  $ GENE: logi  NA NA NA NA NA NA ...  $ X   : int  29 19 1 13 7 42 44 4 6 13 ...  $ A   : int  0 3 0 0 1 2 2 1 3 1 ...  $ C   :

Re: [R] Cokriging

2013-03-19 Thread Jon Olav Skoien
Nishani, we do not have access to your data, but I guess the problem is the size of the observation data set. I think the default of predict.gstat is to create one covariance matrix between all observation locations, which would be a 50,000*50,000 matrix in your case. The alternative is to do

[R] How to get the rolling standard deviation in rasters?

2013-03-19 Thread Jonsson
I am using this code to calculate the moving average mean.It worked fine but when I wanted to also calculate based on sd(stander deviation) I got the error shown below. I read this documentation of R movingFun and found that sd was mentioned at

Re: [R] Cumulative Frequency Graph

2013-03-19 Thread Rui Barradas
Hello, Try setting the argument xaxt (x axis type) to n (no x axis) and then use ?axis. plot(breaks, cumfreq0,# plot the data main=Old Faithful Eruptions, # main title xlab=Duration minutes,# x−axis label ylab=Cumulative eruptions, # y−axis label xaxt = n)

Re: [R] Mantel test for comparing two matrices

2013-03-19 Thread Sarah Goslee
Hi, A Mantel test doesn't test significant differences between matrices. It tests for significant correlations between dissimilarities. If your hypothesis is best expressed in terms of distances, then using the Mantel test is appropriate. As for size, 2000 by 2000 is not unmanageable, even if

Re: [R] Cumulative Frequency Graph

2013-03-19 Thread Shane Carey
Hi Rui, Thanks. This works fine, but how do I only have showing the values where the breaks are? For my duration data, I have over 3541 records and I only want to show the data at the breaks. Thanks On Tue, Mar 19, 2013 at 2:00 PM, Rui Barradas ruipbarra...@sapo.pt wrote: Hello, Try

Re: [R] Counting confidence intervals

2013-03-19 Thread S Ellison
There _is_ a function ?within. Drat! of course there is. I even use it, though not often. Maybe your function can be named 'between' Good thought - thanks Steve E *** This email and any attachments are confidential. Any

[R] Do association study based on mixed linear model

2013-03-19 Thread Yao He
Dear All I want to do association study based on mixed linear model, My model not only includes serval fixed effects and random effects but also incorporates some covariates such as birth weight. Otherwise, the size of the data are about 180 individuals and 12 variables and 6 Fixed effect

[R] linear model with equality and inequality (redundant) constraints

2013-03-19 Thread Camarda, Carlo Giovanni
Dear R-users, in the last days I have been trying to estimate a normal linear model with equality and inequality constraints. Please find below a simple example of my problem. Of course, one could easily see that, though the constraints are consistent, there is some redundancy in the

Re: [R] How to get the rolling standard deviation in rasters?

2013-03-19 Thread Peter Ehlers
On 2013-03-19 06:41, Jonsson wrote: I am using this code to calculate the moving average mean.It worked fine but when I wanted to also calculate based on sd(stander deviation) I got the error shown below. I read this documentation of R movingFun and found that sd was mentioned at

Re: [R] Cumulative Frequency Graph

2013-03-19 Thread Peter Ehlers
On 2013-03-19 07:06, Shane Carey wrote: Hi Rui, Thanks. This works fine, but how do I only have showing the values where the breaks are? For my duration data, I have over 3541 records and I only want to show the data at the breaks. Thanks The first thing to try is read the help page!

[R] how to do association study based on mixed linear model

2013-03-19 Thread Yao He
Dear All: I want to do association study based on mixed linear model, My model not only includes serval fixed effects and random effects but also incorporates some covariates such as birth weight. Otherwise, the size of the data are about 180 individuals and 12 variables and 6 Fixed effect

Re: [R] how to do association study based on mixed linear model

2013-03-19 Thread Bert Gunter
You need to do some reading and stop posting here. All your questions can be answered by reading the appropriate Help pages of the packages you mentioned and associated references. And what, pray tell, is reml-R and what does is not free mean? (the packages you mentioned are part of open source

Re: [R] new question

2013-03-19 Thread arun
I deleted the 't' subfolders from the dados folder. If you don't have 't' folders, wouldn't it be better to use: directory- /home/arunksa111/dados FacGroup-c(0,1,0,2,2,0,0) #instead of #FacGroup-c(0,1,0,2,2,0,3) FacGroup-c(0,1,0,2,2,0,3)  lista[FacGroup!=0] #[1]

[R] Cluster analysis on weighted survey data with continuous and categorical variables

2013-03-19 Thread Emma Gibson
I am trying to perform cluster analysis on survey data where each respondent has answered several questions, some of which have categorical answers (blue pink green etc) and some of which have scale answers (rating from 1 to 10 etc).My problem is that certain age groups were over-sampled and I

Re: [R] Copula package - normalCopula() param order

2013-03-19 Thread Martin Maechler
Lucas Holland hollandlu...@gmail.com on Sun, 17 Mar 2013 16:26:41 +0100 writes: Hey all, I'm trying to construct a 7-dimensional normal copula using the copula package. I'd like to supply as parameter a randomly generated correlation matrix (that I'll convert to a vector so I

[R] Lars package

2013-03-19 Thread Giovanni Giacomin
Hi,   I'm using lars package to run some regression analysis and my doubt now is how can I predict my model to another dataset? Let me explain a little better: I have a dataset from which I withhold some data. With the data that wasn't withheld, I create the model. Now, what I'm not being able

Re: [R] Lars package

2013-03-19 Thread Bert Gunter
Try using the elasticnet package instead, where I believe what you want is part of the package functionality. If I am not mistaken, elasticnet largely supercedes lars -- but (someone) please correct me if I'm wrong. -- Bert On Tue, Mar 19, 2013 at 9:40 AM, Giovanni Giacomin

Re: [R] how to do association study based on mixed linear model

2013-03-19 Thread Ben Bolker
Yao He yao.h.1988 at gmail.com writes: Dear All: I want to do association study based on mixed linear model, My model not only includes serval fixed effects and random effects but also incorporates some covariates such as birth weight. Otherwise, the size of the data are about 180

[R] List of default packages (that come with R)

2013-03-19 Thread Saptarshi Guha
Hello, Is there an R function that tells me the packages that come with R e.g. c(base,boot,methods,mgcv,...) Thank you Saptarshi [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

Re: [R] List of default packages (that come with R)

2013-03-19 Thread William Dunlap
Assuming you haven't removed any core packages you could look at the Priority column in the output of installed.packages(). I think all the ones marked base or recommended are shipped with R: i - installed.packages() i[ i[,Priority] %in% c(base,recommended), c(Package, Priority)]

Re: [R] List of default packages (that come with R)

2013-03-19 Thread Gabor Grothendieck
On Tue, Mar 19, 2013 at 2:36 PM, Saptarshi Guha saptarshi.g...@gmail.com wrote: Hello, Is there an R function that tells me the packages that come with R e.g. c(base,boot,methods,mgcv,...) If you use the default configuration of R that makes use of a user library then this will show the

Re: [R] Cluster analysis on weighted survey data with continuous and categorical variables

2013-03-19 Thread Thomas Lumley
On Wed, Mar 20, 2013 at 3:55 AM, Emma Gibson waterbab...@hotmail.comwrote: I am trying to perform cluster analysis on survey data where each respondent has answered several questions, some of which have categorical answers (blue pink green etc) and some of which have scale answers (rating

[R] How to get the t-stat for arima()?

2013-03-19 Thread Yuan, Rebecca
Hello all, fit = arima() and Summary(fit) will give some summary of the fit. However, the t-stats are not shown in the summary. How can I get the t-stats of it? Thanks, Rebecca -- This message, and any attachments, is for the

[R] Error when adding lines to a plot using the mixed-effect model and metafor package

2013-03-19 Thread Hewitt, Charlotte
Hi, I am a student using R for my final year project, with the metafor package being particularly helpful. I have been following the steps laid out in the manual 'Conducting Meta-analysis in R with the Metafor package' (Viechtbauer, 2010) and applying it to my own data of infected Anopheles

Re: [R] How to get the t-stat for arima()?

2013-03-19 Thread Rui Barradas
Hello, Using a dataset in package datasets, n - length(lh) fit - arima(lh, order = c(1,0,0)) se - sqrt(diag(vcov(fit))) sqrt(n - 1)*coef(fit)/se # T stats Hope this helps, Rui Barradas Em 19-03-2013 20:22, Yuan, Rebecca escreveu: Hello all, fit = arima() and Summary(fit) will give

[R] Epple and McCallum TSLS example

2013-03-19 Thread 敷田治誠 クラウジオ
Hello, I am trying to replicate the missing example of a TSLS estimation in Epple McCallum (link below) http://wpweb2.tepper.cmu.edu/facultyadmin/upload/ppaper_32774807225408_Epple-McCallum93.pdf According to them, the commands are in:

Re: [R] How to get the t-stat for arima()?

2013-03-19 Thread Rui Barradas
Hello, Sorry for the error, the sqrt(n - 1) is wrong. Delete it: t.stat - coef(fit)/se Rui Barradas Em 19-03-2013 21:11, Rui Barradas escreveu: Hello, Using a dataset in package datasets, n - length(lh) fit - arima(lh, order = c(1,0,0)) se - sqrt(diag(vcov(fit))) sqrt(n -

[R] Introduction to R. Any such documentation in Vietnamese?

2013-03-19 Thread Peter Alspach
Dear fellow users Are there any Vietnamese language resources for beginners of R? If so, I would be interested in hearing from people who have had experience with them and which are better (if there is more than one). I am involved with an aid project in Vietnam, and would like to move the

[R] How to subsetting data based on factor levels

2013-03-19 Thread capricy gao
Here are the code and results a=matrix(1:20,5) a [,1] [,2] [,3] [,4] [1,]    1    6   11   16 [2,]    2    7   12   17 [3,]    3    8   13   18 [4,]    4    9   14   19 [5,]    5   10   15   20 colnames(a)=c(A,AB,C,CD) a A AB  C CD [1,] 1  6 11 16 [2,] 2  7 12 17 [3,]

Re: [R] How to subsetting data based on factor levels

2013-03-19 Thread arun
levels(group) #[1] A C  levels(group)==A #[1]  TRUE FALSE a[,group==A] # A AB #[1,] 1  6 #[2,] 2  7 #[3,] 3  8 #[4,] 4  9 #[5,] 5 10 a[,group==C] #  C CD #[1,] 11 16 #[2,] 12 17 #[3,] 13 18 #[4,] 14 19 #[5,] 15 20 a[,match(group,levels(group))==1] # A AB #[1,] 1  6 #[2,] 2  7 #[3,] 3 

Re: [R] Cumulative Frequency Graph

2013-03-19 Thread Jim Lemon
On 03/19/2013 11:34 PM, Shane Carey wrote: Hi, I am trying to create a Cumulative Frequency graph and I am using the following example: http://www.r-tutor.com/elementary-statistics/quantitative-data/cumulative-frequency-graph When I plot this data, how do I put in real values on the x-axis,

Re: [R] Cokriging

2013-03-19 Thread Gnai Nishani Musafer
Hi John, Thank you for all the information and advices. Highly appreciated your help. Aftter using the nmax it worked finely. Thanks Best Regrds, Nishani Musafer From: r-help-boun...@r-project.org [r-help-boun...@r-project.org] On Behalf Of Jon Olav

Re: [R] List of default packages (that come with R)

2013-03-19 Thread Saptarshi Guha
Thanks much. Worked nicely On Tue, Mar 19, 2013 at 12:22 PM, William Dunlap wdun...@tibco.com wrote: Assuming you haven't removed any core packages you could look at the Priority column in the output of installed.packages(). I think all the ones marked base or recommended are shipped with