Displaying 20 results from an estimated 8000 matches similar to: "splits with 0s in middle columns"
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 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 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 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 29
4
Use or ??
Hi, My data frame looks like
A B C
a b a
x y z
I want to add a new column which says "y" if either A or B matches with C and "n" if there is no match. How can I do that?
Thanks
[[alternative HTML version deleted]]
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 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 Jun 10
4
Combining CSV data
Hello R community,
I am trying to combine two CSV files that look like this:
File A
Row_ID_CR, Data1, Data2, Data3
1, aa, bb, cc
2, dd, ee, ff
File B
Row_ID_N, Src_Row_ID, DataN1
1a, 1, This is comment 1
2a, 1, This is comment 2
3a,
2013 Feb 17
6
histogram
HI Elisa,
You could use ?cut()
vec1<-c(33,18,13,47,30,10,6,21,39,25,40,29,14,16,44,1,41,4,15,20,46,32,38,5,31,12,48,27,36,24,34,2,35,11,42,9,8,7,26,22,43,17,19,28,23,3,49,37,50,45)
label1<-unlist(lapply(mapply(c,lapply(seq(0,45,5),function(x) x),lapply(seq(5,50,5),function(x) x),SIMPLIFY=FALSE),function(i) paste(i[1],"<x<=",i[2],sep="")))
2013 Apr 08
3
Reshaping a table
Hello all,
I have data in the form of a table:
X Y1 Y2
0.1 3 2
0.2 2 1
And I would like to transform in the form:
X Y
0.1 Y1
0.1 Y1
0.1 Y1
0.1 Y2
0.1 Y2
0.2 Y1
0.2 Y1
0.2 Y2
Any ideas how?
Thanks in advance,
IOanna
[[alternative HTML version deleted]]
2004 Nov 21
3
Help with ooplot(gplots) and error bars
Dear All
I am trying to graph a proportion and CI95% by a factor with ooplot (any
other better solution ?)
It works well until I try to add the confidence interval.
this is the error message and and a description of the data:
> dat1
PointEst
TT1 1 3.6
TT2 2 5.0
TT3 3 5.8
TT4 4 11.5
TT5 5 7.5
TT5 6 8.7
TT7 7 17.4
> dat2
2012 Oct 25
5
trying ti use a function in aggregate
Hi -I am using R v 2.13.0. I am trying to use the aggregate function to
calculate the percent at length for each Trip_id and CommonName. Here is a
small subset of the data.
Trip_id Vessel CommonName Length Count
1 230 Sunlight Shad,American 19 1
2 230 Sunlight Shad,American 20 1
3 230 Sunlight Shad,American 21
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 Jul 24
5
First value in a row
Hi.
This is likely a trivial problem but have not found a solution.
Imagine the following dataframe:
Lat Lon x1 x2 x3
01 10 NA NA .1
01 11 NA .2 .3
01 12 .4 .5 .6
I want to generate another column that consist of the first value in
each row from columns x1 to x3. That is
NewColumn
.1
.2
.4
Any input greatly appreciated,
Thanks,
Camilo
Camilo Mora, Ph.D.
2013 Jun 06
2
generating a bar chart with two axis for co-linear variable
Hello Dimitris,
I was goggling for some help on Sensitivity vs 1-specificity and saw your link.
I hope you can be of help to me in one of the issue that I am facing in generating combo chart(bar chart and plot). I am a novice and have some difficulty in getting this logic correct.
I am give a dataset (I am attaching a sample dataset).
I am using a barplot() and passing values for
2008 Sep 17
5
Loop on vector name
[My previous message rejected, therefore I am sending same one with some modification]
I have 3 vectors with object name : dat1, dat2, dat3
Now I want to create a loop, like :
for (i in 1:3)
{
cat(sd(dati))
}
How I can do this in R?
Regards,
2012 Aug 07
5
summing and combining rows
Hello,
I have a data set that needs to be combined so that rows are summed by a
group based on a certain variable. I'm pretty sure rowsum() or rowsums()
can do this but it's difficult for me to figure out how it will work for
my data based on the examples I've read.
My data are structured like this:
Plot SizeClass Stems
12 Class3 1
12 Class4
2012 Sep 01
5
R_closest date
Hi,
I have encountered an issue about finding a date closest to another date
So this is how the data frame looks like:
PT_ID IDX_DT OBS_DATE DAYS_DIFF OBS_VALUE CATEGORY
13 4549 2002-08-21 2002-08-20 -1 183 2
14 4549 2002-08-21 2002-11-14 85 91 1
15 4549 2002-08-21 2003-02-18 181 89 1
16 4549 2002-08-21 2003-05-15
2012 Oct 26
3
regression analysis in R
Dear useRs,
i have vectors of about 27 descriptors, each having 703 elements. what i want to do is the following 1. i want to do regression analysis of these 27 vectors individually, against a dependent vector, say B, having same number of elements.2. i would like to know best 10 regression results, if i do regression analysis of dependent vector against the random combination of any 4
2012 Mar 10
3
function input as variable name (deparse/quote/paste) ??
Hi all
Say I have a function:
myname=function(dat,x=5,y=6){
res<<-x+y-dat
}
for various input such as
myname(dat1)
myname(dat2)
myname(dat3)
myname(dat4)
myname(dat5)
how should I modify the 'res' line, to have new informative variable name
correspondingly, such as
dat1.res
dat2.res
dat3.res
dat4.res
dat5.res
stored in the workspace.
This is only an example of a complex