similar to: Use or ??

Displaying 20 results from an estimated 10000 matches similar to: "Use or ??"

2012 Aug 31
7
splits with 0s in middle columns
Hi, A column of my df looks like A 10/20/30 40/20 60/10/10/5 80/10 I want to split it such that the last column has the last composition and if there are not enough the middle columns get the 0s. That way my df would look like A1 A2 A3 A4 10 20 0 30 40 0 0 20 60 10 10 5 80 0 0 10 How can I do that ?? [[alternative HTML version deleted]]
2012 Aug 27
6
find and replace
I have 5 (A,B,C,D,E) columns in my dataframe. I want to replace all "x" with "y" and all "a" with "b" within these 5 columns. Can I do it in one step? Thanks [[alternative HTML version deleted]]
2012 Aug 16
8
How to extract from a column in a table?
Hi, I have a table in which one column has the name of the objects as shown below. Name Budlamp-Woodcutter Complex - 15 to 60% slope (60/25/15) Budlamp-Woodcutter Complex - 15 to 60% slope (60/25/15) Terrarossa-Blacktail-Pyeatt Complex - 1 to 40% slope (40/35/15/10) Terrarossa-Blacktail-Pyeatt Complex - 1 to 40% slope (40/35/15/10) How can I split the single column into three columns
2012 Aug 28
7
check and verify
Hi, I have 6 columns in my dataframe (test) A B C D E F a b c d 40 30 a f a b 20 10 x m y m 50 30 If character value in column A matches with that in column C, it gets the percentage in column E, similarly if value in column B matches the value in D, it gets the percentage in F column. If it doesn't match, it gets 0 percentage. How can I do that ? thanks [[alternative HTML version
2012 Aug 20
7
relating data in two data frames
Hi, My data.frame "A" has FID like this FID a a b b b c c d d d d Now my second data.frame "B" has age value for a, b, c, d like FID Age a      5 b      7 c      9 d      3 How can search for the Age column in "B" and replace the values in "A" so that my new "A" looks like this FID Age a      5 a      5 b      7 b      7 b      7
2012 Oct 02
2
add values in one column getting range from other column
Hi, My dataframe has two columns one with area and other with percent. How can i add the areas that are within a range of percentage?? My dataframe looks like Area Percent 456       0 3400      10 79          25 56           18 467         0 67          67 839        85 1120      0 3482      85 I want to add the area for values whose percent is <0, 0-25, 25-50, 50-75, >75. How
2012 Aug 27
4
?nchar ?strsplit
Hi, my data frame is x<-data.frame(ID=c("abc/def","abc/def/ghi","abc","mno/pqr/st/ab")) I want to split my column ID using "/" as the place to split. How can I do that without telling the code how many sub-columns. I could use nchar(gsub("[^/]","",x$ID)) to get how many "/" are in each row of the column, but could
2013 May 13
2
reduce three columns to one with the colnames
Ein eingebundener Text mit undefiniertem Zeichensatz wurde abgetrennt. Name: nicht verf?gbar URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130513/fe848ce7/attachment.pl>
2012 Aug 13
4
if else elseif for data frames
Hi all, It seems like I cannot use normal 'if' for data frames. What would be the best way to do the following. if data$col1='high' data$col2='H' else if data$col1='Neutral' data$col2='N' else if data$col='low' data$col2='L' else #chuch a warning? Note that col2 was not an existing column and was newly assigned for this
2013 Jun 18
1
transform 3 numeric vectors empty of 0/1
Dear all, Without a loop, I would like transform 3 numeric vectors empty of 0/1 of same length Vec1 : transform 1 to A and 0 to "" Vec2 : transform 1 to B and 0 to "" Vec3 : transform 1 to C and 0 to "" to obtain only 1 vector Vec who is the paste of the 3 vectors (Ex : ABC, BC, AC, AB,...) Any idea ? Thank you for your help -- Michel ARNAUD
2012 Aug 30
4
Leading plus in numeric fields
Hello R experts, I have go this data frame: 'data.frame': 1 obs. of 20 variables: $ Anno : chr "PREVISIONI VS TARGET" $ OreTot: num 41 $ GioTot: logi NA $ OrGTot: logi NA $ OreCli: num 99 $ GioCli: logi NA $ OrGCli: logi NA $ OreFor: num -27 $ GioFor: logi NA $ OrGFor: logi NA $ OreOrt: num -18 $ GioOrt: logi NA $ OrGOrt: logi NA $ OreSpo: num -6 $ GioSpo: logi
2013 May 07
4
how to calculate the mean in a period of time?
Hi, Your question is still not clear. May be this helps: dat2<- read.table(text=" patient_id????? t???????? scores 1????????????????????? 0??????????????? 1.6 1????????????????????? 1??????????????? 2.6 1????????????????????? 2???????????????? 2.2 1????????????????????? 3???????????????? 1.8 2????????????????????? 0????????????????? 2.3 2?????????????????????? 2???????????????? 2.5
2012 Jun 11
2
replacing values of matrix with random values of another dataframe
Hello, I'm having trouble performing a certain function within R and I was hoping someone might be able to help. I have a matrix (1000x21) that contains whole-number values ranging from 1-7 and I want to replace all entries within this matrix that have a value of 1 with a random number contained within a different dataframe that has 21 rows,1000 columns. I've tried using the if/else
2013 Jan 22
3
How to align group based on the common values of two columns in r
HI, I met this problem: I have the feature data frame: Feature OS 4 2 4 1 4 3 1 2 4 1 what I want to do is to autimatically create one more column called "group": Feature OS Group 4 2 1 4 1 2 4 3
2011 Aug 05
1
If find x, then y, else do nothing
I want to write code that says "If you find an element equal to 4 in this vector for each person in the data set tested separately, then put in 1 for 2 and 2 for 4, else leave the variable as is" u.ppl <- (unique(init.dat1$grid)) l.ppl <- length(u.ppl) for (i in 1:l.ppl) { if (grep("4",init.dat1$Slide1_RESP)) {2 == 1, 4 == 2}; else
2012 Jul 13
3
Column create and Update using function
Hi, here i have a Max and Min values Min <-3 Max <-6 and also a matrix like this, ABC XYZ PQR ------ ------- ------- 2 4 3 5 4 8 7 1 3 In this i need to check each particular column values are between Max and Min value. If the coulmn value not coming between Max and
2013 Feb 07
4
why "object 'x' not found"?
Dear Listers, I try to change the structure of my data. i have an indicator-matrix and want to end up with a factor. i have v1 v2 v3 1 0 0 0 1 0 0 0 1 and want v1 v2 v3 v4 1 0 0 1 0 1 0 2 0 0 1 3 amongst other things i tried the following d <- data.frame(d1=c(1,0,0), d2=c(0,1,0), d3=c(0,0,1)) d$nr <- NA sapply(1:3, function(x)
2013 Jul 02
2
Replacing strings to numbers
Hi guys, I was wondering if any one is able to help me on a problem that I was stuck with for a long time. It involves the replacement of character strings with numbers. The character string can take on only 3 possible values, for instance: AA AT TT I would want R to replace AT with 0. Between AA and TT, I want to compare the frequency of either value, and then for the one which occurs more, I
2005 Jun 01
1
many chr2factors ?
Hi, i would like transfrom characters from a data.frame to factors automatic. > tofac <- function(df){ + i=0 + repeat{ + i <- i+1 + if(!is.character(df[,i])) + next + df[,i] <- as.factor(df[,i]) + print(i) + if(i == length(df)) + break } + } > > tofac(abrdat) [1] 7 [1] 8 [1] 9 [1] 11 [1] 13 [1] 15 Error in "[.data.frame"(df, , i) : undefined columns selected This
2012 Nov 28
2
data frame: adding columns from data and file title
Data processing? I have a large number of csv files from animal tracks that look like this: Date_ Time_ Speed Course Type_ Distance 30/03/2012 11:15:05 108 121 -2