similar to: help need on working in subset within a dataframe

Displaying 20 results from an estimated 70 matches similar to: "help need on working in subset within a dataframe"

2018 May 26
3
Grouping by 3 variable and renaming groups
ALCON I'm trying to figure out how to rename groups in a data frame after groups by selected variabels. I am using the dplyr library to group my data by 3 variables as follows # group by lat (StoreX)/long (StoreY) priceStore <- LapTopSales[,c(4,5,15,16)] priceStore <- priceStore[complete.cases(priceStore), ] # keep only non NA records priceStore_Grps <- priceStore %>%
2018 May 26
0
Grouping by 3 variable and renaming groups
Hello, See if this is it: priceStore_Grps$StoreID <- paste("Store", seq_len(nrow(priceStore_Grps)), sep = "_") Hope this helps, Rui Barradas On 5/26/2018 2:03 PM, Jeff Reichman wrote: > ALCON > > > > I'm trying to figure out how to rename groups in a data frame after groups > by selected variabels. I am using the dplyr library to group my
2011 Dec 14
1
Hi
First PRoblem solved > read.csv("KT80.csv") X x 1 1 0.01331361 > I ommitt "" in calling the file name... 2011/12/14 Trying To learn again <tryingtolearnagain@gmail.com> > Hi all, > > I have 100 csv files always with this information (I Attach two example > excels) > > KT80.csv contains: > ,"x" >
2018 May 26
1
Grouping by 3 variable and renaming groups
Hello, Sorry, but I think my first answer is wrong. You probably want something along the lines of sp <- split(priceStore_Grps, priceStore_Grps$StorePC) res <- lapply(seq_along(sp), function(i){ sp[[i]]$StoreID <- paste("Store", i, sep = "_") sp[[i]] }) res <- do.call(rbind, res) row.names(res) <- NULL Hope this helps, Rui Barradas On 5/26/2018
2003 Nov 19
1
heap error while trying to run TrueSync Dekstop
Hello, I'm trying to run the "TrueSync Desktop" app (the equivalent of Hotsync for non-Palm handhelds, but without any Linux port, unfortunately), and I get the following error: err:heap:HEAP_ValidateInUseArena Heap 40360000: in-use arena 403e7eb8 next block has PREV_FREE flag wine: Unhandled exception (thread 0009), starting debugger... The loading screen "TrueSync
2005 Jun 09
1
krig.image help
> -----Original Message----- > From: r-help-bounces at stat.math.ethz.ch > [mailto:r-help-bounces at stat.math.ethz.ch]On Behalf Of Mike J Smith > Sent: 09 June 2005 09:58 > To: r-help at stat.math.ethz.ch > Subject: [R] krig.image help > > > Hi > > I have recently been experimenting with the use of kriging, primarily > through Goldensoftware's Surfer.
2012 Oct 09
1
other way of making a table?
I'm making tables for prediction results of classifiers (2 classes) that show the usual numbers, true positives, false positives, etc I used the command table(predictedLabels,realLabels) to make those. I just had a case though ,where one of the label vectors had only one class in it. This will result in only half a table. Compare: x<-c(1,1,1,0,0) y<-c(1,1,1,0,1) table(x,y) to
2009 Jun 20
1
how to apply the dummy coding rule in a dataframe with complete factor levels to another dataframe with incomplete factor levels?
Dear R helpers: Sorry to bother for a basic question about model.matrix. Basically, I want to apply the dummy coding rule in a dataframe with complete factor levels to another dataframe with incomplete factor levels. I used model.matrix, but could not get what I want. The following is an example. #Suppose I have two dataframe A and B
2010 Jul 13
2
Checking for duplicate rows in data frame efficiently
I wrote something to check for duplicate rows in a data frame, but it is too inefficient. Is there a way to do this without the nested loops? This code correctly indicates rows 1-7, 1-8, 2-9 and 7-8 are duplicates. > m <- matrix(c(1,1,1,1,1, 2,2,2,2,2, 6,6,6,6,6, 3,3,3,3,3, 4,4,4,4,4, 5,5,5,5,5, 1,1,1,1,1, 1,1,1,1,1, 2,2,2,2,2, 7,7,7,7,7), ncol=5, byrow=TRUE) > df <- data.frame(m)
2012 Jan 20
4
extract fixed width fields from a string
Hi, I have a data frame with one column containing string of the form "ABC...|XYZ..." where ABC etc are fields of 6 alphanumeric characters each and XYZ etc are fields of 8 alphanumeric characters each; "|" is a mandatory separator; I do not know in advance how many fields of each kind will each row contain. I need to extract these fields from the string. === How do I do that?
2008 Jul 24
2
What is wrong with this contrast matrix?
Dear all, I am fitting a multivariate linear model with 7 response variables and 1 explanatory variable. The following matrix P: P <- cbind( c(1,-1,0,0,0,0,0), c(2,2,2,2,2,-5,-5), c(1,0,0,-1,0,0,0), c(-2,-2,0,-2,2,2,2), c(-2,1,0,1,0,0,0), c(0,-1,0,1,0,0,0)) should consist of orthogonal elements (as can be shown using %*% on the individual columns). However, when I use
2005 May 31
1
GLM question
I am unfamiliar with R and I’m trying to do few statistical things like GLM and GAM with it. I hope my following questions will be clear enough: My datas ( y(i,j ))are run off triangles for example : J=1 J=2 J=3 I=1 1 2 3 I=2 4 5 I=3 6 My model is : E[y(i,j)] =m(i,j) Var[y(i,j)] =constant *m(i,j) Log(m(i,j)) = eta (i,j) eta (i,j) = c + alpha(i)
2005 Apr 13
1
logistic regression weights problem
Hi All, I have a problem with weighted logistic regression. I have a number of SNPs and a case/control scenario, but not all genotypes are as "guaranteed" as others, so I am using weights to downsample the importance of individuals whose genotype has been heavily "inferred". My data is quite big, but with a dummy example: > status <- c(1,1,1,0,0) > SNPs <-
2008 Jun 21
2
Generating groupings of ordered observations
Dear List, I have a problem I'm finding it difficult to make headway with. Say I have 6 ordered observations, and I want to find all combinations of splitting these 6 ordered observations in g groups, where g = 1, ..., 6. Groups can only be formed by adjacent observations, so observations 1 and 4 can't be in a group on their own, only if 1,2,3&4 are all in the group. For example,
2004 Apr 02
1
which on array
Good morning ! Today I found a strange, for my poor knowledge of R, behaviour of 'which' on a matrix: HAL9000> str(cluster.matrix) num [1:227, 1:6300] 2 2 2 2 2 2 2 2 2 2 ... HAL9000> class(cluster.matrix) [1] "matrix" HAL9000> ase <- cluster.matrix[1:5,1:5] HAL9000> ase [,1] [,2] [,3] [,4] [,5] [1,] 2 2 2 0 -2 [2,] 2 2 2 0 -2 [3,]
2007 Oct 05
1
creating objects of class "xtabs" "table" in R
I have an application that would generate a cross-tabulation in array format in R. In particular, my application would give me a result similar to that of : array(5,c(2,2,2,2,2)) The above could be seen as a cross-tabulation of 5 variables with 2 levels each (could be 0 and 1). In this case, the data were such that each cell has exactly 5 observations. I Now, I want the output to look like the
2006 Apr 02
3
speeding up a recursive function
Hi All, is there any general advice about speeding up recursive functions (not mentioning 'don't use them')? Regards, Federico Calboli -- Federico C. F. Calboli Department of Epidemiology and Public Health Imperial College, St. Mary's Campus Norfolk Place, London W2 1PG Tel +44 (0)20 75941602 Fax +44 (0)20 75943193 f.calboli [.a.t] imperial.ac.uk f.calboli [.a.t]
2004 Jan 04
1
array problem
Dear all, I define , for n=5 or any integer greater than 0. A<-array((1/2)^n , c(rep(2,n))) then for any i not equal to j, and 1<=i,j<=n, B<-apply(a,c(i,j),sum) now B is a 2 by 2 matrix, I also define another costant 2 by 2 matrix G, How can I change the values of each elements of array A, according the rule that, for example, i=3,j=5,
2011 May 04
2
first occurrence of a value?
Hello, A simple question perhaps, but how do I, within each row, find the first occurence of the number 1 in the df below? I want to use this position to programmatically create the variable 'year'. I'v come up with a solution, but I find it downright ugly. Is there a simpler way? I was hoping for a useful built-in function that I don;t yet know about. df <-
2009 Jan 13
2
NA-values and logical operation
Dear list, as a result of a logical operation I want to assign a new variable to a DF with NA-values. z <- data.frame( x = c(5,6,5,NA,7,5,4,NA), y = c(1,2,2,2,2,2,2,2) ) p <- (z$x <= 5) & (z$y == 1) p z[p, "p1"] <-5 z # ok, this works fine z <- z[,-3] p <- (z$x <= 5) & (z$y == 2) p z[p, "p2"] <-5 z # this failed... - how