Dear list,
I´m having a little trouble with adding vertical lines to a histogram.
I need to draw a matrix of histograms (using facets), and in each
histogram add a vertical line indicating the mean value of the data in
each facet. According to the last example in the geom_hline help, to
display
I've tried Emacs Speaks Statistics and found it just confusing, to say
the least (by the way, I'm puzzled by why so many people adhere to
this one. Maybe it's a matter of getting used to it...?)
You are right... it is confusing, and it takes some time to get used
to, and it is not for
Dear list,
I´m wondering if there is something analogous to the TukeyHSD function
that could be used for parametric terms in a GAM. I´m using the mgcv
package to fit models that have some continuous predictors (modeled as
smooth terms) and a single categorical predictor. I would like to do
post
Hi Alex,
What is happening is that the ´dist´function calculates a distance matrix,
and returns an object of the ´dist´ class.
temp - rbind (c(10,1),c(99,98))
x=dist(temp)
x
1
2 131.6435
class(x)
[1] dist
You can see a description of the ´dist´class at the end of the function´s
Hi Brian,
This is really odd. I keep getting the NA secs answer, only by running
these three lines of code in a new session.
time3=strptime(2009 06 01 00 47 00,format=%Y %m %d %H %M)
time4=strptime(2009 06 01 00 57 00,format=%Y %m %d %H %M)
diff(c(time3,time4))
Time difference of NA secs
Dear list,
I´m calculating time differences between series of time stamps and I noticed
something odd:
If I do this...
time1=strptime(2009 05 31 22 57 00,format=%Y %m %d %H %M)
time2=strptime(2009 05 31 23 07 00,format=%Y %m %d %H %M)
diff(c(time1,time2),units=mins)
Time difference of 10
,format=%Y %m %d %H %M)
diff(c(time3,time4))
Time difference of 10 mins
I have version 2.10.1
On Thu, May 20, 2010 at 12:36 PM, Julian Burgos jmbur...@uw.edu wrote:
Dear list,
I´m calculating time differences between series of time stamps and I
noticed
something odd:
If I do
Dear list,
I´m using the mgcv package to model the proportion by weight of certain prey
on the stomach content of a predator. This proportion is the ratio of two
weights (prey weight over stomach weight), and ranges between 0 and 1. The
variance is low when proportion is close to 0 and 1, and
Dear list,
I need to fit a multiple regression in which individual data point in the
independent and the dependent variables have an associated variance or
standard deviation. To make things clear, instead of having just a table of
dependent (X) and independent (Y1, Y2) variable values like
You have to download it from CRAN and install it. From the GUI, do
Packages-Install package(s).
Pretty basic stuff...you should check the documentation before posting.
Julian
R version 2.9.2 (2009-08-24) - for windows
library(SOM)
Error in library(SOM) : there is no package called 'SOM'
Here is an approach...probably there are more elegant ways
mydata=data.frame(ID=c(A,B,C,D,E),val=c(.3,1.2,3.4,2.2,2.0))
index=expand.grid(1:nrow(mydata),1:nrow(mydata))
dif=data.frame(difference=mydata$val[index$Var2]-mydata$val[index$Var1])
Hello fellow R's,
I´ve been learning to use the ggplot2 library, and after a full day of
work I still have a couple of basic questions.
Here is an example:
mydata=data.frame(x=runif(20),y=runif(20),n=runif(20))
mydata2=data.frame(x=c(0.4,0.6,0.5),y=c(0.4,0.4,0.6))
ggplot(mydata, aes(x, y))
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html and provide commented,
minimal, self-contained, reproducible code.
Otherwise...the only other possible suggestion is to use a smaller file.
Julian
Neotropical bat risk assessments wrote:
Hi all,
I am trying to run
Hi Torsten,
If you are fitting a line, why are you using loess? Why not simply
use lm to fit a regression line that goes through the origin? (i.e.
with no intercept).
Julian
jimm-pa...@gmx.de wrote:
Hi all,
I'm fitting a line to my dataset. Later I want to predict missing values that
You could do something like this:
Name.x=c('nx1','nx2',NA,NA)
Name.y=c('ny1','NA','ny3',NA)
Name=Name.x
Name[is.na(Name.x)]=Name.y[is.na(Name.x)]
Name
[1] nx1 nx2 ny3 NA
Julian
Ivan Alves wrote:
Dear all,
I searched the mail archives and the R site and found no guidance (tried
You can use the points() and lines() functions to add points and lines
to an existing plot.
Julian
Michel PETITJEAN wrote:
I am a new user of R.
Please does somebody knows how to plot 3 datasets
(x1,a1),...,(xn,an), (x1,b1),...,(xn,bn), and (x1,c1),...,(xn,cn)
on a single x,y plot, each of
How about something like
my.data=my.data[,4:1]
Julian
milicic.marko wrote:
Hi,
I have the data.frame with 4 columns. I simply want to invert dataset
so that last row becomes first...
I tried with rev(my_data-frame) but I got my columns inverted... not
my rows
Thanks
Hi Luz,
No entiendo bien tu pregunta. Querés grabar una tabla con nombres en
las columnas y tambien en la primera fila? Si es asi, tenés que
asignarle los nombres a la tabla antes de grabar. Por ejemplo:
mi.tabla=matrix(runif(30),ncol=3)
colnames(mi.tabla)=c(A,B,C)
Well, you are dealing with probability based clustering, so for each
bird you will get a probability of belonging to each cluster. If your
clusters are well defined, then each bird should have a very high
probability of belonging to one of the clusters. You can get this
probability matrix
Do simply
which(a100 a=200)
Julian
sj wrote:
Hello, I am trying to identify values that fall within a certain range. I
thought that I might be able to use the which function to do this but I have
been unable to figure out a way to do it. Perhaps a little code will
illustrate what i am
Hola Borja,
Creo que vas a tener muy pocas respuestas a menos que escribas a la
lista en inglés. Lamentablemente yo conozco poco de Java y no puedo
responder tu pregunta.
Saludos,
Julian
Borja Soto Varela wrote:
Hola, es la primera vez que mando un correo a cualquiera de las listas de
Hi Paul,
The easiest thing to to is to open the file using a text editor (Notepad
will do) and examine the first few lines. You can add add a column name
if needed.
Julian
Paul Adams wrote:
Hello to everyone,
I have gotten my file to print to screen but when I use read.table I am getting
You could do something like this:
mydata=c(1,2,1,1,6,7,-1,-1,5,-1)
color= as.numeric(mydata== -1) +1
plot(mydata,col=color)
This will give you a plot where the -1's are in red (color = 2) and the
other numbers in black (color=1).
Julian
uv wrote:
Hi. I am plotting graphs for values
Hi Steve,
You can use write.table:
write.table(x, file=/Users/Desktop/Data.txt,
sep=,row.names=F,col.names=F)
Cheers,
Julian
Stropharia wrote:
Dear R users,
I've had no joy finding a solution to this online or in any of my R books.
Many thanks in advance for any help you can give.
I'm
Hey Philip,
I'm not sure if I understand what your x11, x12, etc. are. You can
combine the values of your two vectors using the expand.grid function.
There is no need to do nester FOR loops:
i=c(1,2,3,4,5)
j=c(1,2,3)
x=expand.grid(i,j)
print (x)
Var1 Var2
1 11
2 21
3
Hi Stephen,
Your link doesn't work. In any case, check out the wavCWT function in
the wmtsa package.
Julian
stephen sefick wrote:
http://ion.researchsystems.com/cgi-bin/ion-p
I would like a continuous wavelet transform. I have downloaded wavethresh,
Rwave, and waveslim. I would like an
Try this:
k=c(1,1,1,2,2,1,1,1)
k[(k!=1)]
[1] 2 2
k[(k!=2)]
[1] 1 1 1 1 1 1
k[(k!=3)]
[1] 1 1 1 2 2 1 1 1
Julian
Shubha Vishwanath Karanth wrote:
Hi R,
Suppose
l=c(1,1,1,2,2,1,1,1)
k[-which(k==1)]
[1] 2 2
k[-which(k==2)]
[1] 1 1 1 1 1 1
But,
k[-which(k==3)]
Depends on the RAM in your machine. And in your definition of 'handle'.
You may be able to load a very large dataset into R, but won't be able
to use some functions that require additional memory.
A vague answer to a vague question... :)
Julian
Mingjun Huang wrote:
Hello,
I am new to
Try
get(paste(wf$,fl[[1]],sep=))
See ?get
Julian
Dirkheld wrote:
Hi,
I have a dataframe wf existing of a header with different labels and beneath
the values of those labels :
wf:
label1 label2 ...
0,450,21
0,100,45
I have a list
fl - c(label2,label3,..)
Isn't
See
?match
ss wrote:
Dear list,
If I have two vector, t1 and t2, of different lengths. Is there an easy way
to count
the number of the overlapped in two vectors and show the result in the
graph?
Thanks much,
Alex
[[alternative HTML version deleted]]
Hey Anthony,
There must be many ways to do this. This is one of them:
#First, define a function to calculate the proportion of consecutive
numbers in a vector.
prop.diff=function(x){
d=diff(sort(x))
prop=(sum(d==1)+1)/length(x)
return(prop)}
#Note that I am counting both numbers in a
=prop/length(x)
return(prop)}
This function first identifies which numbers in your original vector are
part of a sequence of consecutive numbers.
Julian
Julian Burgos wrote:
Hey Anthony,
There must be many ways to do this. This is one of them:
#First, define a function to calculate
Hy Katie,
There are many ways to do this. A simple one is to create a vector of
the same length than your 'x' vector, containing a group label.
group=rep(c(1,2,3),times=nr[1,])
Then you can use tapply to apply a function (in this case mean and
variance) of the values of x within each
In this case you can simply do
cumsum(a[x,]+a[y,])
Julian
yoo wrote:
Hi all, i have the following..
a - data.frame(data = seq(1,10))
i have indices:
x - c(1, 5, 3, 9)
y - c(2, 7, 4, 10)
I want the cumsum of a[1:2], a[5:7], a[3:4]...
is there an elegant way to do it without
Hello Kayj,
There are very good tutorials at the R website. See here:
http://cran.r-project.org/other-docs.html
Julian
kayj wrote:
Hi All,
I am a new user in R and I would like to buy a book that teaches me how to
use R. In addition, I may nees to do some advanced statistical analysis.
Tinn-R also has this option. I suspect most editors will also do.
Julian
-Halcyon- wrote:
RWinEdt has line indication. You might want to try that.
Uwe Ligges-3 wrote:
This depends on the editor you use for writing R code rather than on R.
Uwe Ligges
Jack Luo wrote:
Hi, List
When
See rnorm(). If you are sampling from a continuous normal distribution,
it makes no sense to define a sample with replacement, because the
probability of sampling twice the same number is zero.
Julian
sigalit mangut-leiba wrote:
Hello,
How do I sample observations with replacement from a
Hi Mika03,
It would be useful to know what function you used to create your plot.
Assuming you used boxplot, do this:
?boxplot
?boxplot.stats
Julian
mika03 wrote:
http://www.nabble.com/file/p14668788/paragraphs.png
Hi,
R is is world full of wonders... I created the attached plot,
I should say that the name of this chart varies even among
Spanish-speaking countries. In Argentina is diagrama de torta which
is something like cake-chart.
Julian
ahimsa campos-arceiz wrote:
Two non-eatable examples from Spain and Japan:
in Spanish we call them diagrama de sectores or
Hi Wayne,
I'm assuming that you file is really a comma-separated file (*.csv) and
not an Excel workbook (*.xls) saved with a .csv extension, right? That
(in my experience) is a common mistake.
You should open your file with a simple text editor (notepad will do if
the file is not too large)
Hi Andre,
I don't quite understand what you are trying to do. Why you are using
cbind to join columns of a dataset that it is already in table form? It
is true that read.table will give you a data.frame instead of a matrix,
but if for some reason you need a matrix you can do simply
The basic functions you need are
image()
contour()
although I like better the plot.surface() function in the 'fields' package.
Julian
threshold wrote:
Hi All, simple question:
do you know how to graph the following object/matrix in a 'surface manner':
[,1] [,2] [,3]
Hi TLowe,
I'm not quite sure if I understand what you are trying to do. If you
are trying to get the cumulative sum of your data frame along each
column you can simply do
rcumsum=function(x){cumsum(x)/sum(x)}
apply(tdat,2,rcumsum)
Yet that is not what your code is doing. With a bit of
The simplest way would be to have a flag, an indicator variable that
stores a value that indicates if a plot has been done before. Something
like this
plot (do my first plot here...)
is.plot=T
later in the code...
if (is.plot) {plot (do new plot here)} else {lines(add lines to the
Hello Marc,
Well, image() requires data values in a regular grid. So you need to
interpolate your data to a regular grid before you do your plot. There
are many interpolation methods, but a good place to start is to do
linear interpolation. You should first use expand.grid() to create the
Hi Amy,
Many (perhaps most) of the people on the list do not receive emails with
html...so we can't see colored text. Also it would be helpfully to have
a bit of your data, so we can run your code (see the posting guide in
this regard,http://www.R-project.org/posting-guide.html).
Please
clearly what
you are trying to achieve, we can help you to simplify your code.
Julian
Julian Burgos wrote:
Hi Amy,
Many (perhaps most) of the people on the list do not receive emails with
html...so we can't see colored text. Also it would be helpfully to have
a bit of your data, so we can run
Hello Mysimbaa,
If you want to fit a smooth line to your data, there are many ways to do
it. One option is to use splines. See the smooth.spline() function.
If you only want to add a line to highlight the trend in your data, that
should be enough. But if you want to do more serious
Hey Marc,
You can use the function scan() directly to read your file as a single
vector. Then, as Rob suggested, use the matrix function to give it the
dimensions you want.
Other option (perhaps less elegant) is to do something like this.
x=read.table (myfile,...etc.etc.)
-sig-mac, and the topic occcurred
there recently.
All in an effort to encourage promote useful and increasing exchange
participation
Or not
Loren Engrav, MD
Univ Washington
From: Julian Burgos [EMAIL PROTECTED]
Date: Mon, 19 Nov 2007 10:44:49 -0800
To: Epselon [EMAIL PROTECTED
Hey John,
You can do simply
plot(reizstaerke, kennlinie1, ylim=c(0, max(kennlinie1,
kennlinie2)),log=x)
but if you want to fine tune where the tick marks are, you can do it by
hand.
kennlinie1 - c(8.0746909, 3.9916973, 9.9789444, 19.962869);
kennlinie2 - c(6.0994206, 8.9661081, 19.924883,
Like always, there is much to be learned from the R-help list! Another
message had a much simpler approach.
plot(xy.coords(reizstaerke, kennlinie1, log=x), log=x)
Julian
Julian Burgos wrote:
Hey John,
You can do simply
plot(reizstaerke, kennlinie1, ylim=c(0, max(kennlinie1
Hello Epselon (if that is your name),
This sounds like homework questions. From the R-help posting guide:
Basic statistics and classroom homework: R-help is not intended for
these.
If you have a specific question on R coding, do ask it (and provide
reproducible code). But you should not
Something like this?
a=matrix(1:9, ncol=3)
print(a)
[,1] [,2] [,3]
[1,]147
[2,]258
[3,]369
a=a[-2,]
print(a)
[,1] [,2] [,3]
[1,]147
[2,]369
You can use negative numbers to reference rows and/or columns, and
you'll
affy snp wrote:
Dear list,
Hello! I have a question about how to print a label in the plot.
I am using the following code:
pdf(mel4_chr3_11cancer_cghFLasso.pdf, height=6,
width=5);plot(Disease.FL, index=i, type=Single,main=Plot of
Labels);dev.off();
But Plot of Labels has not been
.
On 11/13/07, Julian Burgos [EMAIL PROTECTED] wrote:
Well, the obvious (but perhaps not the most elegant) solution is put
everything in a loop and run it 600 times.
coefficients=matrix(NA,ncol=3,nrow=600)
for (loop in 1:600){
[all your code here]
coefficients[loop,]=coef(log_v
Hi Allen,
Its difficult to know what is the problem without knowing what type of
object is 'Disease.FL'. plot() is a generic function and it will act
differently depending on the type of object you are passing to it. As
always, you should provide 'provide commented, minimal, self-contained,
One way to do this is
range(which(B[,2]==1))
Julian
affy snp wrote:
Hello list,
I read in a txt file using
B-read.table(file=data.snp,header=TRUE,row.names=NULL)
by specifying the row.names=NULL so that the rows are numbered.
Below is an example after how the table looks like using
Hi Tobias,
You'll have to explain what you mean with log transformed values. If
your question is if it is possible to generate random numbers from a
normal distribution (using rnorm()) and then getting their logarithm,
then you can do that with the obvious caveat that the logarithm is not
What you are looking for is the findInterval() function.
Julian
W Eryk Wolski wrote:
Hi,
It's just some example code.. The application is uninteresting. I am
searching for some functionality.
X - rnorm(100) //my data
Y - seq(-3,3,by=0.1) // bin boundaries.
Now I would like to
run in
each row.
Julian
sigalit mangut-leiba wrote:
I want to repeat the simulation 600 times and to get a vector of 600
coefficients for every covariate: aps and tiss.
Sigalit.
On 11/13/07, Julian Burgos [EMAIL PROTECTED] wrote:
And what is your question?
Julian
sigalit mangut
Hi Amit,
Please read carefully the Mailing List Posting Guide (available at
http://www.r-project.org/posting-guide.html). In particular, this section:
For new subjects, compose a new message and include the
'[EMAIL PROTECTED]' (or '[EMAIL PROTECTED]') address
specifically. (Replying to an
There are many ways. For example, you can do something like
A[seq(1,dim(A)[2],2)]
Julian
Julian M. Burgos
Fisheries Acoustics Research Lab
School of Aquatic and Fishery Science
University of Washington
1122 NE Boat Street
Seattle, WA 98105
Phone: 206-221-6864
affy snp wrote:
Dear
No problem. Actually, I missed a comma. You should do
A[,seq(1,dim(A)[2],2)]
Julian
affy snp wrote:
Hi Julian,
Thanks for the help!
Best,
Allen
On Nov 9, 2007 11:08 PM, Julian Burgos [EMAIL PROTECTED] wrote:
There are many ways. For example, you can do something like
Hi Azadeh,
As the warning message is telling you, it seems that your initial
parameters for the covariance functions are not very good. Something
that you can do is to use the eyefit() function (package geoR) to fit
your variogram by eye and get a first approximation for your
covariance
Hey Christoph,
It is not clear what do you want to extract.
w[w0.6] does give you the correlation values above 0.6. What is your
question?
Julian
Christoph Scherber wrote:
Dear R users,
suppose I have a matrix of observations for which I calculate all
pair-wise correlations:
I'm assuming that you want to add b if 3a5.25. If so, there are many
ways. One of them is
sum (b[a3 a5.25])
This is very simple R coding. I recommend you spend some time learning
the basics. There are very good tutorials at the R website.
Julian
[EMAIL PROTECTED] wrote:
Hello,
A
Do this:
pfit$coefficients[is.na(pfit$coefficients)]=0
Julian
Ptit_Bleu wrote:
Hello,
I'm trying to fit some points with a 8-degrees polynom (result of lm is
stored in pfit).
In most of the case, it is ok but for some others, some coefficients are
NA.
I don't really understand the
Hi Garth,
Your code is really confusing! You should start by reading the help file
on the for() function and understanding what it does:
?for
Your line
for(i in 1:nboot){
}
is simply starting a loop around the variable 'i', which will change
values following the sequence 1:nboot.
It seems
The error message is telling you that R cannot find your file. Is your
'motives_pc.dat' file in your R working directory? If not, you have to
give a complete path to the scan() function.
Julian
[EMAIL PROTECTED] wrote:
Dear helpers please provide me some helpful answer to my problem while
You cannot call a column on a dataframe using the first letter (or first
few letters) if the letters match more than one name. Extraction
methods for data frames allow partially matching row names, but if the
result is undefined you get NULL in return.
Try this.
first_item - seq(1,10)
There are many ways. A simple one is to use split() to divide your
'Value' column using your 'Label' column as index. For example,
# Create dataset
mydata=data.frame(Label=c('Good','Bad','Good','Good','Good','Bad','Bad'),
Value=c(10,12,15,18,12,15,10))
# Split the data
You can use the gamm function (in the mgcv package) to fit generalized
additive mixed models and specify your covariance structure.
Julian
gallon li wrote:
I used gam for data analysis a lot. Is it possible to use gam to analyze
longitudinal data? I mean, besides the working independence
I do this all the time. Simply,
a) Open your pdf file using the pdf function.
b) Do a bunch of plots. Because now the pdf file is your active device,
every time you call a new plot you should get a new page. You can also
use par(mfrow=...) to split the page (the same way you do it on a
I'm not sure what you mean. You should provide an example (i.e. some code).
Julian
Gang Chen wrote:
This must be very simple, but I'm stuck. I have a command line in R
defined as a variable of a string of characters. How can I convert
the variable so that I can execute it in R?
Really
Check out the tapply function.
?tapply
Julian
Bernd Jagla wrote:
Hi,
I am new to R and couldn't find any information on how to handle my table
data that I just read in the way I want to use it..
I read in a table from a file:
x - read.delim(filenam, header=TRUE)
one column (x$label)
Hi Geertje,
You should look into linear mixed-effects models. In these you can
incorporate spatial correlation explicitly. The basic function to use
is lme(), but you should do some reading about this type of models
before jumping into it. An excellent resource is the book Mixed
Effects
See by()
Matthew Dubins wrote:
Hi all,
I wrote a simple function that gives me multiple t.test results
according to a subset variable and am wondering whether or not I
reinvented the wheel. Observe:
t.test.sub - function (formula, data, sub, ...)
{
for(i in 1:max(sub))
:
by(percent, quiz, function(percent) {t.test(percent~group,
data=marks.long)})
But the results it gave me weren't t.tests of percent by group according
to quiz number.
Julian Burgos wrote:
See by()
Matthew Dubins wrote:
Hi all,
I wrote a simple function that gives me multiple
an appropriate approach?
Julian
Julian Burgos
FAR lab
University of Washington
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html and provide
Well, if you bind two vectors you form an array with dimensions 2 x
length of the longest vector. So you need to decide how to fill up the
'empty' spacies corresponding to the shorter vector. Recycling the
shorter vector is the default action.
If you just want to save the data, you could
81 matches
Mail list logo