Re: [R] aggregate

2016-08-23 Thread Jim Lemon
Hi Gang Chen, If I have the right idea: for(zval in levels(myData$Z)) crossprod(as.matrix(myData[myData$Z==zval,c("X","Y")])) Jim On Wed, Aug 24, 2016 at 8:03 AM, Gang Chen wrote: > This is a simple question: With a dataframe like the following > > myData <-

Re: [R] aggregate

2016-08-23 Thread David Winsemius
> On Aug 23, 2016, at 3:03 PM, Gang Chen wrote: > > This is a simple question: With a dataframe like the following > > myData <- data.frame(X=c(1, 2, 3, 4), Y=c(4, 3, 2, 1), Z=c('A', 'A', 'B', > 'B')) > > how can I get the cross product between X and Y for each level of

Re: [R] transposing x and y axes in xYplot

2016-08-23 Thread Cade, Brian
Bert: Yes, with some fiddling of axes labels this looks like just what I needed. Thank you. Brian Brian S. Cade, PhD U. S. Geological Survey Fort Collins Science Center 2150 Centre Ave., Bldg. C Fort Collins, CO 80526-8818 email: ca...@usgs.gov tel: 970 226-9326 On

[R] aggregate

2016-08-23 Thread Gang Chen
This is a simple question: With a dataframe like the following myData <- data.frame(X=c(1, 2, 3, 4), Y=c(4, 3, 2, 1), Z=c('A', 'A', 'B', 'B')) how can I get the cross product between X and Y for each level of factor Z? My difficulty is that I don't know how to deal with the fact that crossprod()

Re: [R] transposing x and y axes in xYplot

2016-08-23 Thread Bert Gunter
Is this of any help? (found by simple google search): http://stackoverflow.com/questions/6392266/rotating-the-grid-to-plot-horizontal-errors-bars-with-hmiscxyplot-in-r Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into

[R] transposing x and y axes in xYplot

2016-08-23 Thread Cade, Brian
Is there a simple way to transpose the x and y axes with the xYplot() function in the Hmisc package, where y is a vector of point estimate and lower and upper confidence interval endpoints? What I'm looking for is something akin to coord_flip() used with ggplot(). Brian Brian S. Cade, PhD U.

Re: [R] Loop over folder files

2016-08-23 Thread ruipbarradas
Or maybe a print() statement on the table() in the loop. print(table(...)) Rui Barradas   Citando David Winsemius : >> On Aug 23, 2016, at 10:01 AM, Juan Ceccarelli Arias >> wrote: >> >> Im running this but the code doesn't seem work. >> It just

Re: [R] Loop over folder files

2016-08-23 Thread MacQueen, Don
Compare what happens with these two command: for (i in 1:3) { table(letters[1:4]) } for (i in 1:3) { print(table(letters[1:4])) } Then try modifying your loop similarly. -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On

Re: [R] Loop over folder files

2016-08-23 Thread ruipbarradas
Hello, Where does read_dta come from? You should also post the library() instruction. Try to run the code without the loop, with just one file and inspect xxx to see what's happening. xxx <- read_dta(fuente[1]) str(xxx) table(xxx$cise, xxx$sexo) Rui Barradas   Citando Juan Ceccarelli Arias

Re: [R] Loop over folder files

2016-08-23 Thread David Winsemius
> On Aug 23, 2016, at 10:01 AM, Juan Ceccarelli Arias wrote: > > Im running this but the code doesn't seem work. > It just hangs out but doesn't show any error. > > > for (i in 1:length(fuente)){ > > xxx=read_dta(fuente[i]) > > table(xxx$cise, xxx$sexo) > > rm(xxx) > >

Re: [R] Loop over folder files

2016-08-23 Thread Juan Ceccarelli Arias
Im running this but the code doesn't seem work. It just hangs out but doesn't show any error. for (i in 1:length(fuente)){ xxx=read_dta(fuente[i]) table(xxx$cise, xxx$sexo) rm(xxx) } On Tue, Aug 23, 2016 at 6:31 AM, wrote: > Hello, > > The op could also use package

Re: [R] Replicate

2016-08-23 Thread Sarah Goslee
I'm not sure why you'd want to, but here's one way to do it: plotdat2[rep(1:nrow(plotdat), each=100), ] This puts all the replicates of each row together. plotdat2[rep(1:nrow(plotdat), times=100), ] while this repeats each row then starts over. If that answer doesn't make sense, then you

Re: [R] Replicate

2016-08-23 Thread Bert Gunter
?rep (to replicate indices) plotdat2[rep(1:3,e=100), ] This seemspretty basic. Have you gone through any R tutorials yet? If not, please do so before posting further. There are many good ones on the web. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming

[R] Replicate

2016-08-23 Thread André Luis Neves
Hi, There! I have this data frame: > plotdat2 FirmicutesLowerUpper fTissue2 1 63.48023 59.15983 68.11614 CAECUM 2 61.42512 57.24651 65.90875COLON 3 44.68343 41.62523 47.96632RUMEN How can I replicate each line 100 times? I`m new in R command line, so sorry if my

Re: [R] Estimated Effects Not Balanced

2016-08-23 Thread Justin Thong
Hi, Thanks Richard, That was me playing with too many examples and having too many variables just lying around. Thanks for the tip though. On 22 August 2016 at 23:32, Bert Gunter wrote: > Thanks, Rich. I didn't notice that! > > -- Bert > Bert Gunter > > "The trouble

Re: [R] Error while fitting gumbel copula

2016-08-23 Thread Isaudin Ismail
Dear Martin, Thank you for the solutions. I've tried as per your codes and my problem solved :) Thanks a lot! Best regards, Isaudin On Tue, Aug 23, 2016 at 9:06 AM, Martin Maechler wrote: > > Isaudin Ismail > > on Thu, 18 Aug

Re: [R] Loop over folder files

2016-08-23 Thread ruipbarradas
Hello, The op could also use package sos to find that and other packages to read stata files. install.packages("sos") library(sos) findFn("stata") found 374 matches;  retrieving 19 pages 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 Downloaded 258 links in 121 packages The first package is

Re: [R] Loop over folder files

2016-08-23 Thread Michael Dewey
Dear Juan If this is a Stata 13 file the package readstata13 available from CRAN may be of assistance. On 22/08/2016 18:40, Juan Ceccarelli Arias wrote: I removed the data,frame=True... I obtain this warnings... Error in read.dta(fuente[i]) : not a Stata version 5-12 .dta file In addition:

Re: [R] Error while fitting gumbel copula

2016-08-23 Thread Martin Maechler
> Isaudin Ismail > on Thu, 18 Aug 2016 17:03:50 +0100 writes: > Dear Martin, Following my earlier question on "error while > fitting gumbel copula", I have also crated a new gist at > https://gist.github.com/anonymous/0bb8aba7adee550d40b840a47d8b7e25

Re: [R] [Friedmann test for 2 factor mixed design] I need your help.I trying to do non-parametric 2way anova

2016-08-23 Thread David Winsemius
> On Aug 22, 2016, at 11:33 PM, 이아름 wrote: > > > Hi! > > I'm trying to do the non-parametric test for 2 factor mixed anova. > > I got 2 factors, one is within-subject factor, AGE(2levels), and the other is > between-subject factor, Speed(6levels). > One dependent

[R] [Friedmann test for 2 factor mixed design] I need your help.I trying to do non-parametric 2way anova

2016-08-23 Thread 이아름
Hi! I'm trying to do the non-parametric test for 2 factor mixed anova. I got 2 factors, one is within-subject factor, AGE(2levels), and the other is between-subject factor, Speed(6levels). One dependent variables, RT. The data, I got, is not satisfied with the normality and homogeneity

Re: [R] Please help me, I'm trying to update my version of R

2016-08-23 Thread KMNanus
Thanks for getting back to me. Worked like a charm. Ken kmna...@gmail.com 914-450-0816 (tel) 347-730-4813 (fax) > On Aug 22, 2016, at 11:45 PM, Thomas Mailund wrote: > > Hi Ken, > > You are trying to install R as a package. That won't work. The .pkg file you >

Re: [R] Please help me, I'm trying to update my version of R

2016-08-23 Thread Berend Hasselman
Follow up on my previous mail. See the FAQ for OS X :https://cran.r-project.org/bin/macosx/RMacOSX-FAQ.html Read the section "3.2 Installation of packages". It tells it all. (reachable from the contents entry "How to install packages"). Berend > On 23 Aug 2016, at 08:27, Berend Hasselman

Re: [R] Please help me, I'm trying to update my version of R

2016-08-23 Thread Berend Hasselman
> On 22 Aug 2016, at 22:17, KMNanus wrote: > > I’m a newbie running 3.2.4 on a mac equipped with Yosemite (10.10.5). > > I want to update to 3.3.1 and have downloaded the package, but have not been > able to install it. I’ve tried install.packages("R-3.3.1.tar.gz”) and >