Re: [R] finding the minimum positive value of some data
Try this: min(diff(sort(x))[diff(sort(x))>0]) -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 10/09/2007, dxc13 <[EMAIL PROTECTED]> wrote: > > > useRs, > > I am looking to find the minimum positive value of some data I have. > Currently, I am able to find the minimum of data after I apply some other > functions to it: > > > x > [1] 1 0 1 2 3 3 4 5 5 5 6 7 8 8 9 9 10 10 > > > sort(x) > [1] 0 1 1 2 3 3 4 5 5 5 6 7 8 8 9 9 10 10 > > > diff(sort(x)) > [1] 1 0 1 1 0 1 1 0 0 1 1 1 0 1 0 1 0 > > > min(diff(sort(x))) > [1] 0 > > The minimum is given as zero, which is clearly true, but I am interested > in > only the positive minimum, which is 1. Can I find this by using only 1 > line > of code, like I have above? Thanks! > > dxc13 > -- > View this message in context: > http://www.nabble.com/finding-the-minimum-positive-value-of-some-data-tf4417250.html#a12599319 > Sent from the R help mailing list archive at Nabble.com. > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] Problem in installing packages on linux machine...
Hi, try install packages whit 'sudo'. $sudo R -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 08/09/2007, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Hi, > > I am trying to install RSQLite package on my Fedora workstation. I > tried to install other packages as well, but each time I got the same > error messages saying "compilation error" and "non zero exit status". > Do I have to specify "lib="? I never specified the library path before > when I was using Fedora Core 6. > > > Warning in install.packages("RSQLite") : argument 'lib' is missing: > using '/usr/lib/R/library' > --- Please select a CRAN mirror for use in this session --- > Loading Tcl/Tk interface ... done > trying URL 'http://cran.cnr.Berkeley.edu/src/contrib/RSQLite_0.5-6.tar.gz' > Content type 'application/x-gzip' length 710241 bytes > opened URL > == > downloaded 693Kb > > gcc -std=gnu99 -shared -L/usr/local/lib -o RSQLite.so RS-DBI.o > RS-SQLite.o sqlite-all.o -L/usr/lib/R/lib -lR > /usr/bin/ld: skipping incompatible /usr/lib/R/lib/libR.so when > searching for -lR > /usr/bin/ld: cannot find -lR > collect2: ld returned 1 exit status > make: *** [RSQLite.so] Error 1 > chmod: cannot access `/usr/lib/R/library/RSQLite/libs/*': No such file > or directory > ERROR: compilation failed for package 'RSQLite' > ** Removing '/usr/lib/R/library/RSQLite' > > The downloaded packages are in > /tmp/RtmpHQ5Y7C/downloaded_packages > Warning message: > installation of package 'RSQLite' had non-zero exit status in: > install.packages("RSQLite") > > I appreciate your help. > > Thank you very much > > Taka > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] length of a string
Hi, sapply(levels(df[,"SEQUENCE"]), nchar) Where 'df' is your data.frame -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 05/09/07, João Fadista <[EMAIL PROTECTED]> wrote: > > Dear all, > > I would like to know how can I compute the length of a string in a > dataframe. Example: > > SEQUENCE ID > TGCTCCCATCTCCACGGHR04FS00645 > ACTGAACTCCCATCTCCAAT HR0595847847 > > I would like to know how to compute the length of each SEQUENCE. > > > Best regards, > João Fadista > > [[alternative HTML version deleted]] > > > __ > R-help@stat.math.ethz.ch 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. > > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] Recursive concatenation
Hi, paste(rep(LETTERS[1:3], each=3), rep(1:3, 3), sep="") -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 04/09/07, Dennis Fisher <[EMAIL PROTECTED]> wrote: > > Colleagues, > > I want to create the following array: > "A1", "A2", "A3", "B1", "B2", "B3", "C1", "C2", "C3" > > I recall that there is a trick using "c" or "paste" permitting me to > form all combinations of c("A", "B", "C") and 1:3. But, I can't > recall the trick. > > Dennis > > > Dennis Fisher MD > P < (The "P Less Than" Company) > Phone: 1-866-PLessThan (1-866-753-7784) > Fax: 1-415-564-2220 > www.PLessThan.com > > > [[alternative HTML version deleted]] > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] by group problem
Hi, try this: by(data$percentOld, list(data$state, data$county), FUN=topN) is this you want? -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 31/08/2007, Cory Nissen <[EMAIL PROTECTED]> wrote: > > That didn't work for me... > > Here's some data to help with a solution. > > data <- NULL > data$state <- c(rep("Illinois", 10), rep("Wisconsin", 10)) > data$county <- c("Adams", "Brown", "Bureau", "Cass", "Champaign", > "Christian", "Coles", "De Witt", "Douglas", "Edgar", > "Adams", "Ashland", "Barron", "Bayfield", "Buffalo", > "Burnett", "Chippewa", "Clark", "Columbia", "Crawford") > data$percentOld <- c(17.554849, 16.826594, 18.196593, 17.139242, 8.743823 > , > 17.862746, 13.747967, 16.626302, 15.258940, 18.984435 > , > 19.347022, 17.814436, 16.903067, 17.632781, 16.659305 > , > 20.337817, 14.293354, 17.252820, 15.647179, 16.825596 > ) > > return something like this... > $Illinois > "Edgar" > 18.984435 > "Bureau" > 18.196593 > ... > $Wisconsin > "Burnett" > 20.33782 > "Adams" > 19.34702 > ... > > My Solution gives... > topN <- function(column, n=5) > { > column <- sort(column, decreasing=T) > return(column[1:n]) > } > tapply(data$percentOld, data$state, topN) > > $Illinois > [1] 18.98444 18.19659 17.86275 17.55485 17.13924 > $Wisconsin > [1] 20.33782 19.34702 17.81444 17.63278 17.25282 > > I get an error with this try... > aggregate(data$percentOld, list(data$state, data$county), topN) > > Error in aggregate.data.frame(as.data.frame(x), ...) : > 'FUN' must always return a scalar > > Thanks > > cn > > > > > > From: Petr PIKAL [mailto:[EMAIL PROTECTED] > Sent: Fri 8/31/2007 8:15 AM > To: Cory Nissen > Cc: r-help@stat.math.ethz.ch > Subject: Odp: [R] by group problem > > > > Hi > > > I am working with census data. My columns of interest are... > > > > PercentOld - the percentage of people in each county that are over 65 > > County - the county in each state > > State - the state in the US > > > > There are about 3100 rows, with each row corresponding to a county > within a state. > > > > I want to return the top five "PercentOld" by state. But I want the > County > > and the Value. > > > > I tried this... > > > > topN <- function(column, n=5) > > { > > column <- sort(column, decreasing=T) > > return(column[1:n]) > > } > > top5PerState <- tapply(data$percentOld, data$STATE, topN) > > Try > > aggregate(data$PercentOld, list(data$State, data$County), topN) > > Regards > Petr > > > > > > But this only returns the value for "percentOld" per state, I also want > the > > corresponding County. > > > > I think I'm close, but I just can't get it... > > > > Thanks > > > > cn > > > >[[alternative HTML version deleted]] > > > > __ > > R-help@stat.math.ethz.ch 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. > > > > > [[alternative HTML version deleted]] > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] mtext, picking subscript text from colnames(df)
Try: mtext(eval(parse(tex=paste("expression(mu[", colnames(PresEsts)[2],"])", sep=""))),side=2,at=max(y)-15,las=1) -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] boxplot will remember the factor levels
Try: boxplot(mLength ~ puntar[drop=T],data=test) -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 30/08/2007, Luis Ridao Cruz <[EMAIL PROTECTED]> wrote: > > R-help, > > I'm trying to do a simple box-and-whisker plot to some data. > The data are a subset of a large data frame > but when running the "boxplot" function on the subset data > all the factors are still present in the graph leaving a huge > empty space until the actuals factors are shown. > This produces a spurious box-and-whisker plot. > > If the subset data are exported to another R session the problem is > gone. > Why are the factors still "remembered" by the boxplot? > > Attached is a copy of the data. > > > Thanks in advance > > > ## the line code > boxplot(mLength ~ puntar,data=test) > > > version >_ > platform i386-pc-mingw32 > arch i386 > os mingw32 > system i386, mingw32 > status > major 2 > minor 5.1 > year 2007 > month 06 > day27 > svn rev42083 > language R > version.string R version 2.5.1 (2007-06-27) > > > > > __ > R-help@stat.math.ethz.ch 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. > > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] Converting into time series object
You can use the 'ts' function. Example df <- ts(your_data_frame, start=c(1990,1), #The initial date of your data end=c(2000,12), #The final date of your data or frequency=12)#The frequency of your data, so you don't need of the 'end' argument See ?ts and ?as.ts for more. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 29/08/2007, Shubha Vishwanath Karanth <[EMAIL PROTECTED]> wrote: > > Hi, > > > > I have a dataframe of trading dates along with the corresponding prices. > I need to convert this into a time series object. How do I do this with > my price values being the time series object and the dates/time being > the trading dates. > > > > > > BR, Shubha > > > [[alternative HTML version deleted]] > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] retrieve p-value from a cox.obj
See the source code of function: survival:::print.coxph -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 29/08/2007, clearsky <[EMAIL PROTECTED]> wrote: > > > I tried obj$p, obj$pvalue, but they both returned null~~ > > > clearsky wrote: > > > > I have a cox.obj named obj, > > obj <- coxph( Surv(time, status) ~ group, surv.data) > > now I want to retrieve the p-value from obj, so that I can run this > > hundreds of times and plot out the distribution of the p-value. could > > anyone tell me how to get p-value from obj? > > > > thanks, > > > > > > -- > View this message in context: > http://www.nabble.com/retrieve-p-value-from-a-cox.obj-tf4348520.html#a12390960 > Sent from the R help mailing list archive at Nabble.com. > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] Month end calculations
Then, you can try: For example: head(df) datevalue 1 1990-01-01 4.716572 2 1990-02-01 3.418355 3 1990-03-01 1.982209 4 1990-04-01 3.974942 5 1990-05-01 6.624222 6 1990-06-01 5.729092 max(as.Date(df$date)) or if you interest is in the month only: max(format.Date(as.Date(df$date), "%m-%d")) -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 29/08/2007, Shubha Vishwanath Karanth <[EMAIL PROTECTED]> wrote: > > But my dataset is a data frame . > > > > BR, Shubha > -- > > *From:* Henrique Dallazuanna [mailto:[EMAIL PROTECTED] > *Sent:* Wednesday, August 29, 2007 5:12 PM > *To:* Shubha Vishwanath Karanth > *Cc:* r-help@stat.math.ethz.ch > *Subject:* Re: [R] Month end calculations > > > > Hi, > > Perhaps if object is of the type 'ts', the command 'end' can usefully. > > -- > Henrique Dallazuanna > Curitiba-Paraná-Brasil > 25° 25' 40" S 49° 16' 22" O > > On 29/08/2007, *Shubha Vishwanath Karanth* <[EMAIL PROTECTED]> > wrote: > > Hi R users, > > > > Is there a function in R, which does some calculation only for the month > end in a daily data?... In other words, is there a command in R, > equivalent to "last." function in SAS? > > > > BR, Shubha > > > [[alternative HTML version deleted]] > > __ > R-help@stat.math.ethz.ch 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. > > > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] Month end calculations
Hi, Perhaps if object is of the type 'ts', the command 'end' can usefully. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 29/08/2007, Shubha Vishwanath Karanth <[EMAIL PROTECTED]> wrote: > > Hi R users, > > > > Is there a function in R, which does some calculation only for the month > end in a daily data?... In other words, is there a command in R, > equivalent to "last." function in SAS? > > > > BR, Shubha > > > [[alternative HTML version deleted]] > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] Efficient way to parse string and construct data.frame
Hi, do.call("rbind", lapply(strsplit(mylist, ","), as.numeric)) -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 28/08/07, yoo <[EMAIL PROTECTED]> wrote: > > > Hi all, > > I have this list of strings > [1] "1 ,2 ,3" "4 ,5 ,6" > > Is there an efficient way to convert it to data.frame: >V1 V2 V3 > 1 1 23 > 2 4 56 > > Like I can use strsplit to get to a list of split strings.. and then use > say > a = strsplit(mylist, ",") > data.frame(V1 = lapply(a, function(x){x[1]}), V2 = lapply(a, > function(x){x[2]}),.) > > but i'm loop through that list so many times.. so I'm hesitated to use > that.. > > Thanks a lot for your great help before and this time as well!! > - boy > -- > View this message in context: > http://www.nabble.com/Efficient-way-to-parse-string-and-construct-data.frame-tf4342441.html#a12370234 > Sent from the R help mailing list archive at Nabble.com. > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] Forcing coefficients in lm object
Hi, names(fit) fit$coefficients[[2]] <- 100 -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 28/08/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Dear all, > > I would like to use predict.lm() with an existing lm object but with new > arbitrary coefficients. I modify 'fit$coef' (see example below) "by hand" > but the actual model in 'fit' used for prediction does not seem to be > altered (although fit$coef is!). > > Can anyone please help me do this properly? > > Thanks in advance, > > Jérémie > > > > > dat <- data.frame(y=c(0,25,32,15), x=as.factor(c(1,1,2,2))) > > fit <- lm(y ~ x, data=dat) > > fit > > Call: > lm(formula = y ~ x, data = dat) > > Coefficients: > (Intercept) x2 >12.5 11.0 > > > fit$coef[[2]] <- 100 > > dat.new <- data.frame(x=as.factor(c(1,2,1,2))) > > predict.lm(fit, dat.new) >1234 > 12.5 23.5 12.5 23.5 > > fit > > Call: > lm(formula = y ~ x, data = dat) > > Coefficients: > (Intercept) x2 >12.5 11.0 > > > fit$coef > (Intercept) x2 >12.5 100.0 > > > > > > Jérémie Lebrec > Dept. of Medical Statistics and Bioinformatics > Leiden University Medical Center > Postzone S-05-P > P.O. Box 9600 > 2300 RC Leiden > The Netherlands > [EMAIL PROTECTED] > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] R Help
You don't have installed the akima pakage. install.packages("akima", dep=T) -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 28/08/07, Ola Asteman <[EMAIL PROTECTED]> wrote: > > > > I got the Warning message below when I tried to load Locfit. What is > wrong? > > Regards > Ola Asteman > > > -- > > R version 2.4.0 (2006-10-03) > Copyright (C) 2006 The R Foundation for Statistical Computing > ISBN 3-900051-07-0 > > R is free software and comes with ABSOLUTELY NO WARRANTY. > You are welcome to redistribute it under certain conditions. > Type 'license()' or 'licence()' for distribution details. > > R is a collaborative project with many contributors. > Type 'contributors()' for more information and > 'citation()' on how to cite R or R packages in publications. > > Type 'demo()' for some demos, 'help()' for on-line help, or > 'help.start()' for an HTML browser interface to help. > Type 'q()' to quit R. > > > library(foreign) > > library(mgcv) > This is mgcv 1.3-19 > > library(locfit) > Loading required package: akima > Error: package 'akima' could not be loaded > In addition: Warning message: > there is no package called 'akima' in: library(pkg, character.only = TRUE, > logical = TRUE, lib.loc = lib.loc) > > > > > > > -- > This e-mail and any attachment may be confidential and may a...{{dropped}} > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] Sequential Rank Test
Hi Bernardo, I think that ?wilcox.test will help you. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 27/08/07, Bernardo Rangel Tura <[EMAIL PROTECTED]> wrote: > > Hi R-Masters > > > I need use a sequential approach in serie of cases, but may data is not > normal. > > If data is normal distribution is very easy create analysis using > likelihood ratio like of Wald test. > > But in my case I need use a non-parametric test (Mann-Whitney). > > I was use: RSiteSearch("sequential rank test") but not solve my > problem. > > Do you know routine or package implement sequential rank test in R? > > Thanks in advance > > > -- > Bernardo Rangel Tura, M.D,Ph.D > National Institute of Cardiology > Brazil > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] Merging two files together in R
Hi, merge(df.x, df.y, by.x=1) where df.x is your Snpfile and df.y is Annotation file. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 24/08/07, Morassa Mohseni <[EMAIL PROTECTED]> wrote: > > Hi, > > Thanks in advance for reading this post. > > I received some affymetrix genotyping data back recently (250K, Nsp > array) However, in order for me to do any analysis on this data set, I > need > to add append the annotation file to it. Basically I want to do something > that looks like this: > > > > Snpfile(tab delimited): > > > > SNPID Genotype X Y > > 123 AA13.4 1.2 > > 456 AB 10.1 12.2 > > 789 BB 2.714.4 > > > > Annotation file (csv file): > > > > rs#, SNPID, Chromosome > > rs23525, 456, 12 > > rs78423, 123, 4 > > rs82342, 789, 9 > > > > What I am trying to get is an output file that looks like this: > > > > SNPID rs# > Chromosome Genotype X Y > > 123 rs78423 4 AA > 13.4 > 1.2 > > 456 rs23525 12AB > 10.1 > 12.2 > > 789 rs82342 9BB > 2.7 > 14.4 > > > > > > The SNPID is the same in both files so I would like to use that to match > up but they are not in the same order in both files, so I want to make > sure > that I am appending and merging the 2 files correctly. So far all ive > really > been able to do is import the files into R Ive been looking through the > posts, and was wondering if I could use cbind( ) to merge the files?...not > sure though. > > > > Thanks again!! > > Morassa Mohseni > > > > PhD Student > > Johns Hopkins Dept. of Human Genetics > > Baltimore, MD > > [[alternative HTML version deleted]] > > > __ > R-help@stat.math.ethz.ch 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. > > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] Applying a function to an array
Hi, apply(aperm(a), 2, sd) -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 24/08/07, Florent Bresson <[EMAIL PROTECTED]> wrote: > > Dear R-users, > > I would like to apply a function (more precisely sd()) over the third > dimension of a three-dimension array. The function apply would be > interesting but the chosen function can only be applied on the rows and > columns of the array according to the help file. I can use a loop to cut the > array in matrices and then use apply for each replication, but it's not very > nice. A small example: > > a<-array(runif(1200),c(3,4,100)) > b<-matrix(NA,3,4) > for(j in 1:3){ b[j,]<-apply(a[j,,],1,sd) } > > Is there someting better than the use of a loop ? > > Thanks > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] It is possible to use a Shell command inside a R script?
Hi, see ?system -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 24/08/07, Ronaldo Reis Junior <[EMAIL PROTECTED]> wrote: > > Hi, > > It is possible to use a shell command inside a R script? > > I'm write a R script and I like to put somes shell commands inside to R. > Somethink like: convert fig01.png fig01.xpm or sed ..., etc. > > It is possible? How? > > Thanks > Ronaldo > -- > Acalme-se, são somente 0's e 1's > -- > > Prof. Ronaldo Reis Júnior > | .''`. UNIMONTES/Depto. Biologia Geral/Lab. de Ecologia > | : :' : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia > | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil > | `- Fone: (38) 3229-8187 | [EMAIL PROTECTED] | > [EMAIL PROTECTED] > | http://www.ppgcb.unimontes.br/ | ICQ#: 5692561 | LinuxUser#: 205366 > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] state map question
map('state', col=terrain.colors(50), fill=T) -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 23/08/07, Smith, Phil (CDC/CCID/NCIRD) <[EMAIL PROTECTED]> wrote: > > Hi R-Help: > > I want to produce a map of the US with different colors for selected > states. > > I installed the map package, and then used: > library(maps) > > I can see that by using > map( 'state' ) > you get the state boundaries, also. > > How do I fill in different colors for the different states? I see there > is a col parameter for map, but can't see how to get it to work! > > Please reply directly to: [EMAIL PROTECTED] > > Many Thanks! > Phil Smith > Centers for Disease Control and Prevention > Atlanta > > > [[alternative HTML version deleted]] > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] how do i use the get function to obtain an element from a list...
Hi, you can try this: eval(parse(text="a$x")) -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 21/08/07, Juan Manuel Barreneche <[EMAIL PROTECTED]> wrote: > > my problem can be explained with the following example: > > x <- 1:12 > y <- 13:24 > a <- data.frame(x = x, y = y) > > ## if i write > a$x > ## it returns > [1] 1 2 3 4 5 6 7 8 9 10 11 12 > > ## but the function get doesn't recognize a$x. Instead it produces the > following error: > get("a$x") > Error in get(x, envir, mode, inherits) : variable "a$x" was not found > > i intend to do it inside a loop, using a new object (and hence, a new > name) for each iteration (i.e., instead of a$x, it would be a$1, a$2, > a$3, and so on, for a million times). > > i would greatly appreciate it if someone could help me on this issue, > > thanks in advance, > > Juan Manuel Barreneche, > Zoología de Vertebrados, > Facultad de Ciencias, > UDELAR, Uruguay. > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] extracting month from date in numeric form
Hi, perhaps: format.Date(as.Date("1979-12-20"), "%m") -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 21/08/07, Gonçalo Ferraz <[EMAIL PROTECTED]> wrote: > > Hi, > Anyone knows what would be a short way of extracting a month from a date > in > numeric or integer format? > > months("1979-12-20") > returns > "December" in character format. > > How could I get 12 in numeric or integer format? > > Thanks! > > G. > > [[alternative HTML version deleted]] > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] Subscript
mtext(text=expression(x[1])) -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 20/08/07, squall44 <[EMAIL PROTECTED]> wrote: > > > I have the following code: > > mtext(text="X[1]") > > How can I change "[1]" to be subscript? (see picture below) > > http://www.nabble.com/file/p12241351/subscript.gif subscript.gif > > Thanks for any help > Tobias > -- > View this message in context: > http://www.nabble.com/Subscript-tf4300665.html#a12241351 > Sent from the R help mailing list archive at Nabble.com. > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] problem using "rank"
Hi, try this: total_list$MB.rank[!is.na(toal_list$MB)] <- rank(-total_list$MB,ties.method= "min",na.last=NA) -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 17/08/07, Jiong Zhang, PhD <[EMAIL PROTECTED]> wrote: > > Hi All, > > I had 12766 elements in a column, 12566 are values and 200 are "NA"s. I > used the following line to get the ranks: > > total_list$MB.rank <- rank(-total_list$MB,ties.method="min",na.last=NA) > > but I got an error message: > > Error in `$<-.data.frame`(`*tmp*`, "BCRP_PW_F.rank", value = c(3949, > 6182, : > replacement has 12199 rows, data has 12766 > > What shall I do to keep the "NA"s as "NA"s? thanks a lot. > > Jiong > The email message (and any attachments) is for the sole use...{{dropped}} > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] matching elements from two vectors
Hi! v1 <- c(1,2,1,1,3,5,3,3,1) v2 <- c(2,3) v1 %in% v2 -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 17/08/07, Gonçalo Ferraz <[EMAIL PROTECTED]> wrote: > > Hi, > > Imagine a vector x with elements (1,2,1,1,3,5,3,3,1) and a vector y with > elements (2,3). I need to find out what elements of x match any of the > elements of y. > > Is there a simple command that will return a vector with elements > (F,T,F,F,T,F,T,T,F). Ideally, I would like a solution that works with > dataframe colums as well. > > I have tried x==y and it doesn't work. > x==any(y) doesn't work either. I realize I could write a foor loop and go > through each element of y asking if it matches any element of x, but isn't > there a shorter way? > > Thanks, > Gonçalo > > [[alternative HTML version deleted]] > > > __ > R-help@stat.math.ethz.ch 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. > > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] export to txt
write.table(yourtable, "file.txt", quote=F) -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 17/08/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > I just used the table () function for building a presence/absence matrix > of plots vs. species > Now I would like to export the result to a txt file. > Thanks > Duccio > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] Date format on x-axis
Perhaps: lct <- Sys.getlocale("LC_TIME") Sys.setlocale("LC_TIME", "English") format.Date(Date, "%b-%Y") For restore the configurations: Sys.setlocale("LC_TIME", lct) -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 17/08/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Dear R users, > > Plotting question from a R beginner... > > When I try to plot a response through time, for example: > >Date<-c("2006-08-17", "2006-08-18", "2006-08-19", "2006-08-20") > >response<-c(4,4,8,12) > >as.Date(Date) > >plot(Date,response) > > The dates on the graphic appear in spanish. This I guess is the default > way of plotting because my windows is in spanish, but I need a "aug 17" > instead of "ago 17" (agosto is the spanish for august)... > I've tried, > >format(Date, "%m %d") > And although it does change the way Date is listed, well it's still > plotted in spanish... > I've also searched through par() settings, but xaxp,xaxs, xaxt, xpd and > xlog do not solve my problem... > > Could anyone help me solve this format question? > > Thanks a million in advance, > > Greetings, > Iñaki Etxebeste Larrañaga > M.Sc. Biologist > Producción Vegetal y Recursos Forestales > ETSIIAA Universidad de Valladolid > Avda. Madrid,57 > 34071 Palencia (Spain) > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] Urgent Help needed
Hi, try this: by(df[,1:2], df$index, FUN=function(x)cor(x[1],x[2])) -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 16/08/07, AbouEl-Makarim Aboueissa <[EMAIL PROTECTED]> wrote: > > Thanks all. > > it works. > > Just one more thing: if you look to this out put, > > > by(data1[,2:3], data1[,4], cor)[1] > $`1` > XY > X 1.0000.4400451 > Y 0.4400451 1.000 > > Q. How I can just pick the value of the correlation 0.4400451 from this > output and call it sat corxy. > > > Once again thank you all so much for your helps. > > > Abou > > > == > AbouEl-Makarim Aboueissa, Ph.D. > Assistant Professor of Statistics > Department of Mathematics & Statistics > University of Southern Maine > 96 Falmouth Street > P.O. Box 9300 > Portland, ME 04104-9300 > > Tel: (207) 228-8389 > Email: [EMAIL PROTECTED] > [EMAIL PROTECTED] > Office: 301C Payson Smith > > >>> "Henrique Dallazuanna" <[EMAIL PROTECTED]> 8/16/2007 2:05 PM >>> > For the 2nd item, perhaps: > > by(df[,1:2], df$index, FUN=cor) > > where df is your data.frame. > > -- > Henrique Dallazuanna > Curitiba-Paraná-Brasil > 25° 25' 40" S 49° 16' 22" O > > On 16/08/07, AbouEl-Makarim Aboueissa <[EMAIL PROTECTED]> wrote: > > > > Dear All: > > > > Urgent help is needed. > > > > > > I have a data set in matrix format of three columns: X, Y and index of > > four groups (1,2,3,4). What I need to do is the following; > > > > 1- How I can subtract the sample mean of each group indexed 1,2,3,4 from > > the > > corresponding data values of this group and create new columns say > > X-sample mean > > and Y-sample mean? I tried to use the "tapply" but I have some > > difficulties to restore the new data > > > > > > 2- How I can use the "tapply" if possible or any other R-function to > find > > the correlation > > coefficient between the X and Y columns for each group indexed > > 1,2,3,4.? Could not use the "tapply". > > > > > > I attached part of the data as txt file. > > > > > > Thank you so much for your attention to this matter, and I look forward > to > > hear from you soon. > > > > Regards, > > > > Abou > > > > > > Data: > > > > x y index > > 15807.2412.54 > > 15752.5133.54 > > 12893.7601.53 > > 8426.88 22.23 > > 5706.24 333 3 > > 3982.08 560 2 > > 3642.62 670 2 > > 295.68 124 1 > > 215.40 104 1 > > 195.40 204 1 > > 4240.21 22.42 > > 1222.72 45.92 > > 1142.26 23.62 > > 63.00 90.11 > > 1216.00 82.42 > > 2769.60 111 2 > > 1790.46 34.72 > > 26.10 26.10 1 > > 19676.830.994 > > 10920.60203 3 > > 6144.00 46 3 > > 4534.48 4534.48 3 > > 4.0065 4 > > 29500.0056 4 > > 17100.0077 4 > > 9000.00 435 3 > > 6300.00 84 3 > > 3962.88 334 2 > > 5690.00 653 3 > > 3736.00 233 2 > > 2750.00 22 2 > > 1316.00 345 2 > > 4595.00 4595.00 3 > > 5928.00 45 3 > > 2645.70 0.002 > > 2580.24 454 2 > > 6547.34 6547.34 3 > > 1615.68 5 2 > > 194.06 55 1 > > 184.80 6 1 > > 82.94 44 1 > > 16649.0056 4 > > 4500.00 74 3 > > 1600.00 744 2 > > > > = > > > > > > > > == > > AbouEl-Makarim Aboueissa, Ph.D. > > Assistant Professor of Statistics > > Department of Mathematics & Statistics > > University of Southern Maine > > 96 Falmouth Street > > P.O. Box 9300 > > Portland, ME 04104-9300 > > > > Tel: (207) 228-8389 > > Email: [EMAIL PROTECTED] > > [EMAIL PROTECTED] > > Office: 301C Payson Smith > > > > > > __ > > R-help@stat.math.ethz.ch 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. > > > > > > > > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] Urgent Help needed
For the 2nd item, perhaps: by(df[,1:2], df$index, FUN=cor) where df is your data.frame. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 16/08/07, AbouEl-Makarim Aboueissa <[EMAIL PROTECTED]> wrote: > > Dear All: > > Urgent help is needed. > > > I have a data set in matrix format of three columns: X, Y and index of > four groups (1,2,3,4). What I need to do is the following; > > 1- How I can subtract the sample mean of each group indexed 1,2,3,4 from > the > corresponding data values of this group and create new columns say > X-sample mean > and Y-sample mean? I tried to use the "tapply" but I have some > difficulties to restore the new data > > > 2- How I can use the "tapply" if possible or any other R-function to find > the correlation > coefficient between the X and Y columns for each group indexed > 1,2,3,4.? Could not use the "tapply". > > > I attached part of the data as txt file. > > > Thank you so much for your attention to this matter, and I look forward to > hear from you soon. > > Regards, > > Abou > > > Data: > > x y index > 15807.2412.54 > 15752.5133.54 > 12893.7601.53 > 8426.88 22.23 > 5706.24 333 3 > 3982.08 560 2 > 3642.62 670 2 > 295.68 124 1 > 215.40 104 1 > 195.40 204 1 > 4240.21 22.42 > 1222.72 45.92 > 1142.26 23.62 > 63.00 90.11 > 1216.00 82.42 > 2769.60 111 2 > 1790.46 34.72 > 26.10 26.10 1 > 19676.830.994 > 10920.60203 3 > 6144.00 46 3 > 4534.48 4534.48 3 > 4.0065 4 > 29500.0056 4 > 17100.0077 4 > 9000.00 435 3 > 6300.00 84 3 > 3962.88 334 2 > 5690.00 653 3 > 3736.00 233 2 > 2750.00 22 2 > 1316.00 345 2 > 4595.00 4595.00 3 > 5928.00 45 3 > 2645.70 0.002 > 2580.24 454 2 > 6547.34 6547.34 3 > 1615.68 5 2 > 194.06 55 1 > 184.80 6 1 > 82.94 44 1 > 16649.0056 4 > 4500.00 74 3 > 1600.00 744 2 > > = > > > > == > AbouEl-Makarim Aboueissa, Ph.D. > Assistant Professor of Statistics > Department of Mathematics & Statistics > University of Southern Maine > 96 Falmouth Street > P.O. Box 9300 > Portland, ME 04104-9300 > > Tel: (207) 228-8389 > Email: [EMAIL PROTECTED] > [EMAIL PROTECTED] > Office: 301C Payson Smith > > > __ > R-help@stat.math.ethz.ch 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. > > > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] Formula in lm inside lapply
try this: lapply(levels(df$group), function(x)lm(formula1, data=df[group==x,])) -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 15/08/07, Li, Yan (IED) <[EMAIL PROTECTED]> wrote: > > I am trying to run separate regressions for different groups of > observations using the lapply function. It works fine when I write the > formula inside the lm() function. But I would like to pass formulae into > lm(), so I can do multiple models more easily. I got an error message > when I tried to do that. Here is my sample code: > > #generating data > x1 <- rnorm(100,1) > x2 <- rnorm(100,1) > y <- rnorm(100,1) > group <- rep(c("A","B"),c(40,60)) > group <- factor(group) > df <- data.frame(y,x1,x2,group) > > #write formula inside lm--works fine > res1 <- lapply(levels(df$group), function(x) lm(y~x1,df, subset = group > ==x)) > res1 > res2 <- lapply(levels(df$group),function(x) lm(y~x1+x2,df, subset = > group ==x)) > res2 > > #try to pass formula into lm()--does not work > formula1 <- as.formula(y~x1) > formula2 <- as.formula(y~x1+x2) > resf1 <- lapply(levels(df$group),function(x) lm(formula1,df, subset = > group ==x)) > resf1 > resf2 <- lapply(levels(df$group),function(x) lm(formula2,df, subset = > group ==x)) > Resf2 > > The error message is > 'Error in eval(expr, envir, enclos): object "x" not found' > > Any help is greatly appreciated! > > Yan > > > This is not an offer (or solicitation of an offer) to buy/se...{{dropped}} > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] question regarding is.factor()
See ?class -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 13/08/07, Jabez Wilson <[EMAIL PROTECTED]> wrote: > > Dear all, please help with what must be a straightforward question which I > can't answer. > > I add a column of my dataframe as factor of an existing column e.g. > > df[,5] <- factor(df[,2]) > > and can test that it is by is.factor() > > but if I did not know in advance what "types" the columns were, is there > a function to tell me what they are. > > i.e. instead of is.factor(), is.matrix(), is.list(), a function more > like what.is() > > > > > > - > > [[alternative HTML version deleted]] > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] need help to manipulate function and time interval
You are right, I'm sorry, but perhaps: time <- "19:00:00" time > "18:00:00" & time < "23:59:59" works? -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 10/08/07, Uwe Ligges <[EMAIL PROTECTED]> wrote: > > > > Henrique Dallazuanna wrote: > > Hi, > > > > Try whit: > > > > if(time[j] >= "18:00:00" & < "23:59:59") > > This code is obviously wrong and does not help for the next few lines in > the questioner's message, please do not post unsensible stuff. > > Uwe Ligges > > > > ... > > ... > > > > > > > > > > > > __ > > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] Help wit matrices
mat2<-matrix(as.numeric(mat1>0.25), ncol=1000) -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 10/08/07, Lanre Okusanya <[EMAIL PROTECTED]> wrote: > > Hello all, > > I am working with a 1000x1000 matrix, and I would like to return a > 1000x1000 matrix that tells me which value in the matrix is greater > than a theshold value (1 or 0 indicator). > i have tried > mat2<-as.matrix(as.numeric(mat1>0.25)) > but that returns a 1:10 matrix. > I have also tried for loops, but they are grossly inefficient. > > THanks for all your help in advance. > > Lanre > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] need help to manipulate function and time interval
Hi, Try whit: if(time[j] >= "18:00:00" & < "23:59:59") ... ... -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 10/08/07, KOITA Lassana - STAC/ACE <[EMAIL PROTECTED]> wrote: > > Hi R-users, > > I have to define a noise level function L and its energy in the various > moment of the day by: > > if time is between 18:00:00 and 23:59:59 then L[j] <- L[j]+5 and W <- > 10^((L+5)/10) > > if time is between 22:00:00 and 05:59:59 ==> L <- L+10 and W <- > 10^((L+10)/10) > else > L=L and W = W > > Could someone help me to realize this function please? You will find my > following proposal code, but my main problem is to handle the time > interval. > > Best regard > > ### > myfunc <- function(mytab, Time, Level) > { > vect <- rep(0, length(mytab)) > for(i in 1:length(vect)) >{ > for(j in 1:length(Time)) > > if(time[j] is between 18:00:00 and 23:59:59) > > L[i] <- L[j]+5 > >vect[i] <- 10^((L[i])/10 > > if (time[j] is between 22:00:00 and 05:59:59) > > L[i] <- L[j]+10 > > vect[i] <- 10^((L[i])/10 > > else > >L[i] = L[j] > > vect[i] <- 10^((L[i])/10 > } > } > > ### > > Lassana KOITA > Chargé d'Etudes de Sécurité Aéroportuaire et d'Analyse Statistique / > Project Engineer Airport Safety Studies & Statistical analysis > Service Technique de l'Aviation Civile (STAC) / Civil Aviation Technical > Department > Direction Générale de l'Aviation Civile (DGAC) / French Civil Aviation > Headquarters > Tel: 01 49 56 80 60 > Fax: 01 49 56 82 14 > E-mail: [EMAIL PROTECTED] > http://www.stac.aviation-civile.gouv.fr/ > [[alternative HTML version deleted]] > > > __ > R-help@stat.math.ethz.ch 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. > > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] having problems with factor()
Hi, df ht area 1 3203 2 4104 3 2302 4 3603 5 1261 6 2802 7 2602 8 2802 9 2802 10 2602 df$area <- as.factor(df$area) levels(df$area) <- c("I", "II", "III", "IV") -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 10/08/07, Jabez Wilson <[EMAIL PROTECTED]> wrote: > > Dear R Help, > I have a set of data of heights of trees described by area that they are > in. The areas are numerical (0 to 7). > > htarea > 1 320 3 > 2 410 4 > 3 230 2 > 4 360 3 > 5 126 1 > 6 280 2 > 7 260 2 > 8 280 2 > 9 280 2 > 10 260 2 > ... > 180 450 4 > 181 90 1 > 182 120 1 > 183 440 4 > 184 210 2 > 185 330 3 > 186 210 2 > 187 100 1 > 188 0 0 > > I want to convert the area column values to factors, to do an anova. > However, if I use: > > df$areaf <- factor(df$area, > labels=c("0","I","II","III","IV","V","VI","VII")) > > it gives the following message: > > Error in factor(df$area, labels = c("0", "I", "II", "III", "IV", "V", > "VI", : > invalid labels; length 8 should be 1 or 7 > > Can anyone help? > > Jabez > > > ___ > > now. > > [[alternative HTML version deleted]] > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] backslash c
Perhaps: cat("\\color{blue}\n") -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 07/08/07, Mikkel Grum <[EMAIL PROTECTED]> wrote: > > How do I get output with "\color{blue}", i.e. with > only one backslash??? > > > "\color{blue}" > [1] "color{blue}" > Warning messages: > 1: '\c' is an unrecognized escape in a character > string > 2: unrecognized escape removed from "\color{blue}" > > "\\color{blue}" > [1] "\\color{blue}" > > > > Any help greatly appreciated. > > Best regards, > Mikkel > > > sessionInfo() > R version 2.5.1 (2007-06-27) > i386-pc-mingw32 > > locale: > > LC_COLLATE=English_Ireland.1252;LC_CTYPE=English_Ireland.1252;LC_MONETARY=English_Ireland.1252;LC_NUMERIC=C;LC_TIME=English_Ireland.1252 > > attached base packages: > [1] "stats" "graphics" "grDevices" "utils" > "datasets" "methods" > [7] "base" > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] saving output
See ?sink -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 07/08/07, Lynn Disney <[EMAIL PROTECTED]> wrote: > > I have a question about how to save the output of a logistic regression > model in some format (delimited, preferably) so that I can manipulate it > to make nice tables in excel. I have tried print, save, write, none seem > to do what I want them to. Does anyone have any ideas? > > > > Lynn D. Disney, Ph.D., J.D., M.P.H. > > Research Analyst > > SEIU 1199 > > 1771 E. 30th Street > > Cleveland, Ohio 44114 > > Telephone: (216) 566-0117 > > Email: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > > > [[alternative HTML version deleted]] > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] Error in using nlevels in apply function
Is this what you want? mycol.index<-c(1,5,3) apply(mydata[,mycol.index],2, function(x)nlevels(factor(x))) -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 06/08/07, Sébastien <[EMAIL PROTECTED]> wrote: > > Dear R users, > > I am currently trying to create my first personnal function and use it > with the apply function. The purpose of this function is to create a > vector summarizing the number of levels in a given selection of > data.frame columns. > I tried to transpose the indexation method used by the nlevels function > but it doesn't seem to work. I did not find anything uesful in the > archives so could someone point to me where my mistake(s) is (are) ? > > Thanks in advance > > Sebastien > > #- > > mydata<-data.frame > (1:6,1:6,1:6,1:6,1:6,1:6,1:6,1:6,1:6,1:6,1:6,1:6,1:6,1:6,1:6,1:6,1:6,1:6) > mycol.index<-c(1,5,3) > > nelem<-function(x,col.id) nlevels(factor(x[,col.id])) > my.nlevels.col<-apply(mydata,2,nelem,mycol.index) > my.nlevels.col > > # > > #The error message is the following > #>Error in x[, col.id] : incorrect number of dimensions > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] Create vectors form matrices
Try: dim(matrix) <- NULL -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 06/08/07, Niccolò Bassani <[EMAIL PROTECTED]> wrote: > > Hi, dear R users. I've a kind of stupid question, I hope you can provide > some help! > The topic here's really simple: vectors and matrices. > I have a matrix (616 rows x 22 cols) filled with numbers and NAs; > something > like this: > > 1 2 3 4 5 6 NA NA NA NA > 1 2 3 4 NA NA NA NA NA . > .. > > > What I'm trying to do is to put all the rows on a unique row, so to have > something like this: > > 1 2 3 4 5 6 NA NA NA NA 1 2 3 4 NA NA NA NA NA > . > > and so on. The matter is that whatever I try, I just get something like > this: > > 1 1 1 1 1 1 1 1 .2 2 2 2 2 2 2 2 2 .. > > Obviously, this is not what required. I've tried to concatenate, I've > built > a for cicle, but nothing seems to produce what I want. Sorry for the dumb > question, but I'm almost sure I need holidays... > Thanks in advance! > niccolò > > [[alternative HTML version deleted]] > > > __ > R-help@stat.math.ethz.ch 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. > > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] t-distribution
see ?polygon function. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 01/08/07, Nair, Murlidharan T <[EMAIL PROTECTED]> wrote: > > Indeed, this is what I wanted, I figured it from the function you and > Mark pointed me. Thank you both. > > I am trying to plot it to illustrate the point and I tried this > > plot(function(x) dt(x, df = 9), -5, 5, ylim = c(0, 0.5), main="t - > Density", yaxs="i") > > Is there an easy way to shade the area under the curve? > > > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > [EMAIL PROTECTED] > Sent: Wednesday, August 01, 2007 3:18 PM > To: [EMAIL PROTECTED]; r-help@stat.math.ethz.ch > Subject: Re: [R] t-distribution > > Well, is "t = 1.11" all that accurate in the first place? :-) > > In fact, reading beween the lines of the original enquiry, what the > person probably wanted was something like > > ta <- pt(-1.11, 9) + pt(1.11, 9, lower.tail = FALSE) > > which is the two-sided t-test tail area. > > The teller of the parable will usually leave some things unexplained... > > Bill. > > > Bill Venables > CSIRO Laboratories > PO Box 120, Cleveland, 4163 > AUSTRALIA > Office Phone (email preferred): +61 7 3826 7251 > Fax (if absolutely necessary): +61 7 3826 7304 > Mobile: +61 4 8819 4402 > Home Phone: +61 7 3286 7700 > mailto:[EMAIL PROTECTED] > http://www.cmis.csiro.au/bill.venables/ > > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Ben Bolker > Sent: Thursday, 2 August 2007 4:57 AM > To: r-help@stat.math.ethz.ch > Subject: Re: [R] t-distribution > > csiro.au> writes: > > > > > for the upper tail: > > > > > 1-pt(1.11, 9) > > [1] 0.1478873 > > >wouldn't > pt(1.11, 9, lower.tail=FALSE) > be more accurate? > > __ > R-help@stat.math.ethz.ch 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. > > __ > R-help@stat.math.ethz.ch 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. > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] manipulating arrays
Hi, I don't know if is the more elegant way, but: X<-c(1,2,3,4,5) X <- c(X[1], 0, X[2:5]) -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 27/07/07, Nair, Murlidharan T <[EMAIL PROTECTED]> wrote: > > Can I insert an element in an array at a particular position without > destroying the already existing element? > > > > X<-c(1,2,3,4,5) > > > > I want to insert an element between 1 and 2. > > > > Thanks ../Murli > > > > > [[alternative HTML version deleted]] > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] Renamig a factor
Try: levels(test$Parc)[levels(test$Parc)=="OlÞrdola"] <- "Olèrdola" -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 24/07/07, Agustin Lobo <[EMAIL PROTECTED]> wrote: > > Which is the proper way to rename a factor? > If I do: > test$Parc[test$Parc=="OlÞrdola"]<-"Olèrdola" > R complains that > Warning message: > invalid factor level, NAs generated in: `[<-.factor`(`*tmp*`, test$Parc > == "OlÞrdola", value = "Olèrdola") > > Thanks > Agus > -- > Dr. Agustin Lobo > Institut de Ciencies de la Terra "Jaume Almera" (CSIC) > LLuis Sole Sabaris s/n > 08028 Barcelona > Spain > Tel. 34 934095410 > Fax. 34 934110012 > email: [EMAIL PROTECTED] > http://www.ija.csic.es/gt/obster > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] Fit t distribution
Hi, tFit(datac[[2]])@fit$estimate -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 24/07/07, livia <[EMAIL PROTECTED]> wrote: > > > Hi all, I am trying to fit t distribution using the function "tFit" in the > library(fBasics). > > I am using the code tFit(datac[[2]]) and it returns the following list. > > Title: > Student-t Parameter Estimation > > Call: > tFit(x = datac[[2]]) > > Model: > Student-t Distribution > > Estimated Parameter(s): > df > 78.4428 > > I just wonder how can I refer to the estimated parameters. I tried > tFit(datac[[2]]) $df,tFit(datac[[2]])@df, but neither of them work. > Could anyone give me some advice? > > -- > View this message in context: > http://www.nabble.com/Fit-t-distribution-tf4136445.html#a11764680 > Sent from the R help mailing list archive at Nabble.com. > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] plotting gam models
see ?predict.gam -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 24/07/07, Lucia Zarauz <[EMAIL PROTECTED]> wrote: > > > Hi everybody, > > I am working with gams and I have found some questions when plotting gams > models. > > I am using mgcv, and my model looks something like this: > > model<- gam(x ~ s(lat,long)) > > I can plot the output of the model using plot(model) or plot.gam(model) > and I get a surface plot. > > That is ok, but what I want to do now is to extract the data used to > perform the surface plot. Like that I would be able to superpose them to a > geographical map, and to plot these data using other programs. > > Thank you very much in advance > > Lucía > _ > Lucia Zarauz > AZTI - Tecnalia / Unidad de Investigación Marina > Herrera kaia portualdea z/g > 20110 Pasaia (Gipuzkoa) > Tel: 943 004 800 - Fax: 943 004 801 > e-mail: [EMAIL PROTECTED] > www.azti.es ; www.tecnalia.info > _ > > LEGE OHARRA AVISO LEGAL > DISCLAIMER > Mezu hau pertsonala eta isilpekoa da eta baimenik gabeko erabilera > debekatua dago legalki. Jasotzailea ez bazara ezabatu mezua, bidali eta > kontserbatu gabe. > Este mensaje es personal y confidencial y su uso no autorizado está > prohibido legalmente. Si usted no es el destinatario, proceda a borrarlo, > sin reenviarlo ni conservarlo. > This message is personal and confidential, unauthorised use is legally > prohibited. If you are not the intended recipient, delete it without > resending or backing it. > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] Aggregate daily data into weekly sums
Hi, Perhaps you can try: > df Date Amount 1 2007-06-01 1 2 2007-06-01 1 3 2007-06-04 2 4 2007-06-05 2 5 2007-06-11 3 6 2007-06-12 3 7 2007-06-12 3 8 2007-06-13 3 9 2007-06-13 3 10 2007-06-18 4 11 2007-06-18 4 12 2007-06-25 5 13 2007-06-28 5 df_ok <- aggregate(df$Amount, by=list(df$Amount), FUN=sum) levels(df_ok$Group.1)<- paste("2007/06/Week", 1:5, sep="") -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 23/07/07, Jacques Wagnor <[EMAIL PROTECTED]> wrote: > > Dear Lest, > > I have a two-variable data frame as follows (the time peirod of the > actual data set is 10 years): > > Date Amount > 1 6/1/2007 1 > 2 6/1/2007 1 > 3 6/4/2007 2 > 4 6/5/2007 2 > 5 6/11/2007 3 > 6 6/12/2007 3 > 7 6/12/2007 3 > 8 6/13/2007 3 > 9 6/13/2007 3 > 10 6/18/2007 4 > 11 6/18/2007 4 > 12 6/25/2007 5 > 13 6/28/2007 5 > > > Basically, I would like to collapse the daily data into weekly sums > such that the result should look like the following: > > Date Amount > 1 2007/6/Week1 2 > 2 2007/6/Week2 4 > 3 2007/6/Week3 15 > 4 2007/6/Week4 8 > 5 2007/6/Week5 10 > > Does there already exist a function that aggregates the data at > user-defined time frequency? > > Any pointers would be greatly appreciated. > > Jacques > > > version >_ > platform i386-pc-mingw32 > arch i386 > os mingw32 > system i386, mingw32 > status > major 2 > minor 5.0 > year 2007 > month 04 > day23 > svn rev41293 > language R > version.string R version 2.5.0 (2007-04-23) > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] extraction of vector elements to new list
Hi, try lapply(my.list, function(x)head(x, n=2)) -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 23/07/07, Patrick Zimmermann <[EMAIL PROTECTED]> wrote: > > Dear R-community, > > I have got a list of vectors and would like to extract the first two > elements of each vector to a new list. > > My list is of the style: > > my.list = list(c("a", "b", "c"), c("d", "e"), c("f", "g", "h", "i"), ...) > > #I want: > > new.list = list(c("a", "b"), c("d", "e"), c("f", "g"), ...) > > # As > > my.list[[3]][1:2] > > # is [1] "f" "g" > > # I thought > > my.list[[1:3]][1:2] > > # would be > > # [[1]] > # [1] "a" "b" > > # [[2]] > # [1] "d" "d" > > # [[3]] > # [1] "f" "g" > > # but is: 'Error: recursive indexing failed at level 2' > > > I think it should be easy, but none of my tried combinations of '[' > and 'c(' worked. > Who can help? > > Patrick > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] tapply
I also don't understand, but perhaps: with(df, tapply(aps, list(class, id), mean)) -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 19/07/07, sigalit mangut-leiba <[EMAIL PROTECTED]> wrote: > hello, > i want to compute the mean of a variable ("aps") for every class > (1,2, and 3). > every id have a few obs., "aps" and class are constant over id. > like this: > id aps class > 1 11 2 > 1 11 2 > 1 11 2 > 1 11 2 > 1 11 2 > 2 83 > 2 83 > 2 83 > 3 12 2 > 3 12 2 > . > . > > i tried: > > tapply(icu1$aps_st, icu1$hidclass, function(z) mean(unique(z))) > > but it's counting every row and not every id. > > thank you, > > Sigalit. > > [[alternative HTML version deleted]] > > __ > R-help@stat.math.ethz.ch 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. > __ R-help@stat.math.ethz.ch 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] df manipulation
Hi, see below: > df index value 1 1 1 2 4 6 3 7 4 4 9 5 511 3 613 2 > foo <- function(x){ + index <- ifelse(x %in% df$index, df$value[which(df$index %in% x)], NA) + return(index) + } > df_ok <- data.frame(index=1:13, value=sapply(1:13, foo)) > df_ok index value 1 1 1 2 2NA 3 3NA 4 4 6 5 5NA 6 6NA 7 7 4 8 8NA 9 9 5 1010NA 1111 3 1212NA 1313 2 -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 19/07/07, Nikola Markov <[EMAIL PROTECTED]> wrote: > I have multicolumn data.frames with the first comumn giving ordinal > observation index ( ex.: 1 4 7 9 11 13 etc). I would like to fill up the > missing observations (i.e. 2 3 5 6 8 etc) with "NA"s. > Thank you > > __ > R-help@stat.math.ethz.ch 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. > __ R-help@stat.math.ethz.ch 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] remove columns having a partial match name
Hi, DATA_OK <- DATA[,-match("Start", names(DATA))] -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 18/07/07, João Fadista <[EMAIL PROTECTED]> wrote: > Dear all, > > I would like to know how can I retrieve a data.frame without the columns that > have a partial match name. Let´s say that I have a data.frame with 200 > columns and 100 of them have the name "StartX", with X being the unique part > for each column name. I want to delete all columns that have the name > starting with "Start". I´ve tried to do this but it doesn´t work: > > > DATA_OK <- DATA[,-match(("Start*"),names(DATA))] > > dim(DATA_OK) > NULL > > > Thanks in advance. > Best regards > > João Fadista > Ph.d. student > > > > UNIVERSITY OF AARHUS > Faculty of Agricultural Sciences > Dept. of Genetics and Biotechnology > Blichers Allé 20, P.O. BOX 50 > DK-8830 Tjele > > Phone: +45 8999 1900 > Direct: +45 8999 1900 > E-mail: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > Web: www.agrsci.org <http://www.agrsci.org/> > > > News and news media <http://www.agrsci.org/navigation/nyheder_og_presse> . > > This email may contain information that is confidential. Any use or > publication of this email without written permission from Faculty of > Agricultural Sciences is not allowed. If you are not the intended recipient, > please notify Faculty of Agricultural Sciences immediately and delete this > email. > > > [[alternative HTML version deleted]] > > > __ > R-help@stat.math.ethz.ch 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. > > __ R-help@stat.math.ethz.ch 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] p-value from survreg(), library(survival)
Try also: pchisq(summary(sr)$chi, degrees_freedom, lower=FALSE) *You need know your degrees of freedom -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 11/07/07, Vlado Sremac <[EMAIL PROTECTED]> wrote: > dear r experts: > It seems my message got spam filtered, another try: > i would appreciate advice on how to get the p-value from the object 'sr' > created with the function survreg() as given below. > vlad > > sr<-survreg(s~groups, dist="gaussian") > Coefficients: > (Intercept) groups > -0.02138485 0.03868351 > > Scale= 0.01789372 > > Loglik(model)= 31.1 Loglik(intercept only)= 25.4 > Chisq= 11.39 on 1 degrees of freedom, p= 0.00074 > n= 16 > > [[alternative HTML version deleted]] > > __ > R-help@stat.math.ethz.ch 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. > __ R-help@stat.math.ethz.ch 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] Help Needed!!
See ?summary.manova -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 10/07/07, deepa gupta <[EMAIL PROTECTED]> wrote: > > Hi, > > Can anyone help me with repeated meausres MANOVA in R ? For repeated > measures ANOVA I used function "aov". Is there something like this exists > for MANOVA? > > Thanks, > Deepa > > > - > > [[alternative HTML version deleted]] > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] help with vector construction
Hi, Example: n <- 1:10 mat[2+3*n,3] #Where mat is the matrix Is what you want? -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 05/07/07, Juan Pablo Fededa <[EMAIL PROTECTED]> wrote: > > Hi all, > > I want to make a vector with the third column of a matrix, but only for > the > 2+3n rows of the matrix, with n being an entire number from 0 to a > million. > How can I do that in an easy way? > Thanks in advance, > > Juan Pablo > > [[alternative HTML version deleted]] > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] Levene Test with R
Hi, RSiteSearch("Levene Test", restrict="functions") -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 05/07/07, along zeng <[EMAIL PROTECTED]> wrote: > > Hi All, > is there Levene' test in R ? If not ,Could you give me some > advice about Levene test with R? > Thanks a lot! I am waiting for yours. > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] sequences
0.8^(1:600) -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 03/07/07, livia <[EMAIL PROTECTED]> wrote: > > > Hi, I would like to generate a series in the following form (0.8^1, 0.8^2, > ..., 0.8^600) > Could anyone tell me how can I achieve that? I am really new to R. > -- > View this message in context: > http://www.nabble.com/sequences-tf4019146.html#a11414836 > Sent from the R help mailing list archive at Nabble.com. > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] how to get the position of an element in a vector ?
which(a==max(a)) -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 03/07/07, Benoit Chemineau <[EMAIL PROTECTED]> wrote: > > Hi, dear R developers, > > I've got a vector of monthly volatilities and i would like to get the > position of the highest volatility of the vector without computing a loop. > Is there a function that could give me such a result ? > > a<-c(1,2,4,100,3) > > the highest value is the fourth of the vector. > how can i get "4" without a loop going through the vector ? > > Thanks ! > > Benoit. > > [[alternative HTML version deleted]] > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] download.file - it works on my Mac but not on Windows.
Try whit: destfile="C:/Users/Catherine Holt/test.nc" -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 02/07/07, Roy Mendelssohn <[EMAIL PROTECTED]> wrote: > > Hi: > > I am working with someone remotely to allow them access to our data. > The follow command using "download.file" works perfectly on my Mac: > > > > > download.file(url="http://oceanwatch.pfeg.noaa.gov:8081/thredds/ > > wcs/satellite/AG/ssta/14day? > > request=GetCoverage&version=1.0.0&service=WCS&format=NetCDF3&coverage= > > AGssta&Vertical=.0&time=2006-01-06T00:00:00Z&bbox=220,20,250,50", > > destfile="/users/rmendels/desktop/carrie.nc") > > trying URL 'http://oceanwatch.pfeg.noaa.gov:8081/thredds/wcs/ > > satellite/AG/ssta/14day? > > request=GetCoverage&version=1.0.0&service=WCS&format=NetCDF3&coverage= > > AGssta&Vertical=.0&time=2006-01-06T00:00:00Z&bbox=220,20,250,50' > > Content type 'application/x-netcdf' length 369144 bytes > > opened URL > > == > > downloaded 360Kb > > > > > > On Windows, which this person is using, the following fails: > > > download.file(url="http://oceanwatch.pfeg.noaa.gov:8081/thredds/wcs/ > > satellite/AG/ssta/14day? > > request=GetCoverage&version=1.0.0&service=WCS&format=NetCDF3&coverage= > > AGssta&Vertical=.0&time=2006-01-06T00:00:00Z&bbox=220,20,250,50", > > destfile="C:\Users\Catherine Holt\test.nc") > > > > > The error message is: > > > Error: Uxxx sequences are not supported on Windows > > > > Relevant Info: > > Mac: > > > version > _ > platform powerpc-apple-darwin8.9.1 > arch powerpc > os darwin8.9.1 > system powerpc, darwin8.9.1 > status > major 2 > minor 5.1 > year 2007 > month 06 > day27 > svn rev42083 > language R > version.string R version 2.5.1 (2007-06-27) > > > Windows: > > Here's my Version information: >_ > platform i386-pc-mingw32 > arch i386 > os mingw32 > system i386, mingw32 > status > major 2 > minor 5.0 > year 2007 > month 04 > day23 > svn rev41293 > language R > version.string R version 2.5.0 (2007-04-23) > > > Any help or workarounds appreciated. > > -Roy M. > > > > > > > ** > "The contents of this message do not reflect any position of the U.S. > Government or NOAA." > ** > Roy Mendelssohn > Supervisory Operations Research Analyst > NOAA/NMFS > Environmental Research Division > Southwest Fisheries Science Center > 1352 Lighthouse Avenue > Pacific Grove, CA 93950-2097 > > e-mail: [EMAIL PROTECTED] (Note new e-mail address) > voice: (831)-648-9029 > fax: (831)-648-8440 > www: http://www.pfeg.noaa.gov/ > > "Old age and treachery will overcome youth and skill." > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] basics: changing the directory
?setwd -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 02/07/07, Georg Ehret <[EMAIL PROTECTED]> wrote: > > Dear Ms. R, >I struggle with a very basic command for most of you: How to change the > working-directory by command-line? > > Thank you! > Georg. > ** > Georg Ehret > Johns Hopkins University School of Medicine > Broadway Research Building, Room 572 > 733 N. Broadway > Baltimore, MD 21205 > Phone: (410) 502-7530 > Fax: (410) 502-7544 > e-mail: [EMAIL PROTECTED] > > [[alternative HTML version deleted]] > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] Installing packages.
require(exactRankTests) -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 29/06/07, Marcus Vinicius <[EMAIL PROTECTED]> wrote: > > Dear, > > I'm not getting Installing packages: > > > > install.packages(c("exactRankTests")) > trying URL `http://cran.r-project.org/bin/windows/contrib/2.0/PACKAGES' > Content type `text/plain' length 26129 bytes > opened URL > downloaded 25Kb > > trying URL `http://cran.r- > project.org/bin/windows/contrib/2.0/exactRankTests_0.8-10.zip' > Content type `application/zip' length 187723 bytes > opened URL > downloaded 183Kb > > package 'exactRankTests' successfully unpacked and MD5 sums checked > > Delete downloaded files (y/N)? y > > updating HTML package descriptions > > ? exactRankTests > No documentation for 'exactRankTests' in specified packages and libraries: > you could try 'help.search("exactRankTests")' > > > > How do I do? > > Thanks a lot. > > Marcus Vinicius > > [[alternative HTML version deleted]] > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] extracting df and MS values from aov
Hi, model1<-aov(dv~iv.1*iv.2*iv.3) mod.av <- anova(model1) names(mod.av) mod.av$Df mod.av$Mean On 29/06/07, Taka Matzmoto <[EMAIL PROTECTED]> wrote: > > Dear R users, > I would like to extract df and Mean Sq values. I tried several things (e.g > ., > str(model1), names(model1)) but I can't find a way to extract these > values. > I also tried to search using > RSiteSearch. Any help will be appreciated. Thanks Taka, > > model1<-aov(dv~iv.1*iv.2*iv.3) > > summary(model1) > >Df Sum Sq Mean Sq > iv.1 1 3.200 3.200 > iv.2 9 62.200 6.911 > iv.3 3 37.450 12.483 > iv.1:iv.2 9 12.050 1.339 > iv.1:iv.3 3 7.500 2.500 > iv.2:iv.327 56.300 2.085 > iv.1:iv.2:iv.3 27 25.250 0.935 > > _ > PC Magazine's 2007 editors' choice for best Web mailaward-winning Windows > Live Hotmail. > > > __ > R-help@stat.math.ethz.ch 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. > > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] R function command on a list
Perhaps, you can get the name of list element whit: unlist(lapply(list_name, rownames)) -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 28/06/07, Georg Ehret <[EMAIL PROTECTED]> wrote: > > Thank you Henrique, > "rownames" also gives me the header of the table, but not the name of the > list-element... > Any other idea? > > Wishing you a good day, Georg. > ** > Georg Ehret > Johns Hopkins University > Baltimore > > On 6/28/07, Henrique Dallazuanna <[EMAIL PROTECTED]> wrote: > > > > Try whit "rownames". > > > > -- > > Henrique Dallazuanna > > Curitiba-Paraná-Brasil > > 25° 25' 40" S 49° 16' 22" O > > > > On 28/06/07, G E <[EMAIL PROTECTED]> wrote: > > > > > Hello R: > > >I am working with a self-defined function and I wish to subject a > > > list > > > (t) to this function. My list is a list of tables: > > > $rs7609589 > > > 2/2 2/4 4/4 2/2 2/4 4/4 > > > 89 188 87 89 188 87 > > > > > > $rs3909907 > > > > > > 1/1 1/4 4/4 > > > 94 178 92 > > > > > > $rs12748004 > > > > > > 0/0 1/3 3/3 > > > 37 150 177 > > > > > > $rs6695928 > > > > > > 2/2 2/4 4/4 > > > 35 129 200 > > > > > > My function looks as follows: > > > delete_nocall_listoftables<-function(i){ > > > names<-names(i) > > > i > > > if (names[1] == "0/0"){ > > > i[-(1:1)] > > > }else{ > > > i > > > } > > > } > > > > > > > > > Within the function, how can I access the table name of a given > element > > > ( e.g. > > > $rs3909907)? Using names(i) I get the header of the table... > > > > > > Thanking you! > > > Georg. > > > > > > [[alternative HTML version deleted]] > > > > > > __ > > > R-help@stat.math.ethz.ch 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. > > > > > > > > > [[alternative HTML version deleted]] > > > __ > R-help@stat.math.ethz.ch 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. > > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] stack multiple plots on one page
https://svn.r-project.org/R/branches/R-2-5-branch/src/library/graphics/R/pairs.R -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 28/06/07, Jiong Zhang, PhD <[EMAIL PROTECTED]> wrote: > > Hi All, > > I typed "pairs" to see its code but did not get what I want. How do I > see its code? > > What I am trying to do, is to stack about 10 scatter plots on one page > as the way "pairs" does. I have about 150 variables in my table. > Instead of plotting 150X150 pairs using "pairs", I only need to plot 10 > pairs. > > Thanks. > > jiong > The email message (and any attachments) is for the sole use of the > intended recipient(s) and may contain confidential information. Any > unauthorized review, use, disclosure or distribution is prohibited. If you > are not the intended recipient, please contact the sender by reply email and > destroy all copies of the original message (and any attachments). Thank > You. > > > > [[alternative HTML version deleted]] > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] R function command on a list
Try whit "rownames". -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 28/06/07, G E <[EMAIL PROTECTED]> wrote: > > Hello R: >I am working with a self-defined function and I wish to subject a list > (t) to this function. My list is a list of tables: > $rs7609589 > 2/2 2/4 4/4 2/2 2/4 4/4 > 89 188 87 89 188 87 > > $rs3909907 > > 1/1 1/4 4/4 > 94 178 92 > > $rs12748004 > > 0/0 1/3 3/3 > 37 150 177 > > $rs6695928 > > 2/2 2/4 4/4 > 35 129 200 > > My function looks as follows: > delete_nocall_listoftables<-function(i){ > names<-names(i) > i > if (names[1] == "0/0"){ > i[-(1:1)] > }else{ > i > } > } > > > Within the function, how can I access the table name of a given element ( > e.g. > $rs3909907)? Using names(i) I get the header of the table... > > Thanking you! > Georg. > > [[alternative HTML version deleted]] > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] Timer
see ?system.time -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 27/06/07, suman Duvvuru <[EMAIL PROTECTED]> wrote: > > Hello, > > This might be a very basic question but I was not sure how to go about it. > I > just wanted to calcluate the time it takes to run my program. Basically I > was to put a timer at the start and the end of the program in order to see > how much time it takes to give the output (similar to tic-tac in MATLAB) . > Any help will be appreciated. > > Thanks, > Suman > > [[alternative HTML version deleted]] > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] fractional calculations
require(MASS) ?as.fractions as.fractions(1/2+1/8) -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O<http://maps.google.com/maps?f=q&hl=en&q=Curitiba,+Brazil&layer=&ie=UTF8&z=18&ll=-25.448315,-49.276916&spn=0.002054,0.005407&t=k&om=1> On 25/06/07, Federico Calboli <[EMAIL PROTECTED]> wrote: > > Hi All, > > is there a function in R that allows me to work with fractions without > transforming them to floats (or whatever) in between? > > Something that would calculate something like: > > (1/2 + 1/8) * 1/2 = 5/16 > > without ever transforming to 0.5 and 0.125? > > Best, > > Federico > > -- > Federico C. F. Calboli > Department of Epidemiology and Public Health > Imperial College, St Mary's Campus > Norfolk Place, London W2 1PG > > Tel +44 (0)20 7594 1602 Fax (+44) 020 7594 3193 > > f.calboli [.a.t] imperial.ac.uk > f.calboli [.a.t] gmail.com > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] Creating directory under Windows R session
I have tested in WinXP: example: > dir("C:/") [1] "Arquivos de programas" "AUTOEXEC.BAT" [3] "boot.ini" "Bootfont.bin" [5] "CONFIG.SYS""Debug" [7] "debug.log" "Desktop.ini" [9] "Dic" "Documents and Settings" "Dic" is a folder any(dir("C:/")=="Dic") [1] TRUE That are right? -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O<http://maps.google.com/maps?f=q&hl=en&q=Curitiba,+Brazil&layer=&ie=UTF8&z=18&ll=-25.448315,-49.276916&spn=0.002054,0.005407&t=k&om=1> On 20/06/07, Prof Brian Ripley <[EMAIL PROTECTED]> wrote: > > On Wed, 20 Jun 2007, Henrique Dallazuanna wrote: > > > for check the existence, > > > > any(dir('your path')=="your folder") > > That does not work, but fortunately R has file_test() for this purpose. > > -- > Brian D. Ripley, [EMAIL PROTECTED] > Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ > University of Oxford, Tel: +44 1865 272861 (self) > 1 South Parks Road, +44 1865 272866 (PA) > Oxford OX1 3TG, UKFax: +44 1865 272595 > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] Creating directory under Windows R session
for check the existence, any(dir('your path')=="your folder") -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O<http://maps.google.com/maps?f=q&hl=en&q=Curitiba,+Brazil&layer=&ie=UTF8&z=18&ll=-25.448315,-49.276916&spn=0.002054,0.005407&t=k&om=1> On 20/06/07, Milton Cezar Ribeiro <[EMAIL PROTECTED]> wrote: > > Hi all, > > How can I create (and check the existence of) a directory in a R session > under Windows(xp)? > > Kind regards, > > Miltinho > > > > > > > http://yahoo.com.br/oqueeuganhocomisso > [[alternative HTML version deleted]] > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] BIC and Hosmer-Lemeshow statistic for logistic regression
For Hosmer-Lemeshow statistic look: http://people.ufpr.br/~giolo/CE073/CodigosR/gof_bino.txt -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O<http://maps.google.com/maps?f=q&hl=en&q=Curitiba,+Brazil&layer=&ie=UTF8&z=18&ll=-25.448315,-49.276916&spn=0.002054,0.005407&t=k&om=1> On 19/06/07, spime <[EMAIL PROTECTED]> wrote: > > > > Is there any windows version of Design package??? > > > > > > > Frank E Harrell Jr wrote: > > > > spime wrote: > >> > >> I haven't find any helpful thread. How can i calculate BIC and > >> Hosmer-Lemeshow statistic for a logistic regression model. I have used > >> glm > >> for logistic fit. > > > > See the Design package's lrm function and residuals.lrm for a better GOF > > test. > > > > > > > > -- > > Frank E Harrell Jr Professor and Chair School of Medicine > > Department of Biostatistics Vanderbilt > University > > > > __ > > R-help@stat.math.ethz.ch 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. > > > > > > -- > View this message in context: > http://www.nabble.com/BIC-and-Hosmer-Lemeshow-statistic-for-logistic-regression-tf3945943.html#a11195410 > Sent from the R help mailing list archive at Nabble.com. > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] Removing Inf and Inf values from a fata frame
Hi, try with df[!is.infinite(your_column_in_d.f.),] -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O<http://maps.google.com/maps?f=q&hl=en&q=Curitiba,+Brazil&layer=&ie=UTF8&z=18&ll=-25.448315,-49.276916&spn=0.002054,0.005407&t=k&om=1> On 13/06/07, Judith Flores <[EMAIL PROTECTED]> wrote: > > Hi, > > I have a csv file with empty values, when I apply > the different functions (mean, std, etc.) I create a > new data frame, the empty values generate Inf and -Inf > values. How can I remove those Inf and -Inf values > from the new data frame? I already specified na.rm in > the mean and std functions, but the values are still > there. > > Thank you, > > Judith > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] look for packages
Look that: RSiteSearch("PCA Analysis", restrict="functions") -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O<http://maps.google.com/maps?f=q&hl=en&q=Curitiba,+Brazil&layer=&ie=UTF8&z=18&ll=-25.448315,-49.276916&spn=0.002054,0.005407&t=k&om=1> On 29/05/07, De-Jian,ZHAO <[EMAIL PROTECTED]> wrote: > > Dear list members, > > I am analysing some microarray data. I have got the differentially > expressed genes and now want to carry out PCA analysis to get the main > components that contribute to the variance.I have browsered the CRAN and > BioConductor and did not find an appropriate package. > > Have anybody ever carried out PCA analysis? Is there any package about PCA > in R? > > Thanks for your advice. > > > __ > R-help@stat.math.ethz.ch 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. > > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] Why ?rmvnorm not working
The correct is ?mvrnorm. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O<http://maps.google.com/maps?f=q&hl=en&q=Curitiba,+Brazil&layer=&ie=UTF8&z=18&ll=-25.448315,-49.276916&spn=0.002054,0.005407&t=k&om=1> On 26/05/07, Patrick Wang <[EMAIL PROTECTED]> wrote: > > Hi, > > My R version is 2.4.1 and I installed the the packages MASS and run > command library("MASS"), > > however when I type ?rmvnorm, no help topic found, it worked before. > > I tried to ype ?rinvgamma from "MCMCpack" which works great. > > Anybody have idea? I also reinstalled MASS package, but when I try to type > rmvnorm(), no functions found. > > Pat > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] like apply(x,1,sum), but using multiplication?
Try: apply(x, 2, prod) -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O<http://maps.google.com/maps?f=q&hl=en&q=Curitiba,+Brazil&layer=&ie=UTF8&z=18&ll=-25.448315,-49.276916&spn=0.002054,0.005407&t=k&om=1> On 07/05/07, Jose Quesada <[EMAIL PROTECTED]> wrote: > > Hi, > > I need to multiply all columns in a matrix so something like > apply(x,2,sum), but using multiplication should do. > I have tried apply(x,2,"*") > I know this must be trivial, but I get: > Error in FUN(newX[, i], ...) : invalid unary operator > > The help for apply states that unary operators must be quoted. I tried > single quotes too, with the same results. > > Thanks, > -Jose > > -- > Jose Quesada, PhD. > http://www.andrew.cmu.edu/~jquesada > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] listing R packages in our system
See: packs <- .packages(all=T) length(packs) -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O<http://maps.google.com/maps?f=q&hl=en&q=Curitiba,+Brazil&layer=&ie=UTF8&z=18&ll=-25.448315,-49.276916&spn=0.002054,0.005407&t=k&om=1> On 04/05/07, Hu, Ying (NIH/NCI) [E] <[EMAIL PROTECTED]> wrote: > > Hi, > > I like to know the simple way to list the R package names in our linux > system. > > Thanks > > Ying > > > [[alternative HTML version deleted]] > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] from R to html
Use the package R2HTML. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O<http://maps.google.com/maps?f=q&hl=en&q=Curitiba,+Brazil&layer=&ie=UTF8&z=18&ll=-25.448315,-49.276916&spn=0.002054,0.005407&t=k&om=1> On 4/24/07, elyakhlifi mustapha <[EMAIL PROTECTED]> wrote: > > hello, > If I wanna export data.frame from R to html have you got some ideas to do > this? > > > > > ___ > > > > > > [[alternative HTML version deleted]] > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] residuals and predict
Hi, try assign the output of glm to a object. g <- glm(model) names(g) -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O<http://maps.google.com/maps?f=q&hl=en&q=Curitiba,+Brazil&layer=&ie=UTF8&z=18&ll=-25.448315,-49.276916&spn=0.002054,0.005407&t=k&om=1> On 4/23/07, elyakhlifi mustapha <[EMAIL PROTECTED]> wrote: > > hi, > in using glm function is it possible to extract residuals and predict > values ? > > > > > ___ > > > > > > [[alternative HTML version deleted]] > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] labels
Hi, try this: plot(simul, ylab=expression(beta), xlab=expression(sigma)) -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O<http://maps.google.com/maps?f=q&hl=en&q=Curitiba,+Brazil&layer=&ie=UTF8&z=18&ll=-25.448315,-49.276916&spn=0.002054,0.005407&t=k&om=1> On 4/22/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > Hello, I would like to add to axis labels special caracters. Instead of > writing :plot(simul, xlab="beta", ylab="sigma11") It would be great if I > could write something as in LaTeX :plot(simul, xlab="\beta", > ylab="\sigma_{11}") Is there a way to do that ? Thank you > _ > > ues clics pour retrouver tout ce qui vous intéresse au même endroit. > > > [[alternative HTML version deleted]] > > > __ > R-help@stat.math.ethz.ch 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. > > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] Hiding "Warning messages" in coxme output
Try: options(warn=-1) To restore: options(warn=1) -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O<http://maps.google.com/maps?f=q&hl=en&q=Curitiba,+Brazil&layer=&ie=UTF8&z=18&ll=-25.448315,-49.276916&spn=0.002054,0.005407&t=k&om=1> On 4/20/07, Mohammad Ehsanul Karim <[EMAIL PROTECTED]> wrote: > > Dear list, > > I have been trying to use coxme in R 2.3.1. > When I use coxme in the following data sim.fr1, i get > "Warning messages: using 'as.environment(NULL)' is > deprecated" > > Why does it occur? > > How can I hide such warning message, > especially when coxme is under a loop? > > Mohammad Ehsanul Karim (Institute of Statistical > Research and Training, University of Dhaka) > > > fit.me1<-coxme(Surv(times,censored) ~ > var1+var2+var3+var4+var5+var6, data=sim.fr1, random= > ~1|id) > > Warning messages: > 1: using 'as.environment(NULL)' is deprecated > 2: using 'as.environment(NULL)' is deprecated > 3: using 'as.environment(NULL)' is deprecated > > > sim.fr1 >id var1 var2 var3 > 1 4 50.04399 239.8418 56.00348 > 2 2 40.75726 214.1387 61.95184 > 3 2 48.58170 225.4939 49.14774 > 4 1 68.02430 196.4890 55.83904 > 5 1 53.18038 219.8787 53.26361 > 6 1 60.42044 232.9754 47.49109 > 7 3 52.46432 212.7600 40.91770 > 8 1 57.45639 224.0846 51.53311 > 9 5 52.06026 183.2561 45.23863 > 10 3 65.61341 236.3037 57.44500 > 11 3 44.76174 202.1090 57.28233 > 12 4 46.84952 269.7694 53.07128 > 13 3 64.32224 174.5415 49.59961 > 14 2 56.43505 202.7242 42.82385 > 15 2 54.60324 229.3141 52.37811 > 16 3 59.79979 223.4841 47.89820 > 17 1 70.27831 201.5328 50.13637 > 18 1 60.60456 252.3765 54.89354 > 19 1 54.19388 205.0361 47.90004 > 20 3 47.20526 215.2096 45.88214 > 21 2 66.63391 262.5909 47.07526 > 22 5 35.59189 207.1023 47.88421 > 23 4 47.90704 255.9449 44.68653 > 24 1 38.67878 226.9713 44.69175 > 25 1 58.38346 194.3363 52.31043 > 26 2 55.56699 188.0691 47.2 > 27 3 60.14032 223.7305 43.05751 > 28 4 47.86896 216.3541 43.72464 > 29 4 60.68309 214.9878 46.29433 > 30 3 51.09243 225.0828 56.85092 > 31 2 53.60470 266.2956 41.77462 > 32 2 59.01639 239.9694 57.52918 > 33 4 45.69305 178.3362 56.72676 > 34 5 47.64128 217.0027 46.55197 > 35 4 67.95317 245.0579 43.73846 > 36 3 47.23630 247.1667 48.90833 > 37 5 69.60160 218.0039 47.88746 > 38 4 67.91754 225.0661 47.69852 > 39 2 57.73782 176.2204 52.55087 > 40 5 47.00849 247.6134 49.36938 > 41 4 73.32817 171.4144 54.24920 > 42 1 60.49102 261.6575 52.54041 > 43 5 61.09394 208.2990 49.63053 > 44 4 58.68786 196.3652 40.75177 > 45 2 71.02560 216.8412 47.30145 > 46 5 53.48662 229.7460 54.09643 > 47 5 48.88694 190.6449 46.87681 > 48 5 62.71642 251.0692 34.96885 > 49 3 74.22934 256.0549 56.12771 > 50 5 58.75543 247.3048 53.20891 >var4 var5 var6times > 1 141.814110 0.0088438147 > 2 134.936410 0.0088438147 > 3 148.787300 0.0088438147 > 4 141.645710 0.0088438147 > 5 129.008900 0.0088438147 > 6 148.460110 0.0085473350 > 7 136.894810 0.0080652111 > 8 151.704811 0.0074827612 > 9 141.472000 0.0065128176 > 10 139.422400 0.0060424132 > 11 151.003510 0.0052687628 > 12 148.948200 0.0052599672 > 13 129.250510 0.0045640074 > 14 148.317800 0.0044079121 > 15 136.736500 0.0043426240 > 16 140.947110 0.0043169195 > 17 161.525510 0.0036934807 > 18 144.594700 0.0035073027 > 19 132.710411 0.0030682908 > 20 142.709411 0.0029271986 > 21 145.346910 0.0028454803 > 22 136.097700 0.0027955814 > 23 147.999101 0.0023559577 > 24 137.668910 0.0022944927 > 25 143.876000 0.0021630910 > 26 138.574111 0.0021491140 > 27 136.909411 0.0020458238 > 28 144.559810 0.0019319740 > 29 140.174510 0.0018676570 > 30 138.064200 0.0015548233 > 31 144.854200 0.0014358009 > 32 144.734311 0.0013238184 > 33 141.069111 0.0012197567 > 34 135.202501 0.0011901152 > 35 148.069900 0.0011596276 > 36 144.693900 0.0010145029 > 37 149.567900 0.0008390243 > 38 139.262510 0.0007960708 > 39 140.156400 0.0007257659 > 40 148.417610 0.0007173467 > 41 140.109511 0.0006009356 > 42 147.308110 0.0005399407 > 43 142.108611 0.0005150721 > 44 148.854911 0.0004632902 > 45 143.533100 0.0003720645 >
Re: [R] plotting command trouble
Hi, the length of the coordinates are different. Try: plot(seq(0,60, l=100), seq(0,0.896, l=100), type="n", xlab="Zeit [min]", ylab="Absorptionsmessung bei 600nm",main="Zellwandstabilität" ) -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O<http://maps.google.com/maps?f=q&hl=en&q=Curitiba,+Brazil&layer=&ie=UTF8&z=18&ll=-25.448315,-49.276916&spn=0.002054,0.005407&t=k&om=1> On 4/19/07, Schmitt, Corinna <[EMAIL PROTECTED]> wrote: > > Dear R-Experts, > > I have the following command lines: > > windows() > > plot(0:60, 0:0.896, type="n", xlab="Zeit [min]", ylab="Absorptionsmessung >bei 600nm",main="Zellwandstabilität" ) > > dev.off() > > > Can anyone say me why the plot command does not work and how the correct > one should look like? > Important is: x-axis goes from 0 to 60 and the y-axis from 0 to 0.896! > > Thanks, Corinna > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] package for Matlab
Hi Corinna! I don't if this is , but look that: http://cran-r.c3sl.ufpr.br/src/contrib/Descriptions/matlab.html http://cran-r.c3sl.ufpr.br/src/contrib/Descriptions/R.matlab.html -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O<http://maps.google.com/maps?f=q&hl=en&q=Curitiba,+Brazil&layer=&ie=UTF8&z=18&ll=-25.448315,-49.276916&spn=0.002054,0.005407&t=k&om=1> On 05/04/07, Schmitt, Corinna <[EMAIL PROTECTED]> wrote: > > > > Hallo, > > here again my modified information: > > does a package for Matlab exist in R? I'm using Windows. I know that > there exist one for UNIX. Does one exist for Windows? If yes, where can > I find it and how can I install it under R? > > Thanks, Corinna > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] Replacement in an expression - can't use parse()
Hi, perhaps you can use: ?chartr -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O<http://maps.google.com/maps?f=q&hl=en&q=Curitiba,+Brazil&layer=&ie=UTF8&z=18&ll=-25.448315,-49.276916&spn=0.002054,0.005407&t=k&om=1> On 27/03/07, Daniel Berg <[EMAIL PROTECTED]> wrote: > > Dear all, > > Suppose I have a very long expression e. Lets assume, for simplicity, that > it is > > e = expression(u1+u2+u3) > > Now I wish to replace u2 with x and u3 with 1. I.e. the 'new' > expression, after replacement, should be: > > > e > expression(u1+x+1) > > My question is how to do the replacement? > > I have tried using: > > > e = parse(text=gsub("u2","x",e)) > > e = parse(text=gsub("u3",1,e)) > > Even though this works fine in this simple example, the use of parse > when e is very long will fail since parse has a maximum line length > and will cut my expressions. I need to keep mode(e)=expression since I > will use e further in symbolic derivation and division. > > Any suggestions are most welcome. > > Thank you. > > Regards, > Daniel Berg > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] substitute variable
If you data frame is called 'df' df$PRODUCTS[df$PRODUCTS > 70] <- NA -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O<http://maps.google.com/maps?f=q&hl=en&q=Curitiba,+Brazil&layer=&ie=UTF8&z=18&ll=-25.448315,-49.276916&spn=0.002054,0.005407&t=k&om=1> On 26/03/07, Sergio Della Franca <[EMAIL PROTECTED]> wrote: > > Dear R-Helpers, > > I want to substitute the contents of a variable under some contitions. > > I.e., I have this data set: > > YEAR PRODUCTS > 1 80 > 2 90 > 3 50 > 4 60 > 5 30 > > I want to perform this condition: > if products> 70 then products=NA else products=products. > > I'd like to achive the seguent result: > > YEAR PRODUCTS > 1 NA > 2 NA > 3 50 > 4 60 > 5 30 > How can i develop this? > > > Thank you in advance. > > > Sergio Della Franca > > [[alternative HTML version deleted]] > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] a very small query
Try: search() -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O<http://maps.google.com/maps?f=q&hl=en&q=Curitiba,+Brazil&layer=&ie=UTF8&z=18&ll=-25.448315,-49.276916&spn=0.002054,0.005407&t=k&om=1> On 26/03/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > Hi All > > what is the command to give me the listing of the loaded packages. I mean > which are active and not the listing of all the installed packages as > given by library() > > thanks in advance > -gaurav > > > > > DISCLAIMER AND CONFIDENTIALITY CAUTION:\ \ This message and ...{{dropped}} > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] Creating new directory/folder from R script on run time.
Perhaps you can try: ?dir.create dir.create('C:\tt') -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O<http://maps.google.com/maps?f=q&hl=en&q=Curitiba,+Brazil&layer=&ie=UTF8&z=18&ll=-25.448315,-49.276916&spn=0.002054,0.005407&t=k&om=1> On 23/03/07, d. sarthi maheshwari <[EMAIL PROTECTED]> wrote: > > Hi, > > Please correct me if this request does not belong to this discussion > forum. > > Kindly suggest me if there is a way to create a new folder from R on > runtime? > > for e.g. > >From one of my R script I want to store the PDF result file in a > perticular > folder let say c:\tt > > for that initially i am creating "tt" folder manually and using the > following command: > > fname <- paste("C:/tt/result", strptime(Sys.time(),"%Y-%m-%d"), > ".pdf", sep="") > pdf(file = fname,width = 13, height = 6) > --- > --- > blah > blah > --- > --- > dev.off() > > Can I, in any manner, create the "tt" folder from R script itself on > runtime? > > -- > Thanks and Regards > Sarthi M. > > [[alternative HTML version deleted]] > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] Installing R on Ubuntu 6.10 via apt-get
Hi Antonio Look this http://help.nceas.ucsb.edu/index.php/Installing_R_on_Ubuntu -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O<http://maps.google.com/maps?f=q&hl=en&q=Curitiba,+Brazil&layer=&ie=UTF8&z=18&ll=-25.448315,-49.276916&spn=0.002054,0.005407&t=k&om=1> On 09/03/07, Antonio Olinto <[EMAIL PROTECTED]> wrote: > > Hi > > I'm using Linux Ubuntu 6.10 on a Pentium D 2.8. > > Well, following http://cran.r-project.org/bin/linux/ubuntu/README > > I wrote in the sources.list > > # R > deb http://CRAN.R-project.org/bin/linux/ubuntu edgy/ > deb http://www.vps.fmvz.usp.br/CRAN/bin/linux/ubuntu edgy/ > > But after type "apt-get update" I got > > Falha ao baixar > http://www.vps.fmvz.usp.br/CRAN/bin/linux/ubuntu/edgy/Release Unable to > find expected entry Packages in Meta-index file (malformed Release file?) > Falha ao baixar http://CRAN.R-project.org/bin/linux/ubuntu/edgy/Release > Unable to find expected entry Packages in Meta-index file (malformed > Release file?) > W: Conflicting distribution: http://www.vps.fmvz.usp.br edgy/ Release > (expected edgy but got ) > W: Conflicting distribution: http://CRAN.R-project.org edgy/ Release > (expected edgy but got ) > > (PS. Falha ao baixar = Fail to download) > > The key of Vincent Goulet seems to be OK. > > Am I doing something wrong or there's really a problem with the Release > file? > > Many thanks! > > Antonio Olinto > > __ > R-help@stat.math.ethz.ch 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. > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] How to plot two graphs on one single plot?
Hum, ok, i don't was understanding, you can try: plot(x1, y1, type='p', xlim=range(x1,x2), ylim=range(y1, y2), xlab='x', ylab='y') lines(x2, d2, type='p', col='red') Or perhaps ?curve On 23/02/07, Yun Zhang <[EMAIL PROTECTED]> wrote: > > Thanks. Now R plots two graphs on one plot. > Yet they are still on two graphs, vertically parallelized with each other. > > But what I want to do is actually plotting two distribution on one > single graph, using the same x and y axis. Like: > | > | > | (dist2) > | (dist 1) > | > ---> > > Is it possible to do that? > > Thanks, > Yun > > Henrique Dallazuanna wrote: > > par(mfrow=c(2,1)) > > #your plot > > #after plot > > par(mfrow=c(1,1)) > > > > On 23/02/07, *Yun Zhang* <[EMAIL PROTECTED] > > <mailto:[EMAIL PROTECTED]>> wrote: > > > > Hi, > > > > I am trying to plot two distribution graph on one plot. But I dont > > know > > how. I set them to the same x, y limit, even same x, y labels. > > > > Code: > > x1=rnorm(25, mean=0, sd=1) > > y1=dnorm(x1, mean=0, sd=1) > > > > x2=rnorm(25, mean=0, sd=1) > > y2=dnorm(x2, mean=0, sd=1) > > plot(x1, y1, type='p', xlim=range(x1,x2), ylim=range(y1, y2), > > xlab='x', > > ylab='y') > > plot(x2, y2, type='p', col="red", xlab='x', ylab='y') > > > > They just dont show up in one plot. > > > > Any hint will be very helpful. > > > > Thanks, > > Yun > > > > __ > > R-help@stat.math.ethz.ch <mailto:R-help@stat.math.ethz.ch> mailing > > list > > https://stat.ethz.ch/mailman/listinfo/r-help > > <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. > > > > > > > > > > -- > > Henrique Dallazuanna > > Curitiba-Paraná > > Brasil > -- Henrique Dallazuanna Curitiba-Paraná Brasil [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] How to plot two graphs on one single plot?
par(mfrow=c(2,1)) #your plot #after plot par(mfrow=c(1,1)) On 23/02/07, Yun Zhang <[EMAIL PROTECTED]> wrote: > > Hi, > > I am trying to plot two distribution graph on one plot. But I dont know > how. I set them to the same x, y limit, even same x, y labels. > > Code: > x1=rnorm(25, mean=0, sd=1) > y1=dnorm(x1, mean=0, sd=1) > > x2=rnorm(25, mean=0, sd=1) > y2=dnorm(x2, mean=0, sd=1) > plot(x1, y1, type='p', xlim=range(x1,x2), ylim=range(y1, y2), xlab='x', > ylab='y') > plot(x2, y2, type='p', col="red", xlab='x', ylab='y') > > They just dont show up in one plot. > > Any hint will be very helpful. > > Thanks, > Yun > > __ > R-help@stat.math.ethz.ch 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. > -- Henrique Dallazuanna Curitiba-Paraná Brasil [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] TRUE/FALSE as numeric values
You can also: test <- RSF_EU[which(RSF_EU$AREA<=x),] On 23/02/07, Thomas Preuth <[EMAIL PROTECTED]> wrote: > > Hello, > > I want to select in a column of a dataframe all numbers smaller than a > value x > but when I type in test<-(RSF_EU$AREA<=x) I receiv as answer: > > test > [1] TRUE FALSE FALSE TRUE TRUE TRUE FALSE FALSE TRUE TRUE TRUE > FALSE TRUE TRUE TRUE TRUE TRUE > [18] TRUE TRUE TRUE TRUE FALSE FALSE TRUE TRUE TRUE TRUE TRUE > TRUE TRUE FALSE TRUE TRUE TRUE > [35] FALSE TRUE TRUE TRUE TRUE FALSE FALSE FALSE TRUE TRUE FALSE > TRUE TRUE FALSE FALSE TRUE FALSE > [52] TRUE TRUE TRUE TRUE TRUE FALSE TRUE TRUE FALSE TRUE > > How can i get the values smaller than x and not the TRUE/FALSE reply? > > Thanks in advance, > Thomas > > __ > R-help@stat.math.ethz.ch 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. > -- Henrique Dallazuanna Curitiba-Paraná Brasil [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] file path
I think: getwd() is you want. On 21/02/07, Rita Sousa <[EMAIL PROTECTED]> wrote: > > Hello, > > > > It is possible to return the path of the current working R-file (in > execution)? > > > > Thanks, > > Rita Sousa. > > > [[alternative HTML version deleted]] > > __ > R-help@stat.math.ethz.ch 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. > -- Henrique Dallazuanna Curitiba-Paraná Brasil [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] sapply again return value
Hi, A simple way is: s <- s[3] On 16/02/07, Antje <[EMAIL PROTECTED]> wrote: > > Hello, > > I used an sapply to get some data back (s <- sapply(...) ). The output > of s would then deliver something like this: > > B06_lamp.csv C06_lamp.csv D06_lamp.csv > [1,] NULL NULL Numeric,512 > [2,] NULL NULL Numeric,512 > [3,] NULL NULL 2 > > mode(s) > [1] "list" > > dim(s) > [1] 3 3 > > > > Now, I'd like to remove the columns which contain NULL (it's alway the > whole column). > How can I do this??? > > Antje > > __ > R-help@stat.math.ethz.ch 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. > -- Henrique Dallazuanna Curitiba-Paraná Brasil [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] Is this a correct forum to discuss basic R problem?
Yes, df is your data.frame. tapply(df$y, df$x, sum) On 14/02/07, d. sarthi maheshwari <[EMAIL PROTECTED]> wrote: > > Hi > > Sorry if this is a wrong post in the forum. Please suggest if this is a > correct forum to discuss R related basic problem. > > I wanted to perform the following task by using R: > > e.g. > input data.frame > x y > > a10 > b20 > a10 > a10 > b15 > b15 > b20 > > In o/p i need > > xy > = > a 30 > b 70 > > Currently i am storing the data.frame as a database table by using > sqlSave. > Then I am retrieving the data using sqlQuery command. In the query I am > using Group by function of SQL. > > is there any smarter way to this in R? > > > -- > thanks > Sar > > [[alternative HTML version deleted]] > > __ > R-help@stat.math.ethz.ch 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. > -- Henrique Dallazuanna Curitiba-Paraná Brasil [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] Replace individual values in a data frame with NA
data[3,2]<-NA On 09/02/07, Jason Horn <[EMAIL PROTECTED]> wrote: > > I'd like to replace a value in a data frame with an NA, but can't > figure out how. > > For example, say you have > > a<-c(1,2,3,4) > b<-c(5,6,7,8) > data<-data.frame(a,b) > > Now, how would you set the third row of the second column ( data > [[3,2]] ) to NA? > > I have tried all types of permutations with is.na, including is.na<- > data[[3,2]], which does not work. > > Thanks > > __ > R-help@stat.math.ethz.ch 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. > -- Henrique Dallazuanna Curitiba-Paraná Brasil [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] remove component from list or data frame
First: lst <- lst[-3] Second: frame<- frame[-2,] On 08/02/07, Jason Horn <[EMAIL PROTECTED]> wrote: > > Sorry to ask such a simple question, but I can't find the answer after > extensive searching the docs and the web. > > How do you remove a component from a list? For example say you have: > > lst<-c(5,6,7,8,9) > > How do you remove, for example, the third component in the list? > > lst[[3]]]<-NULL generates an error: "Error: more elements supplied > than there are to replace" > > > > Also, how do you remove a row from a data frame? For example, say you > have: > > lst1<-c(1,2,3,4,5) > lst2<-c(6,7,8,9,10) > frame<-data.frame(lst1,lst2) > > How do you remove, for example, the second row of frame? > > Thanks, > > - Jason > > __ > R-help@stat.math.ethz.ch 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. > -- Henrique Dallazuanna Curitiba-Paraná Brasil [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] Extracting part of date variable
format.Date(c, "%d") format.Date(c, "%m") format.Date(c, "%y") format.Date(c, "%Y") On 01/02/07, stat stat <[EMAIL PROTECTED]> wrote: > > Dear all, > > Suppose I have a date variable: > > c = "99/05/12" > > I want to extract the parts of this date like month number, year and > day. I can do it in SPSS. Is it possible to do this in R as well? > > Rgd, > > > - > Here's a new way to find what you're looking for - Yahoo! Answers > [[alternative HTML version deleted]] > > > > __ > R-help@stat.math.ethz.ch 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. > > > -- Henrique Dallazuanna [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] how to explore contents of R data file from command line?
You can try copy the file into another location and in the R: load(file.choose()) ls() choose the file .RData On 29/01/07, Vladimir Eremeev <[EMAIL PROTECTED]> wrote: > > > Dear all, > > I have a directory with my research project, containing files > .RData > and > inflow.RData > > I am just curious, is there any way to explore contents of inflow.RDatafrom > command line without affecting .RData and without copying inflow.RData to > another location? > I can see names and character attributes (of something in the file) in a > 3rd > party raw file viewer. > > -- > View this message in context: > http://www.nabble.com/how-to-explore-contents-of-R-data-file-from-command-line--tf3135483.html#a8688071 > Sent from the R help mailing list archive at Nabble.com. > > __ > R-help@stat.math.ethz.ch 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. > -- Henrique Dallazuanna [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] r tidy
See: https://sourceforge.net/projects/tinn-r Perhaps help you On 25/01/07, George Georgalis <[EMAIL PROTECTED]> wrote: > > Is there an r-tidy program? something that works similar to perl > tidy? http://perltidy.sourceforge.net/ which takes program code > and reformats white space with standard indentations and spacing? > I did find a ruby based rtidy, but that is for html formatting. > > // George > > > -- > George Georgalis, systems architect, administrator < > > __ > R-help@stat.math.ethz.ch 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. > -- Henrique Dallazuanna [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] filling the area
Hi Maurício! Look at this link also: http://www.feferraz.net/br/shaded.html On 25/01/07, Mauricio Cardeal <[EMAIL PROTECTED]> wrote: > > Please, how to fill the area under the curve? > > x <- c(1:10) > y <- c(rnorm(10)) > plot(x,y) > lines(x,y) > > Thanks, > Mauricio Cardeal > > __ > R-help@stat.math.ethz.ch 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. > -- Henrique Dallazuanna [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] Capturing output from external executables, in windows
You can try: system("command", show.output.on.console=TRUE) On 24/01/07, Darren Obbard <[EMAIL PROTECTED]> wrote: > > Hi, > > Any help on the following would be much appreciated > > I wish to capture the output (currently going to console) from an > external executable. > > The executable is successfully run using > > system("program -switch ") > > and the output printed to the DOS console. > > How do I capture this output? I have tried redirecting the output to a > text file, and then reading this in > > system("program -switch > textfile.txt") > data<-scan("textfile.txt") > > But this does not seem to work (the textfile.txt is not written). It > does however work if I invoke the console to be permanent > > system("cmd /K program -switch > textfile.txt") > data<-scan("textfile.txt") > > Unfortunately, this leaves me with an open console window I have to > close manually. > > Is there a way of doing this (under windows) using system( ) or some > other command? It appears that pipe( ) may do it, but I cannot > understand the documentation. > > An example of the appropriate syntax would be an enormous help. > > Thanks in advance, > > Darren > > [EMAIL PROTECTED] > > -- > > Darren Obbard > Institute of Evolutionary Biology > Ashworth Labs > Kings Buildings > University of Edinburgh, UK > > __ > R-help@stat.math.ethz.ch 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. > -- Henrique Dallazuanna [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] system(mysql... Does not recognize < as passing an attribute (No HTML)
You can try this: system(paste('mysql -u hsdlife -p -D life <', file('c:/teste.txt')), show.output.on.console = TRUE) On 16/01/07, Lapointe, Pierre <[EMAIL PROTECTED]> wrote: > > Hi, > > This is my command line request: mysql -u root -ppassword -D quant > This line works from the command line in windows. > > In R, when I try to use the system function, it does not work, > > > system(paste('mysql -u root -ppassword -D quant > ERROR 1102 (42000): Incorrect database name ' > It seems that the "<" character is not recognized as an attribute. > > Thanks, > > Pierre > > > version >_ > platform i386-pc-mingw32 > arch i386 > os mingw32 > system i386, mingw32 > status > major 2 > minor 4.1 > year 2006 > month 12 > day18 > svn rev40228 > language R > version.string R version 2.4.1 (2006-12-18) > > ** > AVIS DE NON-RESPONSABILITE: Ce document transmis par courrie...{{dropped}} > > __ > R-help@stat.math.ethz.ch 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. > -- Henrique Dallazuanna [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] Export dataframe to txt
?write.table On 08/01/07, Benjamin Dickgiesser <[EMAIL PROTECTED]> wrote: > > Hi all, > > Is there a function to export a dataframe to a text file? > I want to store a large set of data which I have saved in a dataframe > in my workspace and copy and past doesn't cut it. > > Thank you, > Benjamin > > __ > R-help@stat.math.ethz.ch 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. > -- Henrique Dallazuanna [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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.