search for: myrows

Displaying 7 results from an estimated 7 matches for "myrows".

2011 Aug 02
3
identifying weeks (dates) that certain days (dates) fall into
...k # each week starts on a Monday I also have a vector of dates I am interested in, e.g.: july4<-as.Date(c("2010-07-04","2011-07-04")) I would like to flag the weeks in my weekly$week that contain those 2 individual dates. I can only think of a very clumsy way of doing it: myrows<-c(which(weekly$week==weekly$week[weekly$week>july4[1]][1]-7), which(weekly$week==weekly$week[weekly$week>july4[2]][1]-7)) weekly$flag<-0 weekly$flag[myrows]<-1 It's clumsy - because actually, my vector of dates of interest (july4 above) is much longer. Is there maybe a more el...
2004 Nov 20
2
subset on data frame
I have a data frame. And I'd like to subset according to rownames. subset(mydataframe, rownames(mydataframe) == myrow, select = mycols) it turned out that "myrow" cannot be a vector. But I have multiple rows to pick. Is there a way to get around this problem?? Thank you for your help!! Lei Jiang Department of Chemsitry University of Washington Box 351700 Seattle, WA 98195
2013 May 15
2
R help: Batch read files based on names in a list
* I am currently reading in a series of files, applying the same functions to them one at a time, and then merging the resulting data frames e.g.: >MyRows <- c("RowA", "RowB", "RowC")>>File1_DF <- read.delim("\\\\DirectoryToFiles\\File1_Folder\\File1.txt", stringsAsFactors=FALSE, check.names=FALSE)>File1_DF <- as.data.frame(t(File1_DF[MyRows,]))>File1_DF <- as.data.frame(t(File1_DF))>...
2010 Jul 14
1
rows process in DF
I have the following datasets: id d1 d2 d3 d4 d5 d6 d7 d8 1 100 0.3 0.4 -0.2 -0.3 0.5 0.6 -0.9 -0.8 2 101 0.3 0.4 0.5 0.6 -0.2 -0.4 -0.5 -0.6 what I am trying to accomplish: loop through the rows && do the following: if the values from the columns of the current row >0 then sum_positive=total if the values from the columns of the current row <0 then
2004 Jul 29
3
Editing Strings in R
I was wondering if there is a way of editting strings in R. I have a set of strings and each set is a row of numbers and paranthesis. For example the first row is: (0 2)(3 4)(7 9)(5 9)(1 5) and I have a thousand or so such rows. I was wondering how I could get the corresponding string obtained by adding 1 to all the numbers in the string above. Dursun [[alternative HTML version deleted]]
2013 Feb 03
1
Looping through rows of all elements of a list that has variable length
Dear R-ers, I have a list of data frames such that the length of the list is unknown in advance (it could be 1 or 2 or more). Each element of the list contains a data frame. I need to loop through all rows of the list element 1 AND (if applicable) of the list element 2 etc. and do something at each iteration. I am trying to figure out how to write a code that is generic, i.e., loops through the
2008 Jun 06
6
Subsetting to unique values
I want to take the first row of each unique ID value from a data frame. For instance > ddTable <- data.frame(Id=c(1,1,2,2),name=c("Paul","Joe","Bob","Larry")) I want a dataset that is Id Name 1 Paul 2 Bob > unique(ddTable) Will give me all 4 rows, and > unique(ddTable$Id) Will give me c(1,2), but not accompanied by the name column.