similar to: Calling on certina columns

Displaying 20 results from an estimated 20000 matches similar to: "Calling on certina columns"

2010 Jul 20
2
Means from selected columns in a data frame
Hi all, I have a dataframe with survey data. Now I want to calculate means from several but not all columns (e.g. a1, a2, a3) and save them in a new separate column (e.g. a). Like: a = mean(a1, a2, a3) Can someone help me or give me the right key word to look for? Thanks [[alternative HTML version deleted]]
2012 Jun 01
4
Adding a column into the file
Dear all, I have a lot of problems on R-programming. for example my csv. file is .. Date wrfRH wrfsolar wrfwindspeed wrfrain wrftd wrfta 21/10/2010 92.97 22.11 53.27 0 1546.337861 61.00852664 22/10/2010 87.35 21.99 40.89 0 1300.408288 62.85352227 23/10/2010 88.38 21.71 28.04 0.01 1381.768284 54.80594493 24/10/2010 92.32 15.45 22.38 0.51 1113.90981 39.46573663 25/10/2010 93.42
2011 Jan 31
2
From data frame to list object
Dear all, let say I have following data frame: > data.frame(x=rnorm(18), y=rep(c("a", "b", "c"), each=6)) x y 1 -1.072152537 a 2 0.382985265 a 3 0.058877377 a 4 -0.006911939 a 5 -2.355269051 a 6 -0.303095553 a 7 0.484038422 b 8 0.733928931 b 9 -1.136014346 b 10 0.503552090 b 11 1.708609658 b 12 -0.294599403 b 13
2011 Feb 21
1
How to delete rows with specific values on all columns (variables)?
Hi, I need to filter my data: I think its easy but i'm stuck so i'll appreciate some help: I have a data frame with 14 variables and 6 million rows. About half of this rows have a value of "0" in 12 variables (the other two variables always have values). How can I delete the rows in which all 12 variables have the value of "0". example (from my data, variable 14 is
2011 Jul 15
3
summarized data set - how to use an "occurs" field
I have a data set with 22 fields and several thousand records in which one field (count) indicates the number of times that each specific combination of the other 21 fields occurred in a bigger and largely unavailable data set. So each record is unique in its combination of field values and has a field that identifies how many multiples of this record actually occurred. Without resorting to
2011 Jul 01
4
Access only part of last dimension of table/matrix
I would like to do some operations inside a function using only one value for the last dimension of a table/matrix: tabfn <- function (dfrm, facvec, YN ="event"){ return( Etbl <- do.call(table, dfrm[ , c(facvec, "event") ]) ) # just want Etbl[,,,"TRUE"] or Etbl[,, "TRUE"] or Etbl[,"TRUE"] }
2011 May 16
2
conditional rowsums in sapply
Hi all I have a data frame with duplicate columns and i want to remove duplicates by adding rows in each group of duplicates, but have lots of NA's. Data: dfrm <- data.frame(a = 1:4, b= 1:4, cc= 1:4, dd=1:10, ee=1:4) names(dfrm) <- c("a", "a", "b", "b", "b") dfrm[3,2:3]<-NA dfrm a a b b b 1 1 1 1 1 1 2 2 2 2 2 2 3
2011 Jan 31
2
Missing at random
R users: Thanks in advance  How to generate missing at random (MAR)? assaedi76@yahoo.com Thanks [[alternative HTML version deleted]]
2012 Mar 18
3
Extracting numbers from a character variable of different types
Hello, I have a file which contains a column with age, which is represented in the two following patterns 1. "007/A" or ''007/a" or ''7 /a" ..... In this case A or a means year and I would like to extract only the numeric values eg 7 in the above case if this pattern exits in a line of file. 2. "004/M" or "004/m" where M or m means month
2011 Mar 12
2
Merge data under conditions
Dear All, Debuting in R, I'm facing a problem. I have 2 vectors, say 'a' et 'b', and I'd like to merge them according to the proximity of their variable 'time'. How to do to keep elements which satisfy (for example) 'a$time-b$time<0.5'? For example : > a time x 1 1.0 4 2 2.2 5 3 5.2 6 > b time y 1 0 1 2 1 3 3 2 5 4 4 7 5
2010 Mar 16
2
Conditional variable assignment
Hi everyone, Once again I am stuck with a problem I can't seem to figure out. I suppose this learning curve levels off eventually, lol. I am learning on my own with absolutely no background in programming, so if I seem to request help a lot it's not because I am seeking others to do the work for me. I need to assign one of two arrival times to the 'ARRIVE' variable of my
2012 May 16
2
Splus equivalent of reshape in R
Hello R/Splus users.. I am posting in R discussion group in hope of wider response compared to what I received from Splus user groups.... Was wondering if there is any function available in Splus 8.2 that is equivalent to "reshape" of R? Below is a sample dataset. Size [both rows and columns) of the dataset may vary X1 Y1 Y2 Y3 0.25 40 38 22 0.5 44 41
2012 Feb 15
2
Splitting a data list into smaller data lists
Hi, I am new at R and have been looking for a guide on how to do this with no avail. I have a data set similar to this: X Y 1 2 3 3 4 9 2 4 6 3 9 1 1 7 0 2 5 6 3 8 and I need it to be split into something like this: X Y 1 2 3 3 4 9 2 4 6 3 X Y 9 1 1 7 0 2 5 6 3 8 I am thinking I need to write a loop because my data set is much larger than this
2011 Sep 02
2
conditional replacement of character strings in vectors
Hello, I have a dataframe that looks like this: a b NA Honduras China NA NA Sudan Japan NA NA Mexico NA Mexico I would like to replace the NA values in column b with the non-NA values in column a. I have tried a number of techniques, (if, ifelse) but I must have the logic wrong. Thanks -- Josh [[alternative HTML version deleted]]
2010 Mar 19
1
How to plot two cumulative frequency graph together
Dear masters, I have data that looks like this: #val Freq1 Freq2 0.000 178 202 0.001 4611 5300 0.002 99 112 0.003 26 30 0.004 17 20 0.005 15 20 0.006 11 14 0.007 11 13 0.008 13 13 ...many more lines.. Full data can be found here: http://dpaste.com/173536/plain/ What I intend to do is to have a cumulative graph with "val" as x-axis with "Freq1" & "Freq2" as
2010 Nov 13
1
Define a glm object with user-defined coefficients (logistic regression, family="binomial")
Hi there, I just don't find the solution on the following problem. :( Suppose I have a dataframe with two predictor variables (x1,x2) and one depend binary variable (y). How is it possible to define a glm object (family="binomial") with a user defined logistic function like p(y) = exp(a + c1*x1 + c2*x2) where c1,c2 are the coefficents which I define. So I would like to do no
2010 May 12
2
sorting rows of dataframe
Hello: I have a dataframe, where the first column in a month: Month CATCHMENT_ med min max 1 Apr Alknda01 71.68080 11.9406600 196.2753 2 Apr Alknda02 69.44580 12.1065600 196.2753 3 Apr ArialKhan 39.89310 5.8598700 175.4433 4 Apr Arjun01 4.79652 0.0093336 55.7136 5 Apr Arjun02 4.79652 0.0093336 55.7136 6 Apr Arun01 52.42320 0.1571928
2010 Sep 01
3
standardize columns selectively within a dataframe
Dear all, I have a dataframe: df<-dataframe(a=c(1,2,3),b=c(4,5,6),c=c(7,8,9),d=c(10,11,12)) I want to obtain a new dataframe with columns a and b being standardized ((x-mean(x))/sd(x)); the other two columns (c,d) I want to leave unchanged. What is the best way to achieve this? I have been trying to use subscripts but did not succeed so far. Any tips? Many thanks, Olga
2011 Jan 06
1
need help for chi-squared test
I've got a dataset which looks like this in the beginning: cbr dust smoking expo 1 0 0.20 1 5 2 0 0.25 1 4 3 0 0.25 1 8 4 0 0.25 1 4 5 0 0.25 1 4 (till no. 1240, anyway, a huge set) I have to analyse cbr and smoking, I know it works with chisq.test() for the whole set, but I only need cbr and smoking, and I
2011 Aug 03
4
Convert matrix to numeric
I have a matrix that looks like this: structure(c("0.0376673981759913", "0.111066500741386", "1", "1103", "18", "OPEN", "DEPR", "0.0404073656092023", "0.115186044704599", "1", "719", "18", "OPEN", "DEPR", "0.0665342096693433",