Re: [R] PCA on stacked raster (multiple bands/ layers) in R

2014-10-30 Thread Gustavo Bediaga
Hi, You have to transform it to a Data Frame. Try: files <- stack(rasterlist) filesdf<-as.data.frame(files) pca <- princomp(formula = ~., data = filesdf, cor = TRUE, na.action=na.exclude) hope it helps Gustavo Em quinta-feira, 30 de outubro de 2014 14h38min56s UTC-2, Jo

[R] help for an R automated procedures

2013-02-28 Thread Gustavo Vieira
Dear, I would like to post the following question to the r-help on Nabble (thanks in advance for the attention, Gustavo Vieira): Hi there. I have a data set on hands with 5,220 cases and I'd like to automate some procedures (but I have almost no programming knowledge). The data has

[R] forecast ARMA(1,1)/GARCH(1,1) using fGarch library

2013-02-17 Thread GUSTAVO SANTA ROSA GARCIA
prices are growing up nevertheless i would expect that at some point these ones decrease . So i would expect that the prediction for the return would be different. but i certanly dont know which is. I would apreciate if you could help with th

Re: [R] Chemical Names in Data Frames

2011-09-02 Thread Gustavo Carvalho
?make.names perhaps. On Fri, Sep 2, 2011 at 4:13 PM, Durant, James T. (ATSDR/DTEM/PRMSB) wrote: > Greetings - > > I am working on some data that contain chemical names with air > concentrations, and I am creating a data frame with date/time and each > chemical having its own column. However, th

Re: [R] Help: extrac the first entry for each component of a list

2011-08-23 Thread Gustavo Carvalho
sapply(a, `[`, 1) On Wed, Aug 24, 2011 at 12:18 AM, Chee Chen wrote: > Dear All, > I would like to know, beside writing a function and then apply it to a list, > or using a for loop, whether there is a one-line command to do the following. > Suppose we have a list, each of whose components are n

Re: [R] How to call an external program/web page under R for Mac OS?

2011-05-24 Thread Gustavo Carvalho
To open a website on the default browser: system("open http://www.google.com";) Gustavo. On Tue, May 24, 2011 at 7:56 PM, jbrezmes wrote: > I would like to be able to call external programs such as Java scripts (*.jar > files) or bring up the browser to a given direction. Can t

Re: [R] Find number of elements less than some number: Elegant/fast solution needed

2011-04-14 Thread Gustavo Carvalho
This might be a bit quicker with larger vectors: f <- function(x, y) sum(x > y) vf <- Vectorize(f, "x") vf(x, y) On Thu, Apr 14, 2011 at 5:37 PM, Marc Schwartz wrote: > On Apr 14, 2011, at 2:34 PM, Kevin Ummel wrote: > >> Take vector x and a subset y: >> >> x=1:10 >> >> y=c(4,5,7,9) >> >> For ea

Re: [R] confirmatory factor analysis program in R

2011-03-20 Thread Gustavo Carvalho
Search for lavaan, sem, and OpenMx. On Mon, Mar 21, 2011 at 12:34 AM, rvohen wrote: > thank you !  I will try it ! > > -- > View this message in context: > http://r.789695.n4.nabble.com/confirmatory-factor-analysis-program-in-R-tp3386133p3392279.html > Sent from the R help mailing list archive a

Re: [R] Incorrect degrees of freedom in SEM model using lavaan

2011-03-17 Thread Gustavo Carvalho
, sample.nobs=161, sample.cov=myCov, int.ov.free = T, int.lv.free = F, auto.fix.first = T, auto.fix.single = T, auto.resid.var = T, auto.cov.lv.x = T, auto.cov.y = T, mimic = "EQS") summary(fit) Cheers, Gustavo. On Thu, Mar 17, 2011 at 9:50 AM, Andrew Miles wrote: > I have been trying

Re: [R] Is there an implementation for "URL Encoding" (/format) in R?

2010-11-25 Thread Gustavo Carvalho
?URLencode On Thu, Nov 25, 2010 at 3:53 PM, Tal Galili wrote: > Hello all, > > I would like some R function that can translate a string to a "URL encoding" > (see here: http://www.w3schools.com/tags/ref_urlencode.asp) > > Is it implemented? (I wasn't able to find any reference to it) > > Thanks,

Re: [R] the first. from SAS in R

2010-11-23 Thread Gustavo Carvalho
Perhaps something like this: a$d <- ifelse(duplicated(a$a), 0, 1) On Tue, Nov 23, 2010 at 1:33 PM, Joel wrote: > > Is there any similar function in R to the first. in SAS? > > What it dose is: > > Lets say we have this table: > >  a b  c >  1 1  5 >  1 0  2 >  2 0  2 >  2 0 NA >  2 9  2 >  3 1  

[R] looking for a faster way to compare two columns of a matrix

2010-09-23 Thread Gustavo Carvalho
putting the code from the for loop into a function and passing it to combn but, as expected, it didn't help much. Any pointers to functions that I should be looking into will be greatly appreciated. Thank you very much, Gustavo. __ R-help@r-project.

Re: [R] Finding (Ordered Subvectors)

2010-09-21 Thread Gustavo Carvalho
]] <- seq.to.match } } return(where) } a<-c(3,4,3,0,4,5,6,9,3,4) b<-c(0,4,5) c<-c(5,4,0) d<-c(3,4) bleh(a, b) bleh(a, c) bleh(a, d) Cheers, Gustavo. On Tue, Sep 21, 2010 at 11:31 AM, Lorenzo Isella wrote: > Dear All, > Consider a simple example > > a<-c(1,4,3,

[R] problems trying to reproduce structural equation model using the sem package

2010-09-16 Thread Gustavo Carvalho
I've specified is 21, as in the published model. Any light you could shed on this would be greatly appreciated. The code to reproduce all steps is presented below. Thank you very much, Gustavo. ## library(sem) grace <- matrix(ncol = 10, nrow = 10) variables <- c("light

[R] testing hipotheses using GAMLSS package

2010-03-15 Thread Gustavo Pereira
. Gustavo __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

Re: [R] Logical function to turn missing values to 0's

2009-01-14 Thread Gustavo Carvalho
Hello rafamoral, Try this: ifelse(is.na(x),0,x) On Wed, Jan 14, 2009 at 8:32 PM, rafamoral wrote: > > I have a dataset which contains some missing values, and I need to replace > them with zeros. I tried using the following: > > x <- matrix(data=rep(c(1,2,3,NA),6), ncol=6, nrow=6) > > y <- matr

Re: [R] remove columns containing all zeros (or other value)

2009-01-14 Thread Gustavo Carvalho
Sorry for the double post, but this is probably faster: x[, colSums(x) != 0] On Wed, Jan 14, 2009 at 8:22 PM, Gustavo Carvalho wrote: > You can also try this: > > x[,-(which(colSums(x) == 0))] > > Cheers, > > Gustavo. > > On Wed, Jan 14, 2009 at 8:01 PM, Anthony Dic

Re: [R] remove columns containing all zeros (or other value)

2009-01-14 Thread Gustavo Carvalho
You can also try this: x[,-(which(colSums(x) == 0))] Cheers, Gustavo. On Wed, Jan 14, 2009 at 8:01 PM, Anthony Dick wrote: > Hello- > > I would like to remove the columns of a matrix that contain all zeros. For > example, from > x<-matrix(c(1,5,3,2,1,4,0,0,0), ncol=3,nrow=3

Re: [R] Conditional Counting with Table

2008-12-23 Thread Gustavo Carvalho
Hello, Something like this should work: table(test$V1[!test$V2 %in% c("NM","QC")]) Cheers, Gustavo. On Wed, Dec 24, 2008 at 3:06 AM, Gundala Viswanath wrote: > Dear all, > > I have the following data frame: > > V1 V2 > aaachr1 > aaach

Re: [R] Reading from Google Docs

2008-12-15 Thread Gustavo Carvalho
Hello, You can probably extract a .tar.gz using 7zip on Windows. Regards, Gustavo. On Mon, Dec 15, 2008 at 8:07 PM, Farrel Buchinsky wrote: > I saw a thread from September 24 in which Duncan Temple Lang told us: > - The package currently has no Rd files, but there is a brief "use

Re: [R] Logical "in" test

2008-12-11 Thread Gustavo Carvalho
Take a look at ?any. On Thu, Dec 11, 2008 at 3:11 PM, David B. Thompson, Ph.D., P.E., D.WRE, CFM <[EMAIL PROTECTED]> wrote: > OK, this should be trivial but I'm not finding it. I want to compress the > test, > > if (i==7 | i==10 | i==30 | i==50) {} > > into something like > > if (i in c(7,10,30,50

Re: [R] Logical inconsistency

2008-12-10 Thread Gustavo Carvalho
Hello, An alternative to round(): isTRUE(all.equal((2.3-1.3),1)) Regards, Gustavo. On Wed, Dec 10, 2008 at 3:12 PM, Stephan Kolassa <[EMAIL PROTECTED]> wrote: > Hi Emma, > > unfortunately, rounding variables before taking the difference will not > solve your problem, be

Re: [R] == operand

2008-12-09 Thread Gustavo Carvalho
Hello, You assigned 53 to c, not cc. Also, take a look at this: http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f On Tue, Dec 9, 2008 at 9:36 PM, Renny Li <[EMAIL PROTECTED]> wrote: > Hi, > > I am trying to compare two values using "==" operand, p

[R] extract the digits of a number

2008-12-09 Thread Gustavo Carvalho
Hello, Anyone knows how can I do this in a cleaner way? mynumber = 1001 as.numeric(unlist(strsplit(as.character(mynumber),""))) [1] 1 0 0 1 Thanks in advance, Gustavo __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listi

Re: [R] Running R Script on a Sequence of Files

2008-12-06 Thread Gustavo Carvalho
Thanks a lot! On Fri, Dec 5, 2008 at 5:54 PM, Gabor Grothendieck <[EMAIL PROTECTED]> wrote: > Try this: > > dir()[!file.info(dir())$isdir] > > > On Fri, Dec 5, 2008 at 2:30 PM, Gustavo Carvalho > <[EMAIL PROTECTED]> wrote: >> Is there a way to list only

Re: [R] Running R Script on a Sequence of Files

2008-12-05 Thread Gustavo Carvalho
Is there a way to list only the files in a given directory without passing pattern="..." to list.files()? On Fri, Dec 5, 2008 at 5:10 PM, Kyle. <[EMAIL PROTECTED]> wrote: > Thanks, Barry. I'll use that in the future. > > > ---Kyle. > > On Fri, Dec 5, 2008 at 11:01 AM, Barry Rowlingson < > [EMAIL P

Re: [R] if then statement problem

2008-11-27 Thread Gustavo Carvalho
(0,0,0)} Regards, Gustavo On Thu, Nov 27, 2008 at 3:02 PM, Salas, Andria Kay <[EMAIL PROTECTED]> wrote: > I really need help with an if then statement I am having trouble with. A > brief explanation of what I am trying to do: I have a p matrix of all > permutations of a vector of

Re: [R] R course in Scotland

2008-11-20 Thread Gustavo Carvalho
Hello, Take a look at this course: http://www.r4all.group.shef.ac.uk/index.html I don't think they teach tools for working with the genome, but it might be helpful anyway. On Thu, Nov 20, 2008 at 11:16 AM, Peter Saffrey <[EMAIL PROTECTED]> wrote: > (apologies if this is the wrong list) > > I'm

Re: [R] Checking collinearity using lmer

2008-11-19 Thread Gustavo Carvalho
Take a look at vif in the package car. On Wed, Nov 19, 2008 at 10:00 PM, Crystal McRae <[EMAIL PROTECTED]> wrote: > > > I am running a logistic regression model with a random effect using lmer. I > am uncertain how to check for collinearity between my parameters. I have > already run cor() an

Re: [R] Problem with the Linux R 2.8.0 rpm for 64 bit REL 4

2008-11-18 Thread Gustavo Carvalho
xdg utils is probably not being recognized because you compiled it from source. The R rpm is looking for the xdg utils package. I'm not familiar with yum, but I think you can try to force the installation: rpm -ivh --force (or something like that) /data/R-2.8.0-1.rh4.x86_64.rpm On Tue, Nov 18, 20

[R] Simulate data based on correlation coefficient

2007-10-06 Thread Gustavo
Hello all, I have a vector with 1000 values and I would like to generate other correlated vector, but with different correlation coefficient (for example, r = 0.7). Any ideas how can I do this? Regards, Gustavo

Re: [R] Editor for R under Fedora 7

2007-09-11 Thread Gustavo Carvalho
Fedora 7 is a linux distribution On 9/11/07, Paul Smith <[EMAIL PROTECTED]> wrote: > On 9/11/07, [EMAIL PROTECTED] > <[EMAIL PROTECTED]> wrote: > > I wanted to ask what will be a good editor to write R scripts in Fedora 7. > > Tell us first what is your operating system. > > Paul > > _