similar to: row-wise conditional update in dataframe

Displaying 20 results from an estimated 300 matches similar to: "row-wise conditional update in dataframe"

2010 Feb 25
3
variable substitution in for loops
Friends I can't quite find a direct answer to this question from the lists, so here goes: I have several dataframes, 200+ columns 2000+ rows. I wish to script some operations to perform on some of the variables (columns) in the data frames not knowing what the column number is, hence have to refer by name. I have variable names in a text file "varlist". So, something like this:
2010 Jun 09
1
generate list of variable names
Hi! Would anyone know how to generate a list of variable names from a data frame by the class of the variable? I have large tables with different numbers of columns and am trying to script some rote analyses. There are several categorizing variables (factors) and many response variables (integers and numeric). I want to extract a list of classifier column names in one list and response variable
2010 Feb 18
1
variable substitution
Hi I would like to write a script that reads a list of variable names. These variable names are some of the column headers in a data.frame. Then I want do a for-loop to execute various operations on the specified variables in the data.frame, but can't figure out how to do the necessary variable substitution. In bash (or C) I would use "$var", but there seems to be no equivalent in
2010 Dec 09
4
lapply getting names of the list
Hello All, I have a toy dataframe like this. It has 8 columns separated by tab. Name SampleID Al1 Al2 X Y R Th rs191191 A1 A B 0.999 0.09 0.78 0.090 abc928291 A1 B J 0.3838 0.3839 0.028 0.888 abcnab A1 H K 0.3939 0.939 0.3939 0.77 rx82922 B1 J K 0.3838 0.393
2009 Mar 06
1
array subsetting of S4 object that inherits from "array"
Hi, I have an S4 class that inherits from "array" but does not add generic implementations of the "[" method. A simplified example is: setClass("fooarray", contains="array") If I create a "fooarray" object and subset it with a one-dimensional index vector, the return value is of class "fooarray". Other variants (see below), however,
2010 Dec 09
1
set dataframe field value from lookup table
Hi This is (hopefully) a bit more cogent phrasing of a previous post. I'm trying to compute a z-score to rows in a large dataframe based on values in another dataframe. Here's the script (that does not work). 2 questons, 1) Anyone know of a more elegant way to calculate the "rounded" age value than the nested ifelse's I've used? 2) how to reference the lookup table
2012 Jun 05
1
preserving date formats in functions
Hi there! I have two date columns in a dataframe I need to selectively collapse based on missing values and which date comes first (imported from an text file). This is what I did: RHSSP$CT <- as.POSIXct(RHSSP$CT, format='%m/%d/%y %H:%M') RHSSP$MRI <- as.POSIXct(RHSSP$MRI, format='%m/%d/%y %H:%M') RHSSP$Scan <-
2006 Dec 13
0
A word about bridgeing to the wise...
I have seen and responded to many different bridging related firewalling questions as of late. There seems to be a common assumption that IPTables does not and / or can not see bridged traffic. This is not the case. If you enable the "Bridged IP/ARP packets filtering" (CONFIG_BRIDGE_NETFILTER) option IPTables can see and act on bridged traffic. If this is turned on and you have
2007 Apr 09
1
Date Wise Recordings
Hi, I like my recordings to go to date wise folder i mean to say that for example today is 20070409 so all recordings should go directly to that folder instead of one folder for whole month. and then next day's recordings should go to next date folder. so how can i do that my current monitor context is like... exten => _1NXXNXXXXXX,3,Monitor(gsm,/rec/asterisk/apr07/${CALLFILENAME},mb)
2012 Nov 15
1
Step-wise method for large dimension
Hi , I want to apply the following code fo my data with 400 predictors. I was wondering if there ia an alternative way instead of typing 400 predictors for the following code. I really appreciate your help. fit0<-lm(Y~1, data= mydata) fit.final<- lm(Y~X1+X2+X3+.....+X400, data=mydata) ??? step(fit0, scope=list(lower=fit0, upper=fit.final), data=mydata, direction="forward")
2005 Dec 01
1
Row wise function call.
I have another issue.i have a function which calculates the log2(col i /col2) value, where i stands for columns 3,4,...etc. data<-read.table("table.txt", header=TRUE) iratio<-function(x){ for(n in 3:ncol(data)){ z<-log2(data[x,n]/data[x,2]) } } Where x- the row number of the data frame(data). i want to store the ratios for each row in a object z, which can be accessed
2003 Jul 01
0
Step - wise
Madame , Monsieur, J'aimerais utiliser la fonction step dans une boucle "for" pour pouvoir prédire des valeurs (à chaque pas) suivant le modèle proposé par step. Est-il possible de le faire ? Merci d'avance, Cordialement Athanasia
2010 Dec 22
1
Wise selecting of outgoing channel
Hi. We have 3 channel for _outgoing_ calls and would like to use them equally (by turn). Is there any 'queue' for outgoing calls? Now I have to select the second channel manually when the first is busy and so on. Does Asterisk have any functionality to do it automatically?
2010 Jul 24
1
really removing klipper - script wise
Hi all, Is there a way to automate the removal of Klipper? It fouls up one of our major applications. Thanks in advance.
2014 Dec 31
1
Unexpected behavior of debug() in step-wise mode
Why does debug() enter Browse[3] here at all, and why does it happen the first time and not the second? This seems unexpected to me, and has undesirable effects for ESS users (that I reported here - https://stat.ethz.ch/pipermail/ess-help/2013-June/009154.html - but just realized my post to r-devel didn't make it through when I tried to report it back then). > Fun <- function(n)
2003 Jul 01
1
step-wise and prediction
I would like to know how to use the function step with "for" in order to predict. Id est: Let M , A, B ,C be vectors of length 15 for(i in 1:5) { regrM<-lm(M[(1+i):(10+i)]~A[(1+i):(10+i)]+B[(1+i):(10+i)]+C[(1+i): (10+i)]) sregrM<-step(regrM) and then I would like to compute the predicted value : M* of M, using the predictors selected by the function step. For example if i=1
2005 Jun 24
1
"Error in contrasts" in step wise regression
Hi, I have a problem in getting step function work. I am getting the following error: > fit1 <- lm(Response~1) > fmla <- as.formula(paste(" ~ ",paste(colnames,collapse="+"))) > sfit <- step(fit1,scope=list(upper= fmla,lower= ~1),k=log(nrow(dat))) Start: AIC= -1646.66 Response ~ 1 Error in "contrasts<-"(`*tmp*`, value =
2007 May 30
0
manova permutations and pair-wise contrasts
Hi, I have a function for doing permutation tests for Manovas, written with the help of folks here on the list. It seems to work ok, and I've found that there is indeed a significant difference among groups in my analysis. I want to follow up on this by testing for which pairs of groups are significantly different. Reasoning that since Wilks Lambda is a generalization of the Hotelling T test,
2009 Oct 30
2
data.frame extracting data row-wise
Dear All, I am struggling with extracting data from a data frame: x=data.frame(a=1:11,b=100:110) What I want is a list/vector in this sence: 1 100 2 101 3 102... For single rows, this works fine: as.matrix(x)[1,] For, say 2 rows, this works fine: z=c(as.matrix(x)[1,],as.matrix(x)[2,]) But z=c(as.matrix(x)[1:2,]) gives 1 2 100 101!? Is there an 'automated way' to produce a
2009 Nov 18
1
row-wise means
I have a dataframe with 3 columns. The first column stores an index. I would like to calculate the mean of the numbers stored in each of the rest of the columns. So, here is my data matrix: col1 col2 col3 1 23 34 2 45 56 3 23 56 4 34 68 For each row I would like to calculate the means of the numbers stored in col2 and col3. How can this be done in R? TIA, Anjan -- =============================