Displaying 20 results from an estimated 7000 matches similar to: "counting the frequencies of a vector"
2009 Jan 17
3
converting multiple variable numbers
thanks for the great help!
But I have one additional question (hope I can work alone then);
I want to replace the values of a vector, like this:
x <- c(1,2,2,3,3,4,4,4,5,1)
x[x==1] <- c(12)
x[x==2] <- c(13)
x[x==3] <- c(17)
x[x==4] <- c(20)
x[x==5] <- c(22)
is there a way to do that just in one or two code lines?
I tried
x[x == c(1:5)] <- c(12,13,17,20,22)
but that
2009 Jan 17
2
splitting a string / finding a numeric value within a string
Hi,
I have this variable;
x <- c("test_01.log")
and I want to extract the number (01) out of the variable.
So that I get;
> x
[1] 1
I tried strsplit, but I don't know how to refer to the result.
Can someone help me with that?
[[alternative HTML version deleted]]
2008 Dec 16
2
converting a data-frame by a defined rule
Hi,
I have a data frame with several columns.
Now I want to transfer the data into a new variable (also a data
frame), but I only want a part of the data, defined by a rule ...
for example; I have following data frame:
row1 row2 row3
x 2 3
x 1 4
y 5 3
y 2 3
I know want a data frame, only with lines containing x in row1.
I know how to do that for one row (f <-
2009 Jan 12
2
writing an own function - is.factor
Hi,
I try to write an own function in R.
I want a summary table with descriptive statistics.
For example, I have this data.frame:
d <- data.frame(c(rep("m",5), rep("f",5)), c(1:10))
names(d) <- c("x", "y")
d
x y
1 m 1
2 m 2
3 m 3
4 m 4
5 m 5
6 f 6
7 f 7
8 f 8
9 f 9
10 f 10
now I want to get the mean and
2009 Jan 17
5
changing a range of values
Hi,
If I have following vector;
x <- c(1,1,1,2,2,3,4,4,5)
and I want to change values in the range of 1 to 3 into the value 1,
how can I do that?
I tried
x[x == c(1:3)] <- c(1)
but than I get;
x
[1] 1 1 1 2 1 1 4 4 5
R doesn't change the 2 into a 1.
But why?
2008 Jul 29
3
placing a text in the corner of a plot
Is there an easy way to add a text into an R-plot and place it in the
upper left corner?
Like that:
--------------------------------
| (a) |
| |
| |
| |
| |
| |
2008 Sep 29
4
histogram-like plot with two variables
Ein eingebundener Text mit undefiniertem Zeichensatz wurde abgetrennt.
Name: nicht verf?gbar
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20080929/e8ff7cb6/attachment.pl>
2009 Jan 17
2
data.frame: how to extract parts
Hi,
I have a problem with the R syntax.
It's perhaps pretty simple, but I don't understand it ...
I can extract a column from a data.frame with the following code for
example ...
b$row1[b$row1 == "male"]
so I see all male-entries.
But I cannot extract all lines of a data.frame depending on this
criterium;
only.male <- b[b$row1 == "male"]
With that, I
2009 Jan 18
2
distance between plot-region and main-title / saving plot as pdf
Hi,
is there a way to increase the distance beween the plot (or plot-
region) and the main-title?
I haven't found anything via ?par().
Thanks for any help!
2009 Jan 22
2
plot: abline() - define line length
Hi,
is there a way to define, that a line drawn via abline() should only
go from for example -2 to 1 on the x-axis (with something working
similiar to xlim()) ?
thanks for any help!
2009 Feb 13
2
second axis title orientation
Hi,
I have added a second y-axis via axis() to a plot.
Then I tried to add an y axis title.
But the axis() function seems to have no argument like ylab.
and if I add a title with title() the text is centered at the first
axis, not the second defined one.
Is there a way to add an axis-title that orientates it's position at
the last defined axis?
2009 Jan 11
1
boxplots: yaxp does not work
Hi,
I'd like to change the y-tickmarks of a boxplot.
But it doesn't work with yaxp (like I would do it in a plot-function).
Can someone help me out?
2008 Aug 10
1
box-plot without a box surrounding the plot
Hi,
I want to draw a boxplot and I want to get rid of the surrounding box.
So that there are only the axis lines left on the bottom and on the
left.
I tried a litte bit with box() but I dont get it the way I want.
Can somebody help me out?
2008 Aug 10
1
customizing the axis (adding labels)
An embedded and charset-unspecified text was scrubbed...
Name: nicht verf?gbar
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20080810/8933c4da/attachment.pl>
2008 Dec 16
1
refer to next line within a data-frame an select cases
Hi,
I have a problem sorting and selecting entries within a data-frame and
I don't know if it is possible to solve it with R ... (probably yes,
but I have no idea how).
Following Data;
row1 row2
a 12
pos NA
a 3
neg NA
a 5
neg NA
a 11
pos NA
I want to extract the values in row 2 in the lines with an "a" in row1.
But I want to have two vectors: vector x with all
2009 Feb 08
1
sub() with "+" - invalid regular expression
Hi,
can someone help me;
I don't understand why this code doesn't do what it's supposed to do;
x <- c("F+", "F+")
x <- sub("F+", "F", x)
x
[1] "F+" "F+"
(I want "F" "F")
when I try this;
x <- c("F+", "F+")
x <- sub("+", "", x)
x
I get an error
2012 Jun 20
3
[LLVMdev] Is Loop Dependence Analysis Printing Correct Stats?
Hi;
I was playing with the -lda pass of LLVM on the following program-
#include <stdio.h>
void main()
{
int a[10];
int i;
for(i = 0; i < 4; i ++)
{
a[i] = a[i-1]+1;
}
}
I run the following commands -
clang a.c -emit-llvm -S
opt -analyze -stats -lda a.s
The output is -
Printing analysis 'Loop Dependence Analysis':
Loop at depth 1, header block: %for.cond
Load/store
2012 Oct 04
4
barplot with some 0 frequencies
Hi all,
I am back with a new question !
I recorded the occurence of 4 differents event on 20 places for a given time
period.
Now, I want to do some barplot of the frequency of theses events for each
place, so it should be easy. My problem is that I want to see the
frequencies of the 4 events on my barplots even if the frequency of some of
them is 0.
How could I do that ?
Thanking you in advance
2012 Jul 02
4
how to do a graph with tree different colors??
hi
i try to do a graph of a time series which shows in red the values > -0.05,
in blue the values >0.05 and in white the values between -0.05 and 0.05
for un exemple :http://www.appinsys.com/globalwarming/enso.htm
thanks !!!!!
denisse
--
View this message in context: http://r.789695.n4.nabble.com/how-to-do-a-graph-with-tree-different-colors-tp4635206.html
Sent from the R help mailing
2012 Jun 20
0
[LLVMdev] Is Loop Dependence Analysis Printing Correct Stats?
> From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Arnamoy Bhattacharyya
> Subject: [LLVMdev] Is Loop Dependence Analysis Printing Correct Stats?
> for(i = 0; i < 4; i ++)
> {
> a[i] = a[i-1]+1;
> }
> Am I doing anything wrong or the code seems buggy?
Your code is buggy. The first time through the loop, you're referencing