Displaying 20 results from an estimated 10000 matches similar to: "add values in one column getting range from other column"
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 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 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 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 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 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 Oct 04
4
Creating vegetation distance groups from one column
Hi R listers,
I am trying to group distances of nests to the vegetation into classes that
are define by (0-5m, 6-10m, 11-15m, 16-20m, 21-25m, 26-30m, 31-35m, 36-40m,
41-45m, 46-50m, 51-55m, 56-60m). Each row is a nest and all the distances to
the vegetation is in a column.
In plyr, I have tried - below script but I think I am going about this the
wrong way and am not successful.
#Veg index
2012 Nov 29
2
deleting data of a given date range.
hey,
I have a huge dataset with over 300000 rows which contains data about
something from 2009-2012. does anyone know how i can delete all the rows
which contain data from 2009 and only have data from 2010-2012???
is there a particular function i can use on the date column so that all data
from 2009 can be deleted???
--
View this message in context:
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 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
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 Aug 06
2
deleting columns from a dataframe where NA is more than 15 percent of the column length
I have a dataframe of 10 different columns (length of each column is
the same). I want to eliminate any column that has 'NA' greater than
15% of the column length. Do i first need to make a function for
calculating the percentage of NA for each column and then make another
dataframe where i apply the function? Whats the best way to do this.
2008 Jun 10
1
Problem with by(... , median)
Hello everyone,
I am new to R, I have been using SAS for a while. Not surprisingly, I
find R much better in graphics, which is publication ready right away.
Recently, I have been trying to calculate some basic statistics using R.
I have a dataset of multiple rows per subject. For example:
Subject Date Factor1 Factor2 Factor3
P1 0.5 1 1 3
P1 1 3 2 5
P1 2 3 5 NA
...
P2 0.5 1 6 4
P2 1 2 NA 7
P2
2013 Apr 10
3
how to calculate average of each column
Hey All,
I have a large dataset and I want to calculate the average of each column
then return a new dataset.
Here is my question: I dont know if there is a function that can allow me
to calculate the average every 60 records of data in the whole dataset, and
return a new data frame. Not sure if I have to divide the dataset first for
every 60, then do the mean or can i directly do that.
thanks
2012 Nov 25
1
Multiple Range Means Test
Hello,
My boss wants me to do a Duncan's test, which is under the agricolae
package. Unfortunately I am not versed enough in R to run my data. I
have 7 subspecies of deer mouse for which I have 23 measurements which
are my variables of interest. I have run an ANOVA for each of the set
of subspecies and variables, my data look like this:
subspecies WMF
1 rowleyi 2.50
2 rowleyi 2.30
2012 Nov 15
4
Importing Data for a two sample t-test
I am trying to do a two sample t-test with data that i received in a text
document. one list has the slab weights and the second has the company it
is associated with. here is an example.
weights company
1 A
2 A
2 B
3 B
I was able to import the data but i cannot figure out how separate the data.
I want to put them in two
2013 Apr 18
6
count each answer category in each column
Hey,
Is it possible that R can calculate each options under each column and
return a summary table?
Suppose I have a table like this:
Gender Age Rate
Female 0-10 Good
Male 0-10 Good
Female 11-20 Bad
Male 11-20 Bad
Male >20 N/A
I want to have a summary table including the information that how many
answers in each category, sth like this:
X
2012 Feb 06
2
histogram
With R and the hist function, is there a way to make a histogram in which
the y axis denotes propotion with respect to a separate sample dataset of
the same range instead of frequency?
[[alternative HTML version deleted]]