Re: [R] exclude

2018-05-17 Thread Bert Gunter
xtabs() produces a matrix with dimnames (actually a S3 class "table" object, whchi is an array of integers -- in this case, a 2-d arrray, i.e. a matrix). Spend some time with a basic R tutorial to learn how to index matrices/arrays. This should be part of your basic R skill set. Cheers, Bert Be

Re: [R] exclude

2018-05-17 Thread Val
Thank you Bert and Jim, Jim, FYI , I have an error message generated as Error in allstates : object 'allstates' not found Bert, it is working. However, If I want to chose to include only mos years example, 2003,2004,2007 and continue the analysis as before. Where should I define the years to g

Re: [R] exclude

2018-05-17 Thread Bert Gunter
... and similar to Jim's suggestion but perhaps slightly simpler (or not!): > cross <- xtabs( Y ~ stat + year, data = tdat) > keep <- apply(cross, 1, all) > keep <- names(keep)[keep] > cross[keep,] year stat 2003 2004 2006 2007 2009 2010 AL 38 21 20 12 16 15 NY 50 51 57

Re: [R] exclude

2018-05-17 Thread Jim Lemon
Hi Val, This may help: tdat$allpresent<-FALSE for(state in allstates) tdat$allpresent[tdat$stat == state]<- all(allyears %in% tdat$year[tdat$stat==state]) tdat2<-tdat[tdat$allpresent,] xtabs(Y~stat+year,tdat2) table(tdat2$stat,tdat2$year) Jim On Fri, May 18, 2018 at 10:48 AM, Val wrote: > H

[R] exclude

2018-05-17 Thread Val
Hi All, I have a sample of data set show as below. tdat <- read.table(textConnection("stat year Y AL 200325 AL 200313 AL 200421 AL 200620 AL 200712 AL 200916 AL 201015 FL 200663 FL 200714 FL 200725 FL 200964 FL 200947 FL 201048 NY 200350 NY

Re: [R] Exclude 2014 data from mean

2015-07-31 Thread Bert Gunter
This is very basic. Have you made **any** effort to learn R -- e.g. by going through an R tutorial? If not, please do this before posting further. This will save you -- and foks on this list, probably -- a lot of grief in the long (or even short) run. Also, if/when you do post further, post in pla

Re: [R] Exclude 2014 data from mean

2015-07-31 Thread Marc Schwartz
> On Jul 31, 2015, at 1:49 PM, Adam Jauregui wrote: > > Hello R-help, > > I am trying to compute the mean of a quarterback's career fantasy football > stats, but I wish to exclude his 2014 stats from the mean, as that will be > the test data for the model I am trying to build for my academic un

Re: [R] Exclude 2014 data from mean

2015-07-31 Thread Sarah Goslee
Hi Adam, Possibly subset() or & would be helpful. Or even aggregate(), depending on your ultimate goal. Without a reproducible example that includes some sample data provided using dput() (fake is fine), the code you used, and some clear idea of what output you expect, it's impossible to figure o

[R] Exclude 2014 data from mean

2015-07-31 Thread Adam Jauregui
Hello R-help, I am trying to compute the mean of a quarterback's career fantasy football stats, but I wish to exclude his 2014 stats from the mean, as that will be the test data for the model I am trying to build for my academic undergrad research. The code for figuring out the mean of his Yds fo

Re: [R] exclude missing co-variable data in cox model

2014-12-19 Thread Therneau, Terry M., Ph.D.
Three responses to your question 1. Missing values in R are denoted by "NA". When reading in your data you want to use the "na.strings" option so that the internal form of the data has missing values properly denoted. 2. If this is done, then coxme will notice the missings and remove them

Re: [R] exclude missing co-variable data in cox model

2014-12-18 Thread aoife doherty
Hi all, I have a data set like this: Test.cox file: V1V2 V3Survival Event ann 13 WTHomo 41 ben 20 *51 tom 40 Variant 61 w

Re: [R] Exclude rows by criteria

2014-04-17 Thread arun
Hi, If the column is "numeric" class, you don't need as.numeric(as.character(...)).  My response was based on your original post " I am analyzing two columns (both are factors):" Using the same example, indx1 <- with(dat1,year <=2007 |year >2012) Warning messages: 1: In Ops.factor(year, 2007) :

Re: [R] Exclude rows by criteria

2014-04-17 Thread arun
Hi, May be this helps: set.seed(49) dat1 <- data.frame(group=factor(sample(4,20,replace=TRUE)), year=factor(sample(2003:2014,20,replace=TRUE))) indx <- with(dat1, as.numeric(as.character(year)) <=2007 | as.numeric(as.character(year)) >2012 ) with(dat1[!indx,],chisq.test(group,year)) A.K. I

Re: [R] Exclude lines in based in multiple strings

2014-02-10 Thread arun
Hi, Try: ##Assuming X and Y are matrices (as stated) Y[!Y %in% X,,drop=FALSE] #     numberall #[1,] "gen3"   #[2,] "gen4"   #[3,] "genx4"   A.K. I would like to exclude entire lines in matrix "Y" based in 2 collumns in matrix "X": Matrix "X":   number1  number2    gen1     genx1  

Re: [R] Exclude missing values on only 1 variable

2012-07-05 Thread David Winsemius
On Jul 5, 2012, at 1:34 PM, David Winsemius wrote: On Jul 5, 2012, at 1:25 PM, Eiko Fried wrote: Hello, I have many hundred variables in my longitudinal dataset and lots of missings. In order to plot data I need to remove missings. If I do data <- na.omit(data) that will reduce my datase

Re: [R] Exclude missing values on only 1 variable

2012-07-05 Thread arun
   4 16.59528 0.5981594   NA A.K. - Original Message - From: Eiko Fried To: r-help@r-project.org Cc: Sent: Thursday, July 5, 2012 1:25 PM Subject: [R] Exclude missing values on only 1 variable Hello, I have many hundred variables in my longitudinal dataset and lots of missings. In or

Re: [R] Exclude missing values on only 1 variable

2012-07-05 Thread Bert Gunter
Be careful!! The plots could be potentially misleading. The problem is the nature of the missingness. The approach you are taking is based on assuming MCAR missingness (look it up, if necessary). If that is not the case -- e.g. if there is censoring, MAR, or informative missingness -- the plots may

Re: [R] Exclude missing values on only 1 variable

2012-07-05 Thread David Winsemius
On Jul 5, 2012, at 1:25 PM, Eiko Fried wrote: Hello, I have many hundred variables in my longitudinal dataset and lots of missings. In order to plot data I need to remove missings. If I do data <- na.omit(data) that will reduce my dataset to 2% of its original size ;) So I only need to lis

[R] Exclude missing values on only 1 variable

2012-07-05 Thread Eiko Fried
Hello, I have many hundred variables in my longitudinal dataset and lots of missings. In order to plot data I need to remove missings. If I do > data <- na.omit(data) that will reduce my dataset to 2% of its original size ;) So I only need to listwise delete missings on 3 variables (the ones I a

Re: [R] Exclude when sd=0

2012-05-24 Thread David L Carlson
May 23, 2012 7:45 PM > To: r-help@r-project.org > Subject: [R] Exclude when sd=0 > > How do I trim a matrix to exclude columns that have no standard > deviation? > > Thanks, > > Chris > > [[alternative HTML version deleted]] > > _

Re: [R] Exclude when sd=0

2012-05-23 Thread Jorge I Velez
Perhaps this? X[, apply(X, 2, sd) < 1e-10] HTH, Jorge.- On Wed, May 23, 2012 at 8:44 PM, Chris Burns <> wrote: > How do I trim a matrix to exclude columns that have no standard deviation? > > Thanks, > > Chris > >[[alternative HTML version deleted]] > >

Re: [R] Exclude when sd=0

2012-05-23 Thread David Winsemius
On May 23, 2012, at 8:44 PM, Chris Burns wrote: How do I trim a matrix to exclude columns that have no standard deviation? mtx[ , as.logical(apply(mtx, 2, sd))] -- David Winsemius, MD West Hartford, CT __ R-help@r-project.org mailing list ht

[R] Exclude when sd=0

2012-05-23 Thread Chris Burns
How do I trim a matrix to exclude columns that have no standard deviation? Thanks, Chris [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide ht

Re: [R] Exclude NA while summing

2011-11-17 Thread R. Michael Weylandt
Or, for this specific application rowSums(XXX, na.rm = TRUE) Michael On Thu, Nov 17, 2011 at 5:51 AM, Jim Holtman wrote: > change to > >> row.sums.m <- apply(dummy.curr.res.m,1,sum, na.rm = TRUE) > > Sent from my iPad > > On Nov 17, 2011, at 5:18, Vikram Bahure wrote: > >> Dear R users, >> >>

Re: [R] Exclude NA while summing

2011-11-17 Thread Jim Holtman
change to > row.sums.m <- apply(dummy.curr.res.m,1,sum, na.rm = TRUE) Sent from my iPad On Nov 17, 2011, at 5:18, Vikram Bahure wrote: > Dear R users, > > I am new to R and have some query. > > I am having a dataset with binary output 0's and ones. But along with it it > has NA's too. I want

[R] Exclude NA while summing

2011-11-17 Thread Vikram Bahure
Dear R users, I am new to R and have some query. I am having a dataset with binary output 0's and ones. But along with it it has NA's too. I want to sum all the rows and get the sum total for each column. But whenever there is a NA in an row the sum of the row is returned as NA so I am not able

Re: [R] exclude columns with at least three consecutive zeros

2011-10-12 Thread William Dunlap
elp-boun...@r-project.org] On > Behalf Of Samir Benzerfa > Sent: Wednesday, October 12, 2011 8:35 AM > To: r-help@r-project.org > Subject: [R] exclude columns with at least three consecutive zeros > > Hi everyone, > > > > I have a large data set with about 3'0

[R] exclude columns with at least three consecutive zeros

2011-10-12 Thread Samir Benzerfa
Hi everyone, I have a large data set with about 3'000 columns and I would like to exclude all columns which include three or more consecutive zeros (see below example). A further issue is that it should just jump NA values if any. How can I do this? In the below example R should exclude col

Re: [R] exclude matrix from matrix

2011-08-06 Thread R. Michael Weylandt
If you know the names will always work (i.e., names of y are always names of x and the rows always have names) this should do it: x[!(rownames(x) %in% rownames(y)),] I.e., those rows of x such that their names are NOT included in the row names of y. Hope this helps, Michael Weylandt On Sat, Au

[R] exclude matrix from matrix

2011-08-06 Thread Henning Jensen
Dear List, I am a beginner of R and have an easy question, which I couldn’t find out. I like to exclude all rows of matrix “y” from matrix ”x” (like a subset of “x”, without “y”). The matrix “x” is of the structure >str(x) num [1:346, 1:8] 0.055 0.6833 0.9121 0.0819 0.1223 ... - attr(*

Re: [R] Exclude data using logical

2010-03-24 Thread pgseye
That worked. Thanks a lot David - I appreciate it. Paul -- View this message in context: http://n4.nabble.com/Exclude-data-using-logical-tp1689992p1690090.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing

Re: [R] Exclude data using logical

2010-03-24 Thread David Winsemius
On Mar 24, 2010, at 7:46 PM, pgseye wrote: Hi, I'm wanting to exclude data more than 2 sd's from the mean before proceeding with further analyses. I've created new logical variables (a and b) and written them to the existing dataframe. I want to be able to subset the TRUE observations

[R] Exclude data using logical

2010-03-24 Thread pgseye
Hi, I'm wanting to exclude data more than 2 sd's from the mean before proceeding with further analyses. I've created new logical variables (a and b) and written them to the existing dataframe. I want to be able to subset the TRUE observations based on another 2 factor variable. I'm assuming this

Re: [R] Exclude rows in xyplot

2009-10-29 Thread Deepayan Sarkar
On Tue, Oct 27, 2009 at 12:07 PM, Dieter Menne wrote: > > > > Joel Fürstenberg-Hägg wrote: >> >> >> >> Now I'm trying to make xyplots to compare the result from three different >> categories: >> >> # Plot Pro against Glc for each of the three categories >> xyplot(Pro ~ Glc | Categories_BBCH_I

Re: [R] Exclude rows in xyplot

2009-10-27 Thread Dieter Menne
Joel Fürstenberg-Hägg wrote: > > > > Now I'm trying to make xyplots to compare the result from three different > categories: > > # Plot Pro against Glc for each of the three categories > xyplot(Pro ~ Glc | Categories_BBCH_ID, data=fieldTrial0809, pch="°", > layout=c(1, 3), aspect=1, inde

[R] Exclude rows in xyplot

2009-10-27 Thread Joel Fürstenberg-Hägg
Hi all, I'm searching for a way to exclude outliers from my dataset while making xyplots. While plotting using pairs(), I exclude specific row in my data frame and save the settings as a variable which I later include as an argument: # Discard outliers and save settings as idx idx=with(fieldTr

Re: [R] exclude data for boxplot stats using mathematical operator

2009-10-26 Thread John Kane
Perhaps subset the data first? subset(x, x[,2] >=0) --- On Mon, 10/26/09, e-letter wrote: > From: e-letter > Subject: [R] exclude data for boxplot stats using mathematical operator > To: r-help@r-project.org > Received: Monday, October 26, 2009, 3:25 AM > Readers, > &

Re: [R] exclude data for boxplot stats using mathematical operator

2009-10-26 Thread Stephan Kolassa
Try this: boxplot.stats(x[x[,2]>0,2],do.conf=FALSE) HTH, Stephan e-letter schrieb: Readers, I have a data set as follows: 1,1 2,2 3,3 4,4 5,3 6,2 7,-10 8,-9 9,-3 10,2 11,3 12,4 13,5 14,4 15,3 16,2 17,1 I entered this data set using the command 'read.csv'. I want to exclude values fewer than

[R] exclude data for boxplot stats using mathematical operator

2009-10-26 Thread e-letter
Readers, I have a data set as follows: 1,1 2,2 3,3 4,4 5,3 6,2 7,-10 8,-9 9,-3 10,2 11,3 12,4 13,5 14,4 15,3 16,2 17,1 I entered this data set using the command 'read.csv'. I want to exclude values fewer than zero in column 2 so then I tried the following command: boxplot.stats(x[>0,2],do.conf=

Re: [R] Exclude 0 values from plot

2009-09-01 Thread swertie
Thank you it worked well -- View this message in context: http://www.nabble.com/Exclude-0-values-from-plot-tp25235290p25244045.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/ma

Re: [R] Exclude 0 values from plot

2009-09-01 Thread suzylee
test[test==0]<-NA see previous post: http://www.nabble.com/Replacing-0s-with-NA-td23995885.html#a23996183 swertie wrote: > > Hello, I have a matrix of species abundance with a lot of 0 values. I > would like to plot the species abundance vs date, but I don't want that > the 0 values appear

[R] Exclude 0 values from plot

2009-09-01 Thread swertie
Hello, I have a matrix of species abundance with a lot of 0 values. I would like to plot the species abundance vs date, but I don't want that the 0 values appear as points on my graph. Do you know how I could represent only non-0 values? Thank you very much -- View this message in context: http:

Re: [R] exclude a vector value from another vector

2008-12-02 Thread Henrique Dallazuanna
Try this: setdiff(pop, sample(pop, 2)) On Mon, Dec 1, 2008 at 5:16 PM, Hamid Hamid <[EMAIL PROTECTED]> wrote: > Dear All, > I am trying to build a program which will take repeated samples (w/o > replacement) from a population of values. The interesting catch is that I > would like the sample va

Re: [R] exclude a vector value from another vector

2008-12-02 Thread Greg Snow
uot; "Z" "I" > Now each column is a sample, us apply or a for loop to work on each one. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] 801.408.8111 > -Original Message- > From: [EMAIL

Re: [R] exclude a vector value from another vector

2008-12-01 Thread Jorge Ivan Velez
Dear Hamid, Try this: > pop<-c(1,5,14,7,9,12,18,19,65,54) > pop [1] 1 5 14 7 9 12 18 19 65 54 > spop<-sample(pop,2) > spop [1] 14 19 > newpop=pop[!pop%in%spop] > newpop [1] 1 5 7 9 12 18 65 54 See ?"%in%"" for more information. HTH, Jorge On Mon, Dec 1, 2008 at 2:16 PM, Hamid Hamid

[R] exclude a vector value from another vector

2008-12-01 Thread Hamid Hamid
Dear All, I am trying to build a program which will take repeated samples (w/o replacement) from a population of values. The interesting catch is that I would like the sample values to be removed from the population, after each sample is taken. For example: pop<-c(1,5,14,7,9,12,18,19,65,54) sa

Re: [R] Exclude holidays in a subset of dates?

2008-11-19 Thread Diethelm Wuertz
Gabor Grothendieck wrote: There are the timeDate and timeSeries packages with very powerful possibilities to handle weekdays, weekends and public holidays for the G7 countries and CH. You can create your own holiday calenders for many countries including fix and moveable holidays. Note, this

Re: [R] Exclude holidays in a subset of dates?

2008-11-19 Thread Gabor Grothendieck
chron has some facilities for this that also work with "Date" class: library(chron) startDate <- as.Date("2008-08-15") endDate <- as.Date("2008-09-15") AllDays <- seq(startDate, endDate, by="day") Holidays <- as.chron(as.Date("2008-09-01")) is.workday <- !is.holiday(AllDays, Holidays) & !is.weeken

Re: [R] Exclude holidays in a subset of dates?

2008-11-19 Thread hadley wickham
On Wed, Nov 19, 2008 at 12:54 PM, Brigid Mooney <[EMAIL PROTECTED]> wrote: > Hi All, > > I am iterating through dated materials, with variable start and end dates, > and would like to skip procedures everytime I encounter a weekend or > holiday. To do this, I thought the easiest way would be to cr

[R] Exclude holidays in a subset of dates?

2008-11-19 Thread Brigid Mooney
Hi All, I am iterating through dated materials, with variable start and end dates, and would like to skip procedures everytime I encounter a weekend or holiday. To do this, I thought the easiest way would be to create a TRUE/FALSE vector corresponding to each day where it is TRUE if a workday, an

Re: [R] Exclude rows in table

2008-10-21 Thread Philipp Pagel
On Tue, Oct 21, 2008 at 03:52:05PM +0200, Jim Gustafsson wrote: > I have the following type of table (with number of rows = 4765) and want > to exclude each row where Net=0. Could this be done in a simple way? subset(A, Net!=0) or A[A$Net!=0, ] See manual, section 2.7 cu Philipp --

Re: [R] Exclude rows in table

2008-10-21 Thread Bert Gunter
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jim Gustafsson Sent: Tuesday, October 21, 2008 6:52 AM To: [EMAIL PROTECTED] Subject: [R] Exclude rows in table Dear R-Help, I have the following type of table (with number of rows = 4765) and want to

Re: [R] Exclude rows in table

2008-10-21 Thread Peter Alspach
Tena koe Jim A[A[,'Net']!=0,] or A[!A[,'Net']%in%0,] Peter Alspach > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Jim Gustafsson > Sent: Wednesday, 22 October 2008 2:52 a.m. > To: [EMAIL PROTECTED] &

[R] Exclude rows in table

2008-10-21 Thread Jim Gustafsson
Dear R-Help, I have the following type of table (with number of rows = 4765) and want to exclude each row where Net=0. Could this be done in a simple way? Thanks in advance Jim > A Business.Unit Event1 Net Date 1General Fraud 170.000 2006-01-01 2Gen