Re: [R] data analysis. R

2009-03-22 Thread UBC
thx for ur fast responds. but sorry for asking stupid, i am a turn beginner of R (just trying it out 3 months, and i am taking my first course about it) so, to tackle this questions, i was told to use nested design method, could you actually show me how would u attempt this problem? (a) Determine

[R] data frame to array

2009-03-22 Thread Thomas S. Dye
Aloha all, I have a data frame with 4 columns. The first three are factors (f1, f2, f3) and the fourth is numeric. I'd like to explore these data using median polish. To do that I plan to use medpolish() on the matrix[f1,f2xf3], then medpolish on the resulting matrix[f2,f3]. This

Re: [R] data frame to array

2009-03-22 Thread Bill.Venables
be in arbitrary order. Bill Venables http://www.cmis.csiro.au/bill.venables/ -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Thomas S. Dye Sent: Monday, 23 March 2009 7:36 AM To: r-help@r-project.org Subject: [R] data frame to array

[R] data analysis. R

2009-03-21 Thread UBC
so i am having this question what should i do if the give data file (.txt) has 4 columns, but different lengths? how can i read them in R? any idea for the following problem? Gas consumption (1000 cubic feet) was measured before and after insulation was put into a house. We are interested in

Re: [R] data analysis. R

2009-03-21 Thread jim holtman
If the input file has a separator other than a space (e.g., tabs or commas) then you can read it is and the missing data will be NAs and you can decide how to handle it. If it does not have a separator, then maybe you can read it in with read.fwf. Otherwise when you read it in, you can tell the

Re: [R] data analysis. R

2009-03-21 Thread Gabor Grothendieck
This works with the example. If the real data is different it may not work. To run the example below just copy and paste it into R. To run with the real data replace textConnection(Lines) with insulation.txt everywhere. Lines - Before insulAfter insul. tempgas tempgas -0.8

Re: [R] data analysis. R

2009-03-21 Thread Dylan Beaudette
On Sat, Mar 21, 2009 at 5:13 PM, UBC cheong0...@hotmail.com wrote: so i am having this question what should i do if the give data file (.txt) has 4 columns, but different lengths? how can i read them in R? any idea for the following problem? Gas consumption (1000 cubic feet) was measured

[R] Data Restructuring Question

2009-03-09 Thread Jason Rupert
I think I am overlooking a call or concept in R to help me easily and quickly restructure my data.frame:   Sometimes the data I receive looks like: VariableName, Run1, Run2, Run3, Location temp,   15.0,  16.0,  17.0, There   And other times it looks like: VariableName, Run, Location

Re: [R] Data Restructuring Question

2009-03-09 Thread stephen sefick
look at package reshape there is a cool little function input that once you get the hang of is handy. On Mon, Mar 9, 2009 at 5:50 PM, Jason Rupert jasonkrup...@yahoo.com wrote: I think I am overlooking a call or concept in R to help me easily and quickly restructure my data.frame: Sometimes

Re: [R] Data Restructuring Question

2009-03-09 Thread Jason Rupert
.  --- On Mon, 3/9/09, stephen sefick ssef...@gmail.com wrote: From: stephen sefick ssef...@gmail.com Subject: Re: [R] Data Restructuring Question To: jasonkrup...@yahoo.com Cc: R-help@r-project.org Date: Monday, March 9, 2009, 9:00 PM look at package reshape there is a cool little function input that once

[R] Data Envelopment Analysis in R

2009-02-25 Thread Arup
How do I do a data envelopment analysis in R...provide me with the step by step procedure for that..thanks in advance... Arup -- View this message in context: http://www.nabble.com/Data-Envelopment-Analysis-in-R-tp22199360p22199360.html Sent from the R help mailing list archive at Nabble.com.

[R] data file - function write.fwf - library gdata

2009-02-24 Thread Paulo Barata
Dear R-list members, I have a data file with thousands of lines (cases), where each line contains the values of several variables. I would like to separate these lines in small groups, with each group followed by a blank line, to ease the visual inspection of the data in some situations. I am

[R] data editor in R- could it be improved?

2009-02-04 Thread Simon Pickett
Hi all, I've used R for basic programming and data management for a few years now. One of the things that I think could be improved is the data editor. Its a great feature and I use it alot by calling edit(data.frame); very useful to see if what you tried to do actually worked. However, one

Re: [R] data editor in R- could it be improved?

2009-02-04 Thread Suresh_FSFM
Hi ! I am using Tinn R data editor. This is wonderful and also thin one. Try this. I guess, yu will find what you are looking for. Regards, Suresh Simon Pickett-4 wrote: Hi all, I've used R for basic programming and data management for a few years now. One of the things that I think

Re: [R] data editor in R- could it be improved?

2009-02-04 Thread Prof Brian Ripley
There are three different data editors, so you will need to start by telling us your OS (and the other details asked for in the posting guide). But this is really an R-devel question, and that is where offers to work on this (or to sponsor such work) should be posted. As the author of one

[R] Data Frame Manipulation: Time Series

2009-01-27 Thread Josip Dasovic
Dear R Helpers: I have a data set where the unit of observation is country-year. I would like to generate a new data set based on some inclusionary (exclusionary) criteria. Here is an example of the type of data that I have. df-data.frame(cbind(country=c(rep(Angola, 9), rep(Burundi, 7),

Re: [R] Data Frame Manipulation: Time Series

2009-01-27 Thread jim holtman
Is the what you are after: df-data.frame(cbind(country=c(rep(Angola, 9), rep(Burundi, 7), + rep(Chad, 13)), year=c(1975:1983, 1989:1995, 1965:1977)), + war=c(rep(1,2), rep(0,5), rep(1,2), rep(1,2), rep(0,2), rep(1,3), + rep(1,4), rep(0,6), rep(1,3))) x - split(df, df$country)

Re: [R] Data Frame Manipulation: Time Series

2009-01-27 Thread Josip Dasovic
Hello Jim: Yes, that's exactly what I needed! Thank you! Josip - Original Message - From: jim holtman jholt...@gmail.com To: Josip Dasovic j_daso...@sfu.ca Cc: r-help@r-project.org Sent: Tuesday, January 27, 2009 4:45:31 PM GMT -08:00 US/Canada Pacific Subject: Re: [R] Data Frame

[R] data management

2009-01-25 Thread oscar linares
Dear Rxperts, I would like to convert the following: StudyStudy.NameParameterDestSrcFormValueMin MaxFSD 1NT_1-0BFK(03)03A0.128510.0E+001. 0.41670E-01 1NT_1-0BFL(00,03)0003D0.36577 1NT_1-0BF

Re: [R] data management

2009-01-25 Thread Uwe Ligges
Although the message is rather unreadable, I guess you want to look at ?reshape. Uwe Ligges oscar linares wrote: Dear Rxperts, I would like to convert the following: StudyStudy.NameParameterDestSrcFormValueMin MaxFSD 1NT_1-0BFK(03)03A

[R] data management

2009-01-18 Thread oscar linares
Dear Rxperts, I have a varaibles data file that looks like this p(1) 10 p(1) 3 p(1) 4 p(2) 20 p(2) 30 p(2) 40 p(3) 4 p(3) 1 p(1) 2 I cannot process these data with R because it does not like the parentheses. How can I get these to look like: p1 10 p1 3 p1 4 p2 20 p2 30 p2 40 p3 4 p3 1 p3 2

Re: [R] data management

2009-01-18 Thread jim holtman
Does this give you what you want: x - read.table(textConnection(p(1) 10 + p(1) 3 + p(1) 4 + p(2) 20 + p(2) 30 + p(2) 40 + p(3) 4 + p(3) 1 + p(1) 2), as.is=TRUE) # remove parenthesis x$V1 - gsub([()], , x$V1) x V1 V2 1 p1 10 2 p1 3 3 p1 4 4 p2 20 5 p2 30 6 p2 40 7 p3 4 8 p3 1 9 p1 2

Re: [R] data management

2009-01-18 Thread David Winsemius
? gsub gsub(\\(|\\), , var) You can then read.table on a textConnection. read.table(textConnection(gsub(\\(|\\), , var) )) V1 V2 1 p1 10 2 p1 3 3 p1 4 4 p2 20 5 p2 30 6 p2 40 7 p3 4 8 p3 1 9 p1 2 On Jan 18, 2009, at 12:13 PM, oscar linares wrote: Dear Rxperts, I have a varaibles

[R] data frames with å, ä, and ö (=n on-ASCII-characters) from windows to mac os x

2009-01-16 Thread Gustaf Rydevik
Hi, I ran into this issue previously and managed to solve it, but I've forgotten how and am getting frustrated... I have a data frame (see below) with scandinavian characters in R (2.7.1) running on a Win Xp-computer. I save the data frame in an RData-file on a usb stick, and load() it in R

Re: [R] data frames with å, ä, and ö (=n on-ASCII-characters) from windows to mac os x

2009-01-16 Thread Ivan Alves
Hi, On my system (see below), it works fine (inputing the code below at the R prompt). Make sure that the encoding of the input file is encoded UTF-8. Rgds, Ivan sessionInfo() R version 2.8.1 Patched (2009-01-14 r47602) i386-apple-darwin9.6.0 locale:

[R] data format issue

2008-12-20 Thread Sherri Heck
Dear all- I have a dataset (see a sample below - but the whole dataset is June 2005 - June 2008). The LST format is YYMMDDHHmm and I would like to get the hourly average of the mph for the summer months (spanning all years). I have been trying to use aggregate but am not having much success

Re: [R] data format issue

2008-12-20 Thread jim holtman
Does this do it for you: # quick and dirty -- remove the 'mm' from the data and then aggregate x$hours - (x$LST %/% 100) * 100 aggregate(x$mph, list(x$hours), mean) Group.1x 1 50601 13.82500 2 506010100 17.55000 3 506010200 23.04167 4 506010300 22.0 You can also 'filter'

Re: [R] data format issue

2008-12-20 Thread Gabor Grothendieck
Use read.zoo and aggregate.zoo from zoo and months, hours and as.chron from chron. Note that we must read in col 1 as character to ensure leading zeros don't get dropped. There are two mph columns and it is assumed you want both: Lines - LST inch mphDeg DegF DegF%volts

Re: [R] Data Analysis Functions in R

2008-12-09 Thread Dirk Eddelbuettel
On Mon, Dec 08, 2008 at 09:34:35PM -0800, Feanor22 wrote: Hi experts of R, Are there any functions in R to test a univariate series for long memory effects, structural breaks and time reversability? I've found for ARCH effects(ArchTest), for normal (Shapiro.test, KS.test(comparing with

[R] Data Analysis Functions in R

2008-12-08 Thread Feanor22
Hi experts of R, Are there any functions in R to test a univariate series for long memory effects, structural breaks and time reversability? I've found for ARCH effects(ArchTest), for normal (Shapiro.test, KS.test(comparing with randn) and lillie.test) but not for the above mentioned. Where can

[R] Data frame help

2008-11-24 Thread Rajasekaramya
hi there I have a dataframe abc 123 234 abc 234 456 def 567 234 elm 123 456 klm 234 678 klm 465 678 I want the unique of first colum along with the values in colum 2 and 3.I By default it will select the first element for the unique so my out put should be abc 123 234 def 567 234 elm 123 456

Re: [R] data which has different size of elements in each row

2008-11-12 Thread yanniliu
I have the same problem. If the first row has more columns than later rows, the fill=TRUE works; however when the first row has LESS columns than later rows, R won't read in more columns than the length of the first row. Anyone has solutions? Yanni Marc Schwartz wrote: on 11/11/2008 03:39

Re: [R] data which has different size of elements in each row

2008-11-12 Thread Marc Schwartz
This was the scenario that Phoebe posted about. Her data was: 2.93290e-06 1.17772e-06 -0.645205 rs2282755 3.07521e-06 3.14000e-04 0.412997 rs1336838 4.84017e-06 2.18311e-01 0.188669 rs2660664 rs967785 9.77861e-06 7.04740e-02 0.294653 rs2660664 1.22767e-05 1.56325e-05 0.569826 rs6870519

[R] data type problem for vegan package

2008-11-11 Thread keunhchoi
Dear all, I'm using R2.8 version, and am trying to do NMDS and calculate other diversity indices in vegan package. The problem is that it works with a small set of data (43 X 23; row by column), but the following error message comes up with a larger data set (43 X 104) (it seems not large to me

Re: [R] data type problem for vegan package

2008-11-11 Thread Gavin Simpson
Hi Keun-Hyung, Can you send the data (off list) to me or at least show what str(gh1) produces, and show us the output from require(vegan) sessionInfo() Without that it is difficult to help. G On Tue, 2008-11-11 at 17:19 +0900, [EMAIL PROTECTED] wrote: Dear all, I'm using R2.8 version,

[R] data which has different size of elements in each row

2008-11-11 Thread phoebe kong
Hi all, I have problem reading in a text file as follow. The following data has not column header. I tried the following command but failed, temp-read.table(data.txt,header=F) An error message stated that line 3 did not have 4 elements. 0.293290E-05 0.117772E-05 -0.645205

Re: [R] data which has different size of elements in each row

2008-11-11 Thread Marc Schwartz
on 11/11/2008 03:39 PM phoebe kong wrote: Hi all, I have problem reading in a text file as follow. The following data has not column header. I tried the following command but failed, temp-read.table(data.txt,header=F) An error message stated that line 3 did not have 4 elements.

Re: [R] Data Manipulation, add frequency index

2008-11-08 Thread Gabor Grothendieck
See ?ave and ?seq_along DF - data.frame(Name = c(Mary, Mary, Mary, Sam, Sam, John, John, John, John), stringsAsFactors = FALSE) DF$index - ave(1:nrow(DF), DF$Name, FUN = seq_along) On Sat, Nov 8, 2008 at 5:43 AM, jie feng [EMAIL PROTECTED] wrote: Hi, there, I have a simple data

[R] Data Manipulation, add frequency index

2008-11-08 Thread jie feng
Hi, there, I have a simple data manipulation question for you. Thank you for your help! Suppose that I have this data about people appearing in a class Mary Mary Mary Sam Sam John John John John Then I want to find out what exact time(s) the student appears at the moment such as Mary 1

Re: [R] Data Manipulation, add frequency index

2008-11-08 Thread Dimitris Rizopoulos
one way is with ave(), e.g., dat - data.frame(name = rep(c(Mary, Sam, John), c(3,2,4))) dat$freq - ave(seq_along(dat$name), dat$name, FUN = seq_along) dat I hope it helps. Best, Dimitris jie feng wrote: Hi, there, I have a simple data manipulation question for you. Thank you for your

[R] Data manipulation question

2008-11-06 Thread Peter Jepsen
Dear R-listers, I am a relatively inexperienced R-user currently migrating from Stata. I am deeply frustrated by this data manipulation question: I know how I could do it in Stata, but I cannot make it work in R. I have a data frame of hospitalization data where each row represents an admission.

Re: [R] Data manipulation question

2008-11-06 Thread bartjoosen
How about: id - c(rep(a,4),rep(b,2), rep(c,5), rep(d,1)) start - c(c(0,6,17,20),c(0,1),c(0,5,10,11,50),c(0)) stop - c(c(6,12,20,30),c(1,10),c(3,10,11,30,55),c(6)) data - data.frame(id,start,stop) f - function(data){ m - match(data$start,data$stop) + 1 if (length(m)==1

Re: [R] Data manipulation question

2008-11-06 Thread cruz
On Thu, Nov 6, 2008 at 4:23 PM, Peter Jepsen [EMAIL PROTECTED] wrote: Here is an example: id - c(rep(a,4),rep(b,2), rep(c,5), rep(d,1)) start - c(c(0,6,17,20),c(0,1),c(0,5,10,11,50),c(0)) stop - c(c(6,12,20,30),c(1,10),c(3,10,11,30,55),c(6)) data - as.data.frame(cbind(id,start,stop)) data

Re: [R] Data manipulation question

2008-11-06 Thread Peter Jepsen
special cases outside my small example dataset. Thank you again! Peter. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of bartjoosen Sent: 6. november 2008 11:31 To: r-help@r-project.org Subject: Re: [R] Data manipulation question How about: id - c(rep(a,4

[R] how to cite R data sets

2008-11-04 Thread dxc13
? Thanks, ~D -- View this message in context: http://www.nabble.com/how-to-cite-R-data-sets-tp20325205p20325205.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

Re: [R] how to cite R data sets

2008-11-04 Thread stephen sefick
built into R as a means of showing an example of how my analysis will be carried out. I know that citation(package) will produce a citation for any R package, but is there a proper way to cite this data set? Thanks, ~D -- View this message in context: http://www.nabble.com/how-to-cite-R-data

[R] data frame column name as a function argument

2008-09-26 Thread eric lee
Hello, I'd like to pass a column name as the argument for a function, but I'm getting NULL as a return value. Any suggestions? Thanks. d - data.frame(cbind(x=1, y=1:10)) d x y 1 1 1 2 1 2 3 1 3 4 1 4 5 1 5 6 1 6 7 1 7 8 1 8 9 1 9 10 1 10 testing - function(var) { + tst

Re: [R] data frame column name as a function argument

2008-09-26 Thread Hutchinson,David [PYR]
, September 26, 2008 3:10 PM To: r-help@r-project.org Subject: [R] data frame column name as a function argument Hello, I'd like to pass a column name as the argument for a function, but I'm getting NULL as a return value. Any suggestions? Thanks. d - data.frame(cbind(x=1, y=1:10)) d x y 1 1

Re: [R] Data format for BiodiversityR

2008-09-16 Thread margherita mutarelli
Hello, maybe it is better if you copy an extract of your dataset file in the message because the attached file did'nt seem to get through. Margherita 2008/9/14 Ndoh Innocent (Holy) [EMAIL PROTECTED] Greetings dear friends. Please, I really find problems having the program read my datasets

[R] Data format for BiodiversityR

2008-09-14 Thread Ndoh Innocent (Holy)
Greetings dear friends. Please, I really find problems having the program read my datasets (here attached). Have converted datasets to csv, imported but always not reaching the target. Would be very happy if some one out can help me on time. Thanks Ndoh Mbue Innocent International corporation

[R] data import

2008-09-11 Thread afshin fallah
Dear All, I have a data set containing 2,122,164 records and 38198952 fields. I can not import this data due to momory problem. Is there a way to solve this problem? Thanks [[alternative HTML version deleted]] __ R-help@r-project.org

Re: [R] data import

2008-09-11 Thread Richard . Cotton
? Chapter 4 of the R Data Import/Export Manual may help. 2. Failing that, buy more memory for your PC. Regards, Richie. Mathematical Sciences Unit HSL ATTENTION: This message contains privileged and confidential inform

Re: [R] data import

2008-09-11 Thread jim holtman
You can use a connection and read a portion of the data in at a time and process it. Do you need all the data at once? If so, I would agree that you either need more memory (and possibly a 64-bit version of the system), or you come up with a different approach to your processing. You have not

[R] data frame question

2008-09-03 Thread Nair, Murlidharan T
I have a data frame containing sequences and I am interested in changing a few sequences in a window and the swapping the original sequence back after I have completed my analysis. My temporary data frame that I am creating seq.in.window does not like the way I am making me assignment. The

[R] data types in R

2008-08-15 Thread Amanda1988
I was having a problem with a little simple function I wrote in R and I think the problem was that R is representing fractional numbers in binary floating point and not decimal notation, so sometimes I was having extra data points counted. Is there a way to cast a number stored in a variable as

Re: [R] data types in R

2008-08-15 Thread jim holtman
faq 7.31 On Fri, Aug 15, 2008 at 9:16 AM, Amanda1988 [EMAIL PROTECTED] wrote: I was having a problem with a little simple function I wrote in R and I think the problem was that R is representing fractional numbers in binary floating point and not decimal notation, so sometimes I was having

Re: [R] viewing data in something similar to 'R Data Editor'

2008-08-02 Thread Erich Neuwirth
working with in a clean, easy to read, separate window. A friend showed me how to do something like I want with edit(). I can view the matrix in the 'R Data Editor': For a sample matrix: mat=matrix(1:15,ncol=3) mat [,1] [,2] [,3] [1,]16 11 [2,]27 12 [3,]38 13

Re: [R] viewing data in something similar to 'R Data Editor'

2008-08-02 Thread Philippe Grosjean
, at 7:29 PM, Rachel Schwartz wrote: Hi, I would like to view matrices I am working with in a clean, easy to read, separate window. A friend showed me how to do something like I want with edit(). I can view the matrix in the 'R Data Editor': For a sample matrix: mat=matrix(1:15,ncol=3) mat

[R] viewing data in something similar to 'R Data Editor'

2008-08-01 Thread Rachel Schwartz
Hi, I would like to view matrices I am working with in a clean, easy to read, separate window. A friend showed me how to do something like I want with edit(). I can view the matrix in the 'R Data Editor': For a sample matrix: mat=matrix(1:15,ncol=3) mat [,1] [,2] [,3] [1,]16

Re: [R] viewing data in something similar to 'R Data Editor'

2008-08-01 Thread Erik Iverson
view the matrix in the 'R Data Editor': For a sample matrix: mat=matrix(1:15,ncol=3) mat [,1] [,2] [,3] [1,]16 11 [2,]27 12 [3,]38 13 [4,]49 14 [5,]5 10 15 look=function(x) invisible(edit(x)) look(mat) That opens the 'R Data Editor

Re: [R] viewing data in something similar to 'R Data Editor'

2008-08-01 Thread Rachel Schwartz
your last sentence. Maybe there's a better option? Rachel Schwartz wrote: Hi, I would like to view matrices I am working with in a clean, easy to read, separate window. A friend showed me how to do something like I want with edit(). I can view the matrix in the 'R Data Editor

Re: [R] viewing data in something similar to 'R Data Editor'

2008-08-01 Thread Erik Iverson
to view matrices I am working with in a clean, easy to read, separate window. A friend showed me how to do something like I want with edit(). I can view the matrix in the 'R Data Editor': For a sample matrix: mat=matrix(1:15,ncol=3

Re: [R] viewing data in something similar to 'R Data Editor'

2008-08-01 Thread Jim Porzak
, Aug 1, 2008 at 10:29 AM, Rachel Schwartz [EMAIL PROTECTED] wrote: Hi, I would like to view matrices I am working with in a clean, easy to read, separate window. A friend showed me how to do something like I want with edit(). I can view the matrix in the 'R Data Editor': For a sample

Re: [R] viewing data in something similar to 'R Data Editor'

2008-08-01 Thread Gabor Grothendieck
in the 'R Data Editor': For a sample matrix: mat=matrix(1:15,ncol=3) mat [,1] [,2] [,3] [1,]16 11 [2,]27 12 [3,]38 13 [4,]49 14 [5,]5 10 15 look=function(x) invisible(edit(x)) look(mat) That opens the 'R Data Editor' with mat loaded

[R] Data length mismatch.

2008-07-26 Thread rkevinburton
I have two vectos (list) that represent a years of data. Each row is represented by the day of year and the quantity that was sold for that day. I would like to form a new vector that is the difference between the two years of data. A sample of A (and similarly B) looks like: A[1:5,]

Re: [R] Data length mismatch.

2008-07-26 Thread Gabor Grothendieck
Look at merge.zoo library(zoo) dput(A) structure(list(DayOfYear = 1:5, x = c(1429L, 3952L, 3049L, 2844L, 2219L)), .Names = c(DayOfYear, x), class = data.frame, row.names = c(1, 2, 3, 4, 5)) B - A[c(2,4),] Az - zoo(A$x, A$DayOfYear) Bz - zoo(B$x, B$DayOfYear) merge(Az, Bz, fill = 0) Az

Re: [R] Data length mismatch.

2008-07-26 Thread Gabor Grothendieck
For the last statement we may prefer this so it stays a zoo object: m - merge(Az, Bz, fill = 0) m[,1] - m[,2] 12345 14290 30490 2219 On Sat, Jul 26, 2008 at 5:53 PM, Gabor Grothendieck [EMAIL PROTECTED] wrote: Look at merge.zoo library(zoo) dput(A)

Re: [R] Data length mismatch.

2008-07-26 Thread Gabor Grothendieck
Here is a second solution. This one uses sqldf instead of zoo: library(zoo) sqldf(select A.x - ifnull(B.x, 0) from A left join B using(DayOfYear)) See http://sqldf.googlecode.com On Sat, Jul 26, 2008 at 5:26 PM, [EMAIL PROTECTED] wrote: I have two vectos (list) that represent a years of

Re: [R] Data length mismatch.

2008-07-26 Thread Gabor Grothendieck
Here is a third solution. A[B$DayOfYear, x] - A[B$DayOfYear, x] - B$x Its assumes B's days are a subset of A's but if that's not the case then you would need to intersect them first: ?intersect On Sat, Jul 26, 2008 at 5:26 PM, [EMAIL PROTECTED] wrote: I have two vectos (list) that represent a

Re: [R] Data length mismatch.

2008-07-26 Thread Gabor Grothendieck
Sorry, the last one should be: ix - match(B$DayOfYear, A$DayOfYear) A[ix, x] - A[ix, x] - B$x Again we are assuming B's days are a subset of A's. On Sat, Jul 26, 2008 at 6:08 PM, Gabor Grothendieck [EMAIL PROTECTED] wrote: Here is a third solution. A[B$DayOfYear, x] - A[B$DayOfYear, x] - B$x

Re: [R] Data length mismatch.

2008-07-26 Thread Don MacQueen
I think the merge() function should be adequate for this task. Here is an example. A - data.frame(day=1:5, x=runif(5)) B - data.frame(day=3:7, x=runif(5)) A day x 1 1 0.9764534 2 2 0.9693998 3 3 0.1324933 4 4 0.8311153 5 5 0.3264465 B - data.frame(day=3:8,

[R] data transformation

2008-07-22 Thread Christian Hof
Dear all, how can I, with R, transform a presence-only table (with the names of the species (1st column), the lat information of the sites (2nd column) and the lon information of the sites (3rd column)) into a presence-absence (0/1) matrix of species occurrences across sites, as given in the

Re: [R] data transformation

2008-07-22 Thread Marc Schwartz
on 07/22/2008 11:24 AM Christian Hof wrote: Dear all, how can I, with R, transform a presence-only table (with the names of the species (1st column), the lat information of the sites (2nd column) and the lon information of the sites (3rd column)) into a presence-absence (0/1) matrix of

[R] Data Manipulations and SQL

2008-07-14 Thread Willa Wei
frames into one. In SQL, we can just simply use the join comment. What should we do in R? Is there any package that allows us to run SQL statements with R data? Thank you in advance for your help, Willa This message contains confidential information and is in...{{dropped:8

Re: [R] Data Manipulations and SQL

2008-07-14 Thread Gabor Grothendieck
should we do in R? Is there any package that allows us to run SQL statements with R data? Thank you in advance for your help, Willa This message contains confidential information and is in...{{dropped:8}} __ R-help@r-project.org mailing list https

Re: [R] data summerization etc...

2008-07-12 Thread hadley wickham
On Sat, Jul 12, 2008 at 7:44 AM, sj [EMAIL PROTECTED] wrote: Hello, I am trying to do some fairly straightforward data summarization, i.e., the kind you would do with a pivot table in excel or by using SQL queires. I have a moderately sized data set of ~70,000 records and I am trying to

Re: [R] data summerization etc...

2008-07-12 Thread Gabor Grothendieck
See sqldf home page: http://sqldf.googlecode.com e.g. library(sqldf) set.seed(1) pti -rnorm(7,10) fid - rnorm(7,100) finc - rnorm(7,1000) # set is a reserved word in SQL so use sset sset - data.frame(fid,pti,finc) system.time(out - sqldf(select fid, sum(pti) from sset group by fid))

[R] data summerization etc...

2008-07-11 Thread sj
Hello, I am trying to do some fairly straightforward data summarization, i.e., the kind you would do with a pivot table in excel or by using SQL queires. I have a moderately sized data set of ~70,000 records and I am trying to compute some group averages and sum values within groups. the code

[R] data summarization etc...

2008-07-11 Thread sj
Hello, I am trying to do some fairly straightforward data summarization, i.e., the kind you would do with a pivot table in excel or by using SQL queires. I have a moderately sized data set of ~70,000 records and I am trying to compute some group averages and sum values within groups. the code

Re: [R] data summarization etc...

2008-07-11 Thread Daniel Malter
Betreff: [R] data summarization etc... Hello, I am trying to do some fairly straightforward data summarization, i.e., the kind you would do with a pivot table in excel or by using SQL queires. I have a moderately sized data set of ~70,000 records and I am trying to compute some group averages

Re: [R] data summarization etc...

2008-07-11 Thread Daniel Malter
- -Ursprüngliche Nachricht- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Daniel Malter Gesendet: Friday, July 11, 2008 7:53 PM An: 'sj'; 'r-help' Betreff: Re: [R] data summarization etc... The problem is that you do not really have categories. You draw 3 times 7

[R] Data size

2008-07-03 Thread arghya ganguli
Can somebody please let me know what is the maximum number of rows and columns that R can handle in a datafile? Thanks Regards, Arghya Ganguli __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the

Re: [R] Data size

2008-07-03 Thread John Kane
/3/08, arghya ganguli [EMAIL PROTECTED] wrote: From: arghya ganguli [EMAIL PROTECTED] Subject: [R] Data size To: r-help@r-project.org Received: Thursday, July 3, 2008, 7:41 AM Can somebody please let me know what is the maximum number of rows and columns that R can handle in a datafile

Re: [R] data frame manipulation - splitting monitoring interval and assigning stage

2008-06-26 Thread Jessi Brown
I'd like to thank those who contacted me with ideas on how to solve this little problem. I learned something from looking through each snippet of code, even if it wasn't doing quite what I'd hoped it would do. Mark Leeds deserves special thanks, for helping me debug my several attempts to improve

[R] Data matrix of all possible response patterns

2008-06-26 Thread SARAH A DEPAOLI
I am looking for a way to generate a data matrix that contains all possible response patterns for 10 binary items. This should produce a matrix with 10 rows (representing 10 items) and 1024 columns (representing 2^10 possible response patterns). Does anyone know of code that would produce such

Re: [R] Data matrix of all possible response patterns

2008-06-26 Thread Daniel Folkinshteyn
this is probably a cludge, and there may be a neater way to do this, but... here's one: a = 0:1 for (i in 1:9){ a= merge(unname(a), 0:1) } a = t(a) after the for loop, 'a' will contain a 1024 row by 10 col dataframe. putting it through a transpose, gives you the 10 rows by 1024 cols

Re: [R] Data matrix of all possible response patterns

2008-06-26 Thread Henrique Dallazuanna
Try this also: t(expand.grid(rep(list(0:1), 10))) On Thu, Jun 26, 2008 at 3:18 PM, SARAH A DEPAOLI [EMAIL PROTECTED] wrote: I am looking for a way to generate a data matrix that contains all possible response patterns for 10 binary items. This should produce a matrix with 10 rows

Re: [R] Data matrix of all possible response patterns

2008-06-26 Thread Charles C. Berry
mat - outer( 0:9, 0:(1024-1), function(x,y) y %/% (2^x) %% 2 ) On Thu, 26 Jun 2008, Daniel Folkinshteyn wrote: this is probably a cludge, and there may be a neater way to do this, but... here's one: a = 0:1 for (i in 1:9){ a= merge(unname(a), 0:1) } a = t(a) after the for loop, 'a'

[R] data frame manipulation - splitting monitoring interval and assigning stage

2008-06-25 Thread Jessi Brown
Hello, everyone. I'm hoping to prevent myself from doing a lot of pointing and clicking in Excel. I have a dataframe of bird nest check observations, in which I know the date of the first check, the date of the second check (both currently in Julian date format), the status of the nest at the

Re: [R] data frame manipulation - splitting monitoring interval and assigning stage

2008-06-25 Thread jim holtman
Is this what you want: x - read.table(textConnection(Check1 Check2 HatchDate + 101 121 110 + 130 150 140 + 140 150 160), header=TRUE) closeAllConnections() x Check1 Check2 HatchDate 1101121 110 2130150 140 3140150 160

[R] data frame titles

2008-06-04 Thread Chris Arthur
I'm new to R so please forgive the newbie question; but i can't seem to find a definitive answer to this. I am wanting to do a PLS regression on some data. Which takes a formula of the type responseACC ~ dataACC where dataACC is multivariate in nature and responseACC is a single value. I

[R] data management question

2008-05-09 Thread Deepankar Basu
Hi all, I have a data management question. I am using an panel dataset read into R as a dataframe, call it ex. The variables in ex are: id year x id: a character string which identifies the unit year: identifies the time period x: the variable of interest (which might contain NAs). Here is

Re: [R] data management question

2008-05-09 Thread Philipp Pagel
I want to draw a subset of ex by selecting only the A and B units: ex1 - subset(ex[which(ex$id==A|ex$id==B),]) or a bit simpler: ex1 - subset(ex, ex$id %in% c('A','B')) In your expresion you don't need the subset function, as you are already using indexing to extract the desired subset.

[R] Data frame row manipulation

2008-05-09 Thread Chip Barnaby
Greetings, Q #1 -- How does one combine data frames by row ... no cleverness a la merge(), just add rows. For example, given A with 20 rows and B with 30 rows, I want C = combine( A, B) having 50 rows. Columns having matching names should be filled from both (all) sources with

Re: [R] Data frame row manipulation

2008-05-09 Thread Jorge Ivan Velez
Hi Chip, Try this: # For Q1 R C1 = rbind(A,B) or R C2 = do.call(rbind,list(A,B)) R all.equal(C1,C2) # TRUE # For Q2 R set.seed(123) R vx=1:10 R A = matrix(rnorm(500),ncol=10) R A2=t(sapply(A,rep,10)) R A2[vx,]- A[vx,] R A2 R dim(A2) # 500 10 R dim(A)# 50 10 HTH, Jorge On Fri,

Re: [R] Data manipulation for random intercept GLMM

2008-05-02 Thread Ben Bolker
Giovanni Petris GPetris at uark.edu writes: ## Example: Ratings of prime minister (Agresti, Table 12.1, p.494) rating - matrix(c(794, 86, 150, 570), 2, 2) dimnames(rating) - list(First = c(approve, disapprove), + Second = c(approve, disapprove)) rating

Re: [R] Data manipulation for random intercept GLMM

2008-05-02 Thread Greg Snow
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ben Bolker Sent: Friday, May 02, 2008 7:36 AM To: [EMAIL PROTECTED] Subject: Re: [R] Data manipulation for random intercept GLMM Giovanni Petris GPetris at uark.edu writes: ## Example: Ratings of prime

[R] data transformation

2008-05-02 Thread Christian Hof
Dear all, how can I, with R, transform a presence-absence (0/1) matrix of species occurrences into a presence-only table (3 columns) with the names of the species (1st column), the lat information of the sites (2nd column) and the lon information of the sites (3rd column), as given in the

Re: [R] data transformation

2008-05-02 Thread Christos Hatzis
PM To: r-help@r-project.org Subject: [R] data transformation Dear all, how can I, with R, transform a presence-absence (0/1) matrix of species occurrences into a presence-only table (3 columns) with the names of the species (1st column), the lat information of the sites (2nd column

Re: [R] data transformation

2008-05-02 Thread Kingsford Jones
Hi Christian, Here's a way using the reshape package: dfr site lat lon spec1 spec2 spec3 spec4 1 site1 10 11 1 0 1 0 2 site2 20 21 1 1 1 0 3 site3 30 31 0 1 1 1 library(reshape) dfr - melt(dfr[, -1], id=1:2, variable_name='species')

<    8   9   10   11   12   13   14   15   >