Re: [R] functions as arguments to ther functions with inlinedocs

2013-01-25 Thread Jannis
Dear Duncan, dear Rui, thanks for your replies. You are correct regarding the additional paranthesis. I probably copied the wrong code. I, however, get this inlinedocs error with the correct version. After contacting the package maintainer I think this is now added to inlinedocs list of

[R] Recoding variables (without recode() )

2013-01-25 Thread David Studer
Hi everybody! I have a rather simple question: # play data persId-c(1,2,3,1,4,5,2) varA-c(11,12,13,12,14,15,10) df-as.data.frame(cbind(persId, varA)) Now I'd like to create a new columns (df$new) according to the value of df$VarA. For example df$new1 should be 1 if df$varA==2 or df$new2 should

Re: [R] Recommendation for website to format R code

2013-01-25 Thread Suzen, Mehmet
Probably formatR/knitr is more robust but this one has an option for S http://hilite.me/ -m On 25 January 2013 02:37, C W tmrs...@gmail.com wrote: I ran across this page for C, Java, etc. No R. http://pastebin.com/ It looks similar and more than what I was looking for, just saying. Mike

Re: [R] importing data

2013-01-25 Thread R. Michael Weylandt
On Fri, Jan 25, 2013 at 6:11 AM, Ray Cheung ray1...@gmail.com wrote: Dear Michael, Thanks for your codes. However, lapply does not work in my case since I've some files missing in the data (say, the file data101.dat). Do you have any suggestions on this?? Thank you very much. You could

[R] Package x12 (X-12-ARIMA Seasonal Adjustment Program)

2013-01-25 Thread Isidro Hidalgo
Hi: I use R 2.15.0 and RStudio 0.95.265. Platform: Windows 7 - 32b When I predict some series with the x12 package (Version Number 0.3 Build 192) with the code... forec - x12(serie, x12path=D:/WinX12/X12a/x12a.exe, decimals=5, automdlT, outlier=all) ... where serie is this ts object:

[R] If cycle takes to much time...

2013-01-25 Thread marcoguerzoni
dear all, thank you for reading. I have a dataset of artists and where and when they had an exhibition. I'd like to create an affiliation network in the form of matrix, telling me which aritist have been in the same at the same time. I manage to do it, but given that I have 96000 observation

[R] How to name the elements of list

2013-01-25 Thread Tammy Ma
HI, I have the array list: X-vector(list, 2) X[[1]] : data frame 1 X[[2]]: dataframe2 now i want to change index 1 and 2 into: 0-10 , 11-20 ,. finally I want to have X[[0-10]]:dataframe1 X[[11-20]]:dataframe2 how do I get them? Thanks a lot. Kind regards, Tammy

Re: [R] How to name the elements of list

2013-01-25 Thread R. Michael Weylandt
names(X) - c(0-10, 11-20) MW On Fri, Jan 25, 2013 at 9:39 AM, Tammy Ma metal_lical...@live.com wrote: HI, I have the array list: X-vector(list, 2) X[[1]] : data frame 1 X[[2]]: dataframe2 now i want to change index 1 and 2 into: 0-10 , 11-20 ,. finally I want to have

Re: [R] How to name the elements of list

2013-01-25 Thread Ivan Calandra
Hi Tammy, Are you just looking for names()? Not sure, but it can be troublesome to have - in a name. HTH, Ivan -- Ivan CALANDRA Université de Bourgogne UMR CNRS/uB 6282 Biogéosciences 6 Boulevard Gabriel 21000 Dijon, FRANCE +33(0)3.80.39.63.06 ivan.calan...@u-bourgogne.fr

Re: [R] importing data

2013-01-25 Thread Ivan Calandra
Hi, Not sure this is what you need, but what about list.files()? It can get you all the files from a given folder, and you could then work this list with regular expressions for example. HTH, Ivan -- Ivan CALANDRA Université de Bourgogne UMR CNRS/uB 6282 Biogéosciences 6 Boulevard Gabriel

Re: [R] How to name the elements of list

2013-01-25 Thread Tammy Ma
Hello,Thanks a lot for your help. each index represents the different price band. I more prefer to use price band info as 0-10 instead of 1... I just can not find the way to do it. Kind regards, Tammy Date: Fri, 25 Jan 2013 10:46:45 +0100 From: ivan.calan...@u-bourgogne.fr To:

Re: [R] How to name the elements of list

2013-01-25 Thread Ivan Calandra
If names() is not what you need, then you have to explain your problem better. Ivan -- Ivan CALANDRA Université de Bourgogne UMR CNRS/uB 6282 Biogéosciences 6 Boulevard Gabriel 21000 Dijon, FRANCE +33(0)3.80.39.63.06 ivan.calan...@u-bourgogne.fr http://biogeosciences.u-bourgogne.fr/calandra Le

Re: [R] Recoding variables (without recode() )

2013-01-25 Thread PIKAL Petr
Hi -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of David Studer Sent: Friday, January 25, 2013 9:28 AM To: r-help@r-project.org Subject: [R] Recoding variables (without recode() ) Hi everybody! I have a rather simple

Re: [R] Wrong csv data?

2013-01-25 Thread PIKAL Petr
Hi Attachment did not went through. Can you show us result of dput(head(data)) or output from str(data)? Anyway I wonder how time can became temperature. R is smart but I do not believe that during import it somehow gets a local temperature at given time and put it in your data. Regards Petr

Re: [R] If cycle takes to much time...

2013-01-25 Thread Gerrit Eichner
Hello, Marco, I am not quite sure if understand correctly what you want, but maybe DF - data.frame( Artist, Begin, End, Istitution) AtSameInst - outer( DF$Istitution, DF$Istitution, ==) Simultaneously - with( DF, outer( Begin, End, =) | outer( End, Begin, =))

[R] Help with adding 'dates' string as rownames to matrix

2013-01-25 Thread kevj1980
Hi, I need help with two related issues: 1. I wish to drop repeating text BST from the below 'dates' string: [1] 2005-04-01 BST 2005-04-04 BST 2005-04-05 BST 2005-04-06 BST 2005-04-07 BST 2005-04-08 BST 2005-04-11 BST 2005-04-12 BST 2005-04-13 BST 2005-04-14 BST 2. I then wish to add this

[R] How to load data from .accdb into R?

2013-01-25 Thread Tammy Ma
HI, All, I have three dabases: analysis_tool.accdb is linked into sellout.mdb and audit.accdb. whenever I use this database, I need to firstly open analysis_tool, then press External data-Linked Table Manager to link the other two databases. Now I want to load the data from those database

Re: [R] Help with adding 'dates' string as rownames to matrix

2013-01-25 Thread PIKAL Petr
Hi -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of kevj1980 Sent: Friday, January 25, 2013 11:22 AM To: r-help@r-project.org Subject: [R] Help with adding 'dates' string as rownames to matrix Hi, I need help with two

Re: [R] If cycle takes to much time...

2013-01-25 Thread Berend Hasselman
On 25-01-2013, at 10:25, marcoguerzoni marco.guerz...@unito.it wrote: dear all, thank you for reading. I have a dataset of artists and where and when they had an exhibition. I'd like to create an affiliation network in the form of matrix, telling me which aritist have been in the same

Re: [R] Help with adding 'dates' string as rownames to matrix

2013-01-25 Thread kevj1980
Thank you Petr! -- View this message in context: http://r.789695.n4.nabble.com/Help-with-adding-dates-string-as-rownames-to-matrix-tp4656611p4656617.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

Re: [R] Wrong csv data?

2013-01-25 Thread Grigory Fateyev
Hello PIKAL Petr! On Fri, 25 Jan 2013 10:09:54 + you wrote: Hi Attachment did not went through. Can you show us result of dput(head(data)) or output from str(data)? Anyway I wonder how time can became temperature. R is smart but I do not believe that during import it somehow gets a

Re: [R] Recommendation for website to format R code

2013-01-25 Thread Ista Zahn
I still don't understand what you are looking for, but https://gist.github.com/ is similar to pastebin, and it does have R syntax highlighting. Best, Ista On Thu, Jan 24, 2013 at 8:37 PM, C W tmrs...@gmail.com wrote: I ran across this page for C, Java, etc. No R. http://pastebin.com/ It

[R] how to delete the null elements in list

2013-01-25 Thread Tammy Ma
HI, I have the list: suu [[1]] NULL [[2]] NULL [[3]] item_id prod 1 2 [[4]] item_id prod 1 2 2 4 how to delete all NULL elements from suu to get only suu [[3]] item_id prod 1 2 [[4]] item_id prod 1 2 2 4 ?? Kind

Re: [R] If cycle takes to much time...

2013-01-25 Thread marco . guerzoni
On 25.01.2013 12:08, Berend Hasselman wrote: On 25-01-2013, at 10:25, marcoguerzoni marco.guerz...@unito.it wrote: dear all, thank you for reading. I have a dataset of artists and where and when they had an exhibition. I'd like to create an affiliation network in the form of matrix,

Re: [R] how to delete the null elements in list

2013-01-25 Thread Rui Barradas
Hello, Try the following. suu - list(NULL, NULL, 1:2, matrix(1:4, 2)) suu[!sapply(suu, is.null)] Hope this helps, Rui Barradas Em 25-01-2013 12:31, Tammy Ma escreveu: HI, I have the list: suu [[1]] NULL [[2]] NULL [[3]] item_id prod 1 2 [[4]] item_id prod 1

Re: [R] how to delete the null elements in list

2013-01-25 Thread Ben Bolker
Tammy Ma metal_licaling at live.com writes: suu [[1]] NULL [[2]] NULL [[3]] item_id prod 1 2 [[4]] item_id prod 1 2 2 4 how to delete all NULL elements from suu to get only suu [[3]] item_id prod 1 2 [[4]] item_id prod 1

Re: [R] Pasting a list of parameters into a function

2013-01-25 Thread Prof J C Nash (U30A)
Quite a long time ago, there was a thread about generalized eigenvalues, which ended inconclusively. http://tolstoy.newcastle.edu.au/R/help/05/06/6832.html For students, a good proposal for the Google Summer of Code (gsoc-r) would be a nice interface to things like the QZ algorithm and

Re: [R] predicted HR in coxph with psline

2013-01-25 Thread Terry Therneau
The normalization is the same as is found when you have type=terms from a gam model: each term is centered so that mean(predicted) = 0. For a simple linear term beta*age this implies that the predicted value will be 0 at the mean of age, for a polynomial or spline this does not translate to a

Re: [R] Pasting a list of parameters into a function

2013-01-25 Thread S Ellison
-Original Message- I'd love to write a code that would allow me replace the example code: fit1F - mle2(LL, fixed=list(xhalf=6)) with something like: var-xhalf val-6 fit1F - mle2(LL, fixed=list(var=val)) or var-c(xhalf,=) val-6 fit1F - mle2(LL, fixed=list(var,val))

Re: [R] Percentiles with R for a big data.frame

2013-01-25 Thread David Winsemius
On Jan 23, 2013, at 5:45 AM, Simonas Kecorius wrote: I found a code: y.ts - ts(data, frequency=12) aggregate(y.ts, FUN=quantile, probs=0.10) Seems it works fine even for a big data.frame. Except for the fact that 'y.ts' is not a dataframe, so you are using a function that has different

Re: [R] Insert segment only on particular facets in ggplot

2013-01-25 Thread John Kane
The image came through but no data. I'd suggest using ?dput to send the data. John Kane Kingston ON Canada -Original Message- From: janesh.devk...@gmail.com Sent: Thu, 24 Jan 2013 11:46:53 -0600 To: r-help@r-project.org Subject: [R] Insert segment only on particular facets in

Re: [R] Percentiles with R for a big data.frame

2013-01-25 Thread Simonas Kecorius
What a shame.. Don't know the details about ts, but I tried the code with data.frame, then checked the result with OpenOffice offered percentiles for the same data. It was identical, so now I am a bit confused... 2013/1/25 David Winsemius dwinsem...@comcast.net On Jan 23, 2013, at 5:45 AM,

Re: [R] predicted HR in coxph with psline

2013-01-25 Thread Carrie Li
Thank you, Terry. So in the spline model, how to do the interpretation for HR? For linear term, the HR can be interpreted as comparing a person with age 65, for example, against mean age. But if there is no defined centering point in spline, what's the compared value when we do the interpretation?

Re: [R] CFA with lavaan or with SEM

2013-01-25 Thread yrosseel
I am trying to use the cfa command in the lavaan package to run a CFA however I am unsure over a couple of issues. I have @25 dichotomous variables, 300 observations and an EFA on a training dataset suggests a 3 factor model. That is a lot of variables, and a rather small sample size (for

[R] joint probability distribution

2013-01-25 Thread eliza botto
Dear R family, I want to calculate the joint probability (distribution) of two random continuous variables X and Y. Could to please tell me how to do it?Thanks in advance.. elisa [[alternative HTML version deleted]]

[R] read.csv quotes within fields

2013-01-25 Thread Tim Howard
All, I have some csv files I am trying to import. I am finding that quotes inside strings are escaped in a way R doesn't expect for csv files. The problem only seems to rear its ugly head when there are an uneven number of internal quotes. I'll try to recreate the problem: # set up a

Re: [R] read.csv quotes within fields

2013-01-25 Thread Tim Howard
Drat, I forgot to tell you what system I am on: sessionInfo() R version 2.15.1 (2012-06-22) Platform: i386-pc-mingw32/i386 (32-bit) locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252 LC_NUMERIC=C

Re: [R] sorting/grouping/classification problem?

2013-01-25 Thread Bart Joosen
Hi, To clarify further: these are results for degradation studies. We search for degradations at 0 months, again at 3 months, again at 6 months, ... Each analysis gives us a rrt, and a result. To make final conclusions, we have to align the results manually (at least for now). rrt is

Re: [R] read.csv quotes within fields

2013-01-25 Thread David Winsemius
On Jan 25, 2013, at 10:42 AM, Tim Howard wrote: All, I have some csv files I am trying to import. I am finding that quotes inside strings are escaped in a way R doesn't expect for csv files. The problem only seems to rear its ugly head when there are an uneven number of internal

Re: [R] read.csv quotes within fields

2013-01-25 Thread Tim Howard
Great point, your fix (quote=) works for the example I gave. Unfortunately, these text strings have commas in them as well(!). Throw a few commas in any of the text strings and it breaks again. Sorry about not including those in the example. So, I need to incorporate commas *and* quotes

[R] resizing data

2013-01-25 Thread emorway
Undoubtedly this question has been asked before, I just can't seem to find the combination of search terms to produce it. I'm trying to resize a dataset that is pulled into R using read.table. However, I think the same problem can be produced using matrix: x-matrix(1:64,8) x # [,1] [,2]

Re: [R] joint probability distribution

2013-01-25 Thread Rui Barradas
Hello, You need to be much more specific. What do you know about the distributions of X and Y? And about their joint distribution? If you suspect the joint distribution to be a bivariate normal try package mvtnorm with mu - c(mean(x), mean(y)) sigma - cov(cbind(x, y)) You can also try

Re: [R] read.csv quotes within fields

2013-01-25 Thread David Winsemius
On Jan 25, 2013, at 11:35 AM, Tim Howard wrote: Great point, your fix (quote=) works for the example I gave. Unfortunately, these text strings have commas in them as well(!). Throw a few commas in any of the text strings and it breaks again. Sorry about not including those in the

Re: [R] joint probability distribution

2013-01-25 Thread Suzen, Mehmet
Not sure what is your exact requirement but you can compute marginals and conditional probabilities using 'prob' package of Prof. Kerns. On 25 January 2013 22:15, Rui Barradas ruipbarra...@sapo.pt wrote: Hello, You need to be much more specific. What do you know about the distributions of X

Re: [R] read.csv quotes within fields

2013-01-25 Thread Tim Howard
David, Thank you again for the reply. I'll try to make readLines() and strplit() work. What bugs me is that I think it would import fine if the folks who created the csv had used double quotes rather than an escaped quote \ for those pesky internal quotes. Since that's the case, I'd think

Re: [R] read.csv quotes within fields

2013-01-25 Thread David Winsemius
On Jan 25, 2013, at 1:37 PM, Tim Howard wrote: David, Thank you again for the reply. I'll try to make readLines() and strplit() work. What bugs me is that I think it would import fine if the folks who created the csv had used double quotes rather than an escaped quote \ for those pesky

Re: [R] resizing data

2013-01-25 Thread David Winsemius
On Jan 25, 2013, at 1:12 PM, emorway wrote: Undoubtedly this question has been asked before, I just can't seem to find the combination of search terms to produce it. I'm trying to resize a dataset that is pulled into R using read.table. However, I think the same problem can be produced

Re: [R] Pasting a list of parameters into a function

2013-01-25 Thread bsm2
Thanks for taking to time to help me out with this, I really appreciate it! Quoting S Ellison-2 [via R] ml-node+s789695n465663...@n4.nabble.com: -Original Message- I'd love to write a code that would allow me replace the example code: fit1F - mle2(LL, fixed=list(xhalf=6)) with

[R] Loop question?

2013-01-25 Thread Andras Farkas
Dear All   I have the following data (somewhat simplyfied):   TINF -1 a -c(500,750,1000,1250,1500,1750,2000) b -c(8,12,18,24,36,48,60,72,96)   following function:   infcprodessa -function (D, tin, tau, ts)   (D * (1 - exp(-0.048 * tin))/(tin * (0.048*79) * (1 - exp(-0.048 * tau * exp(-0.048

Re: [R] resizing data

2013-01-25 Thread emorway
I played around with your example on the smaller dataset, and it seemed like it was doing what I wanted. However, applying it to the larger problem, I didn't get a resized 2D dataset that preserved the order I was hoping for. Hopefully the following illustrates the larger problem:

[R] Testing continuous zero-inflated response

2013-01-25 Thread Kay Cichini
Hello, I'm searching for a test that applies to a dataset (N=36) with a continuous zero-inflated dependent variable and only one nominal grouping variable with 2 levels (balanced). In fact there are 4 response variables of this kind which I plan to test seperately - the amount of zeroes ranges

Re: [R] resizing data

2013-01-25 Thread Brian Diggs
On 1/25/2013 2:29 PM, emorway wrote: I played around with your example on the smaller dataset, and it seemed like it was doing what I wanted. However, applying it to the larger problem, I didn't get a resized 2D dataset that preserved the order I was hoping for. Hopefully the following

Re: [R] resizing data

2013-01-25 Thread David Winsemius
On Jan 25, 2013, at 2:29 PM, emorway wrote: I played around with your example on the smaller dataset, and it seemed like it was doing what I wanted. However, applying it to the larger problem, I didn't get a resized 2D dataset that preserved the order I was hoping for. Hopefully the

Re: [R] Testing continuous zero-inflated response

2013-01-25 Thread Achim Zeileis
On Fri, 25 Jan 2013, Kay Cichini wrote: Hello, I'm searching for a test that applies to a dataset (N=36) with a continuous zero-inflated dependent variable In a regression setup, one can use a regression model with a response censored at zero. survreg() in survival fits such models,

Re: [R] read.csv quotes within fields

2013-01-25 Thread Duncan Murdoch
On 13-01-25 4:37 PM, Tim Howard wrote: David, Thank you again for the reply. I'll try to make readLines() and strplit() work. What bugs me is that I think it would import fine if the folks who created the csv had used double quotes rather than an escaped quote \ for those pesky internal

[R] Pass vector as multiple parameters (as in python f(*x))

2013-01-25 Thread Carlos Pita
Hi, I want to know if it's possible to pass a vector v=c(x,y,...) to a function f(x,y,...) so that each vector element corresponds to a formal argument of the function. For python programmers: f(*v). Specifically, what I'm trying to achieve is: given a list of coordinates l=list(c(x1,y1,z1),

Re: [R] Pass vector as multiple parameters (as in python f(*x))

2013-01-25 Thread Bert Gunter
Well, of course the answer is yes (it always is!). I'm just not sure what the question is. However, I believe you want something like do.call(the_function, parameter_list). ?do.call ## for details. Note that if v is really a (named) vector, it can be converted to a list via as.list().

Re: [R] Pass vector as multiple parameters (as in python f(*x))

2013-01-25 Thread Jeff Newmiller
Your whole premise that the arguments of a function should be mappable to elements of a vector seems contrary to good R programming practice. Consider changing the called function's handling of arguments instead to accept the vector of data directly if a vector makes sense, or to a list if the

Re: [R] Pass vector as multiple parameters (as in python f(*x))

2013-01-25 Thread Carlos Pita
Thanks Bert, do.call is exactly what I was looking for. What in lisp is apply and in python f(*v). Your whole premise that the arguments of a function should be mappable to elements of a vector seems contrary to good R programming practice. Jeff I didn't pretend to imply that the mapping

Re: [R] Pass vector as multiple parameters (as in python f(*x))

2013-01-25 Thread Carlos Pita
Jeff I didn't pretend to imply that the mapping should by always s/by always/always be/ Sorry. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

[R] could not find function qplot after install.packages(ggplot2)

2013-01-25 Thread Yongjie ZHANG
On OS X 10.8.2, after I installed ggplot2, and picked mirror of Singapore. it could not find qplot function. Could anyone pls help me ? Thank you. Pls see: install.packages(ggplot2)--- Please select a CRAN mirror for use in this session ---also installing the dependencies ¡®colorspace¡¯,

Re: [R] how to delete the null elements in list

2013-01-25 Thread arun
Or, suu[unlist(lapply(suu,length)!=0)] #[[1]] #[1] 1 2 #[[2]]  #    [,1] [,2] #[1,]    1    3 #[2,]    2    4 A.K. - Original Message - From: Rui Barradas ruipbarra...@sapo.pt To: Tammy Ma metal_lical...@live.com Cc: r-help@r-project.org r-help@r-project.org Sent: Friday, January 25,

Re: [R] From table to data.frame

2013-01-25 Thread Wim Kreinen
This idea is very simple and helpful. But one has to start with 0.05. Thanks. test.df$n- seq(0.05,1, by=0.05) 2013/1/24 Rui Barradas ruipbarra...@sapo.pt Hello, try the following. test.df$Var1 - seq(0,1, by=0.05)[-1] test.df Hope this helps, Rui Barradas Em 24-01-2013 17:39, Wim

[R] MacOSX-Leopard/ Dichromat not found?

2013-01-25 Thread Andres, Jose
Dear All, During the last few days I've been trying to get ggplot2 installed in my Mac but when installing dependencies I cannot access dichromat. Error in download.file(url, destfile, method, mode = wb, ...) : cannot open URL

[R] stepwise variable selection method wanted

2013-01-25 Thread Julien Mehl Vettori
Dear Herry, I would like to know if you found an answer elsewhere to your question. I'm trying to get information around the nodes of a CA (daisy() followed by agnes()) made on plant trait using the gower metric for taxonomic purpuse. I'm not an expert in statistic but I understood that your way

Re: [R] Help with adding 'dates' string as rownames to matrix

2013-01-25 Thread arun
Hi, Try this: Dates1-c(2005-04-01 BST,2005-04-04 BST,2005-04-05 BST) Dates2-as.Date(gsub(\\s+\\w+$,,Dates1))  mat1-matrix(1:9,nrow=3) library(zoo)  z1-zoo(mat1,Dates2)  z1 #    #2005-04-01 1 4 7 #2005-04-04 2 5 8 #2005-04-05 3 6 9 #if you use:   mat2-matrix(1:9,nrow=3)  

Re: [R] resizing data

2013-01-25 Thread arun
which(x==1,arr.ind=TRUE)    row col #[1,] 1   7  y-t(matrix(x,nrow=546))  which(y==1,arr.ind=TRUE) # row col #[1,] 341 328 A.K. - Original Message - From: emorway emor...@usgs.gov To: r-help@r-project.org Cc: Sent: Friday, January 25, 2013 5:29 PM Subject: Re: [R] resizing

Re: [R] sorting/grouping/classification problem?

2013-01-25 Thread arun
Hi, Your question is bit confusing to me.   When you say that which rrts are the same, and which are the  new ones, to me it looks like 0.35, 0.36 are new addition to Mnd at time points 6 and 9. Extending Dennis' solution: Just for understanding the problem:  

Re: [R] could not find function qplot after install.packages(ggplot2)

2013-01-25 Thread David Winsemius
On Jan 25, 2013, at 5:55 AM, Yongjie ZHANG wrote: On OS X 10.8.2, after I installed ggplot2, and picked mirror of Singapore. it could not find qplot function. Could anyone pls help me ? Thank you. Pls see: install.packages(ggplot2)--- Please select a CRAN mirror for use in this session

Re: [R] resizing data

2013-01-25 Thread arun
HI, It's not clear why you wanted to take the transpose and resize it afterwards. It could be done in one step as David suggested. Suppose, you wanted to get the result after you transposed the matrix: x-matrix(1:64,8) x1-t(x) matrix(unlist(split(x1,row(x1))),ncol=4,byrow=T) #  [,1] [,2]

[R] Removal of columns from matrix where all values of the column are identical.

2013-01-25 Thread Benjamin Ward (ENV)
Hi all, I'd like to write a piece of code which will remove columns from a matrix, if the column contains only one value, say every value in the column is a 3: Matrix - matrix(NA, nrow=5, ncol=4) Matrix[,1] - c(1,2,3,4,5) Matrix[,2] - c(3,3,3,3,3) Matrix[,3] - c(5,4,3,2,1) Matrix[,4] -

Re: [R] resizing data

2013-01-25 Thread arun
Hi, Inline: - Original Message - From: emorway emor...@usgs.gov To: r-help@r-project.org Cc: Sent: Friday, January 25, 2013 5:29 PM Subject: Re: [R] resizing data I played around with your example on the smaller dataset, and it seemed like it was doing what I wanted.  However,

Re: [R] MacOSX-Leopard/ Dichromat not found?

2013-01-25 Thread David Winsemius
On Jan 25, 2013, at 7:00 AM, Andres, Jose wrote: Dear All, During the last few days I've been trying to get ggplot2 installed in my Mac but when installing dependencies I cannot access dichromat. Error in download.file(url, destfile, method, mode = wb, ...) : cannot open URL

Re: [R] Removal of columns from matrix where all values of the column are identical.

2013-01-25 Thread Ben Bolker
Benjamin Ward (ENV B.Ward at uea.ac.uk writes: I'd like to write a piece of code which will remove columns from a matrix, if the column contains only one value, say every value in the column is a 3: Matrix - matrix(NA, nrow=5, ncol=4) Matrix[,1] - c(1,2,3,4,5) Matrix[,2] - c(3,3,3,3,3)

Re: [R] problems with package 'segmented'

2013-01-25 Thread Rolf Turner
In view of our private communication on this matter (to the effect that you had not been able to elicit a response from Vito Muggeo) I did a little delving into the code of segmented.lm(). I ***think*** I have found the problem. On line 243 (of the code as seen from loading the package) the

Re: [R] Removal of columns from matrix where all values of the column are identical.

2013-01-25 Thread arun
Hi, May be this helps: Matrix[,colSums(diff(Matrix))!=0] # [,1] [,2] [,3] #[1,]    1    5    5 #[2,]    2    4    1 #[3,]    3    3    4 #[4,]    4    2    3 #[5,]    5    1    2 A.K. - Original Message - From: Benjamin Ward (ENV) b.w...@uea.ac.uk To: r-help@r-project.org

Re: [R] Pass vector as multiple parameters (as in python f(*x))

2013-01-25 Thread arun
HI, You could use ?Reduce() also in the second case: lapply(vs,function(v){Reduce(f,as.list(v))}) #[[1]] #[1] 10 #[[2]] #[1] 6 #[[3]] #[1] 1 A.K. - Original Message - From: Carlos Pita carlosjosep...@gmail.com To: r-help@r-project.org Cc: Sent: Friday, January 25, 2013 7:46 PM

Re: [R] Removal of columns from matrix where all values of the column are identical.

2013-01-25 Thread arun
Hi, I guess this should also work:  Matrix[,apply(Matrix,2,function(x) all(c(TRUE,x[-length(x)]!=x[-1])))] # [,1] [,2] [,3] #[1,]    1    5    5 #[2,]    2    4    1 #[3,]    3    3    4 #[4,]    4    2    3 #[5,]    5    1    2 A.K. - Original Message - From: Benjamin Ward (ENV)

Re: [R] Pass vector as multiple parameters (as in python f(*x))

2013-01-25 Thread Jeff Newmiller
How about (assuming the variables you defined): ms - matrix(unlist(vs), ncol=2,byrow=TRUE) m[ms] --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics:

Re: [R] Loop question?

2013-01-25 Thread Jeff Newmiller
Please read the Posting Guide no html email reproducible example please In general, you can use expand.grid to generate all combinations of inputs, compute results as a vector just as long as the expand.grid data frame has rows, and identify which results meet your criteria by a logical test,