Re: [R] R Data

2019-02-14 Thread Fowler, Mark
gt;> On Behalf Of Spencer Brackett Sent: February 14, 2019 12:32 AM To: R-help mailto:r-help@r-project.org>>; Sarah Goslee mailto:sarah.gos...@gmail.com>>; Caitlin Gibbons mailto:bioprogram...@gmail.com>>; Jeff Newmiller mailto:jdnew...@dcn.davis.ca.us>> Subject: [R] R

Re: [R] R Data

2019-02-14 Thread Spencer Brackett
] 2 7 2NA > [3,] 3 8 3NA > [4,] 4 9 4NA > [5,] 5 10 5NA > > -Original Message- > From: R-help On Behalf Of Spencer Brackett > Sent: February 14, 2019 12:32 AM > To: R-help ; Sarah Goslee ; > Caitlin Gibbons ; Jeff Newmiller < > jdnew...@dcn.da

Re: [R] R Data

2019-02-14 Thread Fowler, Mark
NA [4,] 4 9 4NA [5,] 5 10 5NA -Original Message- From: R-help On Behalf Of Spencer Brackett Sent: February 14, 2019 12:32 AM To: R-help ; Sarah Goslee ; Caitlin Gibbons ; Jeff Newmiller Subject: [R] R Data Hello everyone, The following is a portion of coding that a coll

[R] R Data

2019-02-13 Thread Spencer Brackett
Hello everyone, The following is a portion of coding that a colleague sent. Given my lack of experience in R, I am not quite sure what the significance of the following arguments. Could anyone help me translate? For context, I am aware of the downloading portion of the script... library(data.table

Re: [R] r-data partitioning considering two variables (character and numeric)

2018-08-27 Thread Ahmed Attia
Thanks Bert, worked nicely. Yes, genotypes with only one ID will be eliminated before partitioning the data. Best regards Ahmed Attia On Mon, Aug 27, 2018 at 8:09 PM, Bert Gunter wrote: > Just partition the unique stand_ID's and select on them using %in% , say: > > id <- unique(dataGenoty

Re: [R] r-data partitioning considering two variables (character and numeric)

2018-08-27 Thread Bert Gunter
Sorry, my bad -- careless reading: you need to do the partitioning within genotype. Something like: by(dataGenotype, dataGenotype$Genotype, function(x){ u <- unique(x$standID) tst <- x$x2 %in% sample(u, floor(length(u)/2)) list(test = x[tst,], train = x[!tst,] }) This will give a

Re: [R] r-data partitioning considering two variables (character and numeric)

2018-08-27 Thread MacQueen, Don via R-help
And yes, I ignored Genotype, but for the example data none of the stand_ID values are present in more than one Genotype, so it doesn't matter. If that's not true in general, then constructing the grp variable is a little more complex, but the principle is the same. -- Don MacQueen Lawrence Live

Re: [R] r-data partitioning considering two variables (character and numeric)

2018-08-27 Thread MacQueen, Don via R-help
You could start with split() grp <- rep('', nrow(mydata) ) grp[mydata$stand_ID %in% c(7,9,67)] <- 'A-training' grp[mydata$stand_ID %in% c(3,18,20,21,32)] <- 'B-testing' split(mydata, grp) or perhaps grp <- ifelse( mydata$stand_ID %in% c(7,9,67) , 'A-training', 'B-testing' ) split(mydata, grp)

Re: [R] r-data partitioning considering two variables (character and numeric)

2018-08-27 Thread Bert Gunter
Just partition the unique stand_ID's and select on them using %in% , say: id <- unique(dataGenotype$stand_ID) tst <- sample(id, floor(length(id)/2)) wh <- dataGenotype$stand_ID %in% tst ## logical vector test<- dataGenotype[wh,] train <- dataGenotype[!wh,] There are a million variations on this t

[R] r-data partitioning considering two variables (character and numeric)

2018-08-27 Thread Ahmed Attia
I would like to partition the following dataset (dataGenotype) based on two variables; Genotype and stand_ID, for example, for Genotype H13: stand_ID number 7 may go to training and stand_ID number 18 and 21 may go to testing. Genotypestand_IDInventory_date stemC mheight H13

Re: [R] r data structures

2012-08-17 Thread Patrick Burns
To slightly correct what's been said: In general lists are linear objects, but a list can have dimension. An example is in Circle 8.1.8 of 'The R Inferno'. http://www.burns-stat.com/pages/Tutor/R_inferno.pdf Pat On 16/08/2012 21:50, Schumacher, Jay S wrote: are these correct/accurate/sensib

Re: [R] r data structures

2012-08-16 Thread R. Michael Weylandt
On Thu, Aug 16, 2012 at 5:44 PM, MacQueen, Don wrote: > Whereas for a matrix or data frame, one must supply *two* index values > (even if one of them may be omitted) > mydf[ 1 , 3 ] > mydf[ , 5 ] > > mymat[ 2:5 , ] > mymat[ 3 , 4:6 ] > are valid statements. > Not quite: x <- matr

Re: [R] r data structures

2012-08-16 Thread MacQueen, Don
I don't disagree with Michael, but I would add that to me it also depends. If one thinks in terms of subsetting an object (for objects that can be subsetted) To subset a vector, one supplies *one* value for the index: myvector[3] myvector[ 2:5 ] are valid statements. Similarly for a list m

Re: [R] r data structures

2012-08-16 Thread David Winsemius
On Aug 16, 2012, at 1:50 PM, Schumacher, Jay S wrote: are these correct/accurate/sensible statements: a vector is a one dimensional object. a matrix is a two dimensional object. a list is a one dimensional object. i'm working from this web page: http://www.agr.kuleuven.ac.be/vakken/s

Re: [R] r data structures

2012-08-16 Thread Schumacher, Jay S
yes, thank you, conceptual model (rather than formal dimension attribute) is where i'm coming from at this point. It would be helpful to distinguish between a formal dimension attribute, and a (personal) conceptual model of whether or not any particu

Re: [R] r data structures

2012-08-16 Thread R. Michael Weylandt
On Thu, Aug 16, 2012 at 4:50 PM, Schumacher, Jay S wrote: > > are these correct/accurate/sensible statements: > > a vector is a one dimensional object. > a matrix is a two dimensional object. > > a list is a one dimensional object. > > i'm working from this web page: > http://www.agr.kul

Re: [R] r data structures

2012-08-16 Thread Schumacher, Jay S
are these correct/accurate/sensible statements: a vector is a one dimensional object. a matrix is a two dimensional object. a list is a one dimensional object. i'm working from this web page: http://www.agr.kuleuven.ac.be/vakken/statisticsbyR/someDataStructures.htm

Re: [R] r data structures

2012-08-16 Thread MacQueen, Don
It would be helpful to distinguish between a formal dimension attribute, and a (personal) conceptual model of whether or not any particular R object, or type of object, has dimension. Mention of data frames having dimension can be found in the help page for the dim() function. > foo <- 1:10 > is.

Re: [R] r data structures

2012-08-16 Thread David Winsemius
On Aug 16, 2012, at 11:49 AM, Schumacher, Jay S wrote: hi, i'm trying to understand r data structures. i see that vectors, matrix, factors and arrays have a "dimension." there seems to be no mention of dimensionality anywhere for lists or dataframes. can i consider lists and frames to

Re: [R] r data structures

2012-08-16 Thread Steve Lianoglou
Hi, On Thu, Aug 16, 2012 at 2:49 PM, Schumacher, Jay S wrote: > > > hi, > i'm trying to understand r data structures. i see that vectors, matrix, > factors and arrays have a "dimension." Out of curiosity, where do you "see" that vectors and factors have a dimension? I mean -- I guess they're

[R] r data structures

2012-08-16 Thread Schumacher, Jay S
hi, i'm trying to understand r data structures. i see that vectors, matrix, factors and arrays have a "dimension." there seems to be no mention of dimensionality anywhere for lists or dataframes. can i consider lists and frames to be of fixed dimension 2? thanks, jay s _

Re: [R] R Data Frame to C# DataGridView - R.NET

2011-10-22 Thread swonder03
I should note that the form is compiling in C# but upon clicking the button nothing happens to the dataGridView. -- View this message in context: http://r.789695.n4.nabble.com/R-Data-Frame-to-C-DataGridView-R-NET-tp3929413p3929415.html Sent from the R help mailing list archive at Nabble.com. ___

[R] R Data Frame to C# DataGridView - R.NET

2011-10-22 Thread swonder03
This is more of a C# question, but it has to do with the conversion of a data frame using R.NET into an appropriate format to display on a C# DataGridView. My code is as follows (focusing on the button_Click) /private void button_displayDF_Click(object sender, EventArgs e) {

Re: [R] R Data Manipulation - Transposing Data by a Given Column, Like User_ID

2011-02-03 Thread Gabor Grothendieck
On Thu, Feb 3, 2011 at 10:05 PM, Peter Ehlers wrote: > On 2011-02-03 14:09, Dennis Murphy wrote: >> >> Hi: >> >> This also works, except that the result is of class 'table': >> >> xtabs(COUNTS ~ USER_ID + SITE, data = RAW) >>        SITE >> USER_ID SITE1 SITE2 SITE3 >>       1    10    13    22 >>

Re: [R] R Data Manipulation - Transposing Data by a Given Column, Like User_ID

2011-02-03 Thread Peter Ehlers
On 2011-02-03 14:09, Dennis Murphy wrote: Hi: This also works, except that the result is of class 'table': xtabs(COUNTS ~ USER_ID + SITE, data = RAW) SITE USER_ID SITE1 SITE2 SITE3 1101322 2101212 31344 0 4 0 09

Re: [R] R Data Manipulation - Transposing Data by a Given Column, Like User_ID

2011-02-03 Thread Dennis Murphy
Hi: This also works, except that the result is of class 'table': xtabs(COUNTS ~ USER_ID + SITE, data = RAW) SITE USER_ID SITE1 SITE2 SITE3 1101322 2101212 31344 0 4 0 099 If you need a data frame, then the earlier res

Re: [R] R Data Manipulation - Transposing Data by a Given Column, Like User_ID

2011-02-03 Thread Steve Lianoglou
Hi, On Thu, Feb 3, 2011 at 2:41 PM, Mike Schumacher wrote: > Hello, > > I'd like to transpose data to create an analysis-friendly dataframe.  See > below for an example, I was unable to use t(x) and I couldn't find a > function with options like PROC TRANSPOSE in SAS. > > The ideal solution handl

Re: [R] R Data Manipulation - Transposing Data by a Given Column, Like User_ID

2011-02-03 Thread Eik Vettorazzi
Hi Mike reshape will be your friend. reshape(RAW,direction="wide",timevar="SITE",idvar="USER_ID") there is also the 'reshape'-package, which can do some more sophisticated transformations. hth. Am 03.02.2011 20:41, schrieb Mike Schumacher: > Hello, > > I'd like to transpose data to create an

[R] R Data Manipulation - Transposing Data by a Given Column, Like User_ID

2011-02-03 Thread Mike Schumacher
Hello, I'd like to transpose data to create an analysis-friendly dataframe. See below for an example, I was unable to use t(x) and I couldn't find a function with options like PROC TRANSPOSE in SAS. The ideal solution handles variable quantities of SITE - but beggars can't be choosers. :-) Tha

Re: [R] R data opening problem

2010-10-02 Thread Jeffrey Spies
If I understand your problem correctly, I think you need to be doing: summary(data.name) The functions read.dta and read.spss both return things (data frames, if you use the to.data.frame=T argument with read.spss). So whatever variable you set is what you should be doing a summary on. In this

Re: [R] R data opening problem

2010-10-02 Thread Joshua Wiley
Hi Alla, The error message suggests that "kelleya" is a function. What happens when you type: str(kelleya) ? Josh On Sat, Oct 2, 2010 at 7:01 PM, Alla Manukyan wrote: > Dear Sir/Madam, > I have just installed R for Windows. I am trying to open a stata file and I > have > a problem. I have

[R] R data opening problem

2010-10-02 Thread Alla Manukyan
Dear Sir/Madam, I have just installed R for Windows. I am trying to open a stata file and I have a problem. I have used the following commands: > install.packages("foreign") > library(foreign) > data.name <- read.dta(file.choose()) # then I choose a kelleya.dta file and click on open and

[R] R: Data frame "pivoting"

2010-05-06 Thread ANGELO.LINARDI
It works perfectly !!! Thank you so much !! Angelo -Messaggio originale- Da: Patrick Hausmann [mailto:patrick.hausm...@uni-bremen.de] Inviato: giovedì 6 maggio 2010 12.05 A: LINARDI ANGELO Cc: r-help@r-project.org Oggetto: Re: [R] Data frame "pivoting" Hi Angelo, try x <- structure(li

Re: [R] R data Export to Excel

2008-03-03 Thread Gavin Simpson
The other respondants here have missed the point - write.table() as invoked by the OP does not produce a csv file. The default separator is " " (a space) in write.table(), so no wonder Excel cocked it up as it assumes that a csv file is one that has elements separated by a comma ",". We don't need

Re: [R] R data Export to Excel

2008-03-02 Thread Hans-Peter
> > it doesn't seem indicate any installation instruction. > http://cran.r-project.org/web/packages/xlsReadWrite/index.html As Wensui Liu already mentioned, installation is the same as with other packages: In the RGui menu select Packages->Install Packages...->(Select a CRAN mirror)->(Select the

Re: [R] R data Export to Excel

2008-03-02 Thread Wensui Liu
i think you simply install it in the way you install other R packages. On Sun, Mar 2, 2008 at 10:40 PM, Christophe Lo <[EMAIL PROTECTED]> wrote: > thanks for your response. How do i install it? I try looking at the manual > it doesn't seem indicate any installation instruction. I also download a >

Re: [R] R data Export to Excel

2008-03-02 Thread Christophe Lo
thanks for your response. How do i install it? I try looking at the manual it doesn't seem indicate any installation instruction. I also download a windows version but it doesn't have an exe file. http://cran.r-project.org/web/packages/xlsReadWrite/index.html Newbie, Kei On 3/3/08, Wensui Liu <

Re: [R] R data Export to Excel

2008-03-02 Thread Wensui Liu
hi, did you try write.xls in xlsReadWrite package? On Sun, Mar 2, 2008 at 9:59 PM, Keizer_71 <[EMAIL PROTECTED]> wrote: > > Here is my R Code > > x<-1:2 > y<-2:141 > data.matrix<-data.matrix(data[,y])#create data.matrix > variableprobe<-apply(data.matrix[x,],1,var) > variableprobe #outp

Re: [R] R data Export to Excel

2008-03-02 Thread jim holtman
If you are asking how to convert to multiple columns in Excel, look at the "text to column" option in I think the data tab. On Sun, Mar 2, 2008 at 9:59 PM, Keizer_71 <[EMAIL PROTECTED]> wrote: > > Here is my R Code > > x<-1:2 > y<-2:141 > data.matrix<-data.matrix(data[,y])#create data.matrix >

[R] R data Export to Excel

2008-03-02 Thread Keizer_71
Here is my R Code x<-1:2 y<-2:141 data.matrix<-data.matrix(data[,y])#create data.matrix variableprobe<-apply(data.matrix[x,],1,var) variableprobe #output variance across probesets hist(variableprobe) #displaying histogram of variableprobe write.table(cbind(data[1], Variance=apply(data[,y],1,