similar to: question about subset

Displaying 20 results from an estimated 10000 matches similar to: "question about subset"

2005 Jun 05
3
function and apply
Dear all    I think my problem is not complicated but I'm having difficulties to solve it. v is a vector: v=c(p1 , p2 , p3 , p4), and f  is a function: f : v -> w , where w=c(p1 , p2*(1-p1) , p3*(1-p2)*(1-p1) , p4*(1-p3)*(1-p2)*(1-p1))   I write the function f as: f<- function(w,x,y,z) {c(w,x*(1-w),y*(1-x)*(1-w),z*(1-y)*(1-x)*(1-w))} f(a,b,c,d) it
2010 Aug 04
3
split / lapply over multiple columns
Hi all, I have a data frame with column over which I would like to run repeated functions for data analysis. Currently I am only running recursively over two columns where I column 1 has two states over which I split and column two has 3 states. The function therefore runs 2 x 3 = 6 times as shown when running the following code: mydata <- data.frame(userid = c(5, 6, 5, 6, 5, 6), taskid =
2009 Feb 11
1
Variables captured in closures get copied?
Hi list! I have a data frame called fix and a list of index vectors called rois: > head(rois, 3) [[1]] [1] 2 1 [[2]] [1] 3 [[3]] [1] 6 7 28 26 27 24 25 The part that's causing the issue is the following line: lapply(rois, function(roi) fix$x[roi] <- 100) So for every index vector I'd like to set the respective entries in the data frame (fix) to 100. I
2001 Dec 03
1
fitting models with the subset argument
Hi all, I'd like to fit model where the terms both are in the data.frame, mydata say, and are vectors *not in the data.frame*. >obj<-glm(y~x, data=mydata) #works >Z<-pmax(mydata$x-20,0) >(length(Z)==length(obj$y)) >[1] TRUE >update(obj,.~.+Z) #works However for some subset it doesn't works: >obj<-glm(y~x, data=mydata, subset=f==1) #works
2008 May 16
1
xyplot: subscripts, groups and subset
I have stumbled across something in the Lattice package that is vexing me. Consider the code below: __________________________________________________________ library(lattice) myData <- expand.grid(sub = factor(1:16), time = 1:10) myData$observed <- rnorm(nrow(myData)) myData$fitted <- with(myData, ave(observed, sub, FUN = mean)) myData$event.time <- with(myData, ave(observed, sub,
2017 Nov 29
3
Removing a data subset
Say I have a dataset that looks like Location Year GW_Elv MW01 1999 546.63 MW02 1999 474.21 MW03 1999 471.94 MW04 1999 466.80 MW01 2000 545.90 MW02 2000 546.10 The whole dataset is at http://doylesdartden.com/ExampleData.csv and I use the code below to do the graph but I want to do it without MW01. How can I
2007 Aug 26
3
subset using noncontiguous variables by name (not index)
Hi All, I'm using the subset function to select a list of variables, some of which are contiguous in the data frame, and others of which are not. It works fine when I use the form: subset(mydata,select=c(x1,x3:x5,x7) ) In reality, my list is far more complex. So I would like to store it in a variable to substitute in for c(x1,x3:x5,x7) but cannot get it to work. That use of the c function
2017 Nov 29
0
Removing a data subset
Reading in the data from the file x <- read.csv( "ExampleData.csv", header = TRUE, stringsAsFactors = FALSE ) Subsetting as you want x <- x[ x$Location != "MW01", ] This selects all rows where the value in column 'Location' is not equal to "MW01". The comma after that ensures that all columns are copied into the amended data.frame. Rgds,
2008 Jun 18
1
Custom strips in lattice
I've recently been playing with strip functions for a data presentation I'd like to use, and have a couple questions. I've cannibalised the useOuterStrips function from latticeExtra to give me the following sample code: library(lattice) myData <- expand.grid( type = c('First 3 days','Whole profile'), sub = paste('Subject', 1:3,
2007 Mar 27
1
"Couldn't load variables.txt?aldope=xxxxx "
HI!!!Sorry this post about FOP but it's important. Ive installed asterisk and freepbx. the interface of FreePBX works fine, but when i acesse FOP (Flash Operator Panel) i get this error: "Couldn't load variables.txt?aldope=xxxxx " I search in the google and see a sugestion to edit line flash_dir=/var/www/html/panel/flash in file op_server.cfg. Any Sugestion please? --
2010 Sep 07
1
average columns of data frame corresponding to replicates
Hi Group, I have a data frame below. Within this data frame there are samples (columns) that are measured more than once. Samples are indicated by "idx". So "id1" is present in columns 1, 3, and 5. Not every id is repeated. I would like to create a new data frame so that the repeated ids are averaged. For example, in the new data frame, columns 1, 3, and 5 of the original
2004 Oct 01
5
Traffic Balance
Hi list, I have to configure a internet server with linux. I need configure traffic balance between dsl and cable connection. Somobody sugestion some solution? Thanks Rafael de Souza _______________________________________________ LARTC mailing list / LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
2012 Feb 09
1
subset select="variable with a list of names"
Hello, I would like to make a function which extracts a subset, from a dataset, with only the columns that I want (specifying their names). For example, having this matrix: > mydata<-matrix(c(22,1,3,2001,24,5,7,2002,26,7,8,2002,28,5,7,2003), byrow=TRUE, ncol=4, dimnames=list(c(1,2,3,4), c("age","day","month","year"))) > mydata age day
2011 May 27
1
Subset command and the : operator
Hello- I have some code that looks like this: with(mydatalocal, sum(table(Service[Time==5:8]))) This is designed to add up the numbers of responses between the Time codes 5 to 8 (which are integers and refer to quarters). Service is just one of the variables, I'm just trying to count the number of responses so I picked any of the variables. However, there is something wrong, it returns far
2016 Apr 16
3
a replace for subset
Hi, I have a data set (mydata), which a part of this is like the following: 'data.frame': 36190 obs. of 16 variables: $ RE : int 38 41 11 67 30 18 38 41 41 30 ... $ LU : int 4200 3330 530 4500 3000 1790 4700 3400 3640 4000 ... $ COUNTRY : Factor w/ 4 levels "DE","FR","JP", "FR"? $Light
2007 Oct 01
3
mean of subset of rows
Dear list, this must be an easy one: I have a data.frame of two columns, "ID" with four different levels (A to D) and numerical "size", and each of the 4 different IDs is repeated a different number of times. I would like to get the mean size for each ID as another data.frame. I have tried the following: >ID= as.character(unique(data[,1])) # I use unique() because
2006 Feb 08
6
dataframe subset
I have a dataframe with a column, say "x" consisting of values, each value appearing different times, e.g. x: 1,1,1,1,2,2,4,4,4,9,10,10,10,10,10 ... and a vector, including e.g.: y: 2,9,10,... I need a subset of the dataframe: all rows where x is equal to one of the values in y. Currently I use a loop for this, but because x and y are large this is very slow. Is there any idea how to
2004 Jan 05
1
lda() called with data=subset() command
Hi I have a data.frame with a grouping variable having the levels C, mild AD, mod AD, O and S since I want to compute a lda only for the two groups 'C' and 'mod AD' I call lda with data=subset(mydata.pca,GROUP == 'mod AD' | GROUP == 'C') my.lda <- lda(GROUP ~ Comp.1 + Comp.2 + Comp.3 + Comp.4+ Comp.5 + Comp.6 + Comp.7 + Comp.8 ,
2023 Jan 15
2
Removing variables from data frame with a wile card
I am new to this thread. At the risk of presenting something that has been shown before, below I demonstrate how a column in a data frame can be dropped using a wild card, i.e. a column whose name starts with "th" using nothing more than base r functions and base R syntax. While additions to R such as tidyverse can be very helpful, many things that they do can be accomplished simply
2006 Feb 10
3
Using two select elements (master - slave)
Hi, I am looking for an opinion. I need to have two select html elements in a form, the selection of the first element will determine the elements of the second select. I do not want to use AJAX, so I think I would like to add a onchange event in the first select, but due to my lack of experience in rails I am somewhat without ideas on the way of handling this "post back" event. Thank