Hi all!
I'm stuck with this "easy" problem. I have two tables (a and b) which i would
like to add. table a looks like:
a
var1 var2
3 4
and table b looks like:
b
var1
10
I would like this result: c<- a+b
c
var1 var2
134
Best regards Henrik Källberg
___
I was wondering if anyone could help me with a problem. I need to randomly
select, say 500 subjects from the 5000 cases I have and then need to run a
test to create 500 sample means and graph the means in a histogram. Does
anyone know how to do this. I'm not that familiar with R so please be
pa
Hello R helpers,
I am producing a figure with dual strips, i.e., x~y | S1 + S2, where S1 and
S2 are two strips. For example, in figure 2.1 at
http://lmdvr.r-forge.r-project.org/figures/figures.html.
In this case, I would like to combine the the top strip, since all three
pictures in the same row
Hi,
I want to plot the residuals of a least-squares regression.
plot(lm(y~x), which=1)
does this, but it plots the y-axis of my data on the x-axis of the
residuals plot. That is, it plots the residual for each y-value in the
data. Can I instead use the x-axis of my data as the x-axis of the
What I would probably do is along these lines:
iddf <- data.frame(Sample.id=names(Prot.amount), new.id=Prot.amount[1,])
newNAD <- merge( NAD, iddf)
This is not tested, but it looks right to me,
assuming I understand the structure of what
you're trying to do.
I'm also assuming that NAD h
By the way, how about:
plot(y,mylm$residuals)
So you can have an idea of your error distribution across your response
variable domain. :-)
milton
toronto=brazil
On Sat, Sep 19, 2009 at 9:02 PM, Sunil Suchindran wrote:
> x <- seq(50)
>
> y <- 10 + x * 2 + rnorm(50,0,10)
>
> plot(y~x)
>
> mylm =
Hello,
I often use the axis command to add labels to axes with large numbers of
consecutively numbered names:
y<- barplot (x, log="x")
axis(1, at = y, labels = c(1:12345))
Since there are more labels than will fit in the space, the command only
prints selected labels. This is what I want, exce
OK. I've combined both approaches into a single process.source()
function. Just place the mixed R code and output in the clipboard
and run:
source.commands()
it will 1. first display clipboard in a suitable manner for pasting into
an r-help post and then 2. execute it.
Thus you can either co
Dear Stephan,
Try
crossprod(x)
HTH,
Jorge
On Sat, Sep 19, 2009 at 11:42 PM, Stephan Lindner <> wrote:
> Hi everyone,
>
>
> I would like to compute the sum of cross products of rows of a
> matrix. Does anyone know how to do this without an explicit loop for
> computational efficiency? Below is
Hi everyone,
I would like to compute the sum of cross products of rows of a
matrix. Does anyone know how to do this without an explicit loop for
computational efficiency? Below is a code example.
Thanks!
Stephan
# I.e., if I have a matrix like this
x <- matrix(rep(c(1,2,3),3),nco
Hello,
I would like to do a barplot that has a log-scaled x axis, but no space
between the bars. I have attempted the following, but it produces an error
that seems to indicate that the log scaling is dependent on the space being
> 0:
x<-c(1:100)
barplot(x,log="x",space=0)
Error message:
In pl
I have fitted Hyperexponential distribution (HED) and Hypoexponential
distribution (HoED) to two different data sets (of size 1000 numeric values
each) using a software package called EMpht.
I want to use R to perform goodness-of-fit test for the fitted distribution
with respect to the empirical
If the only reason you want to save it is to later read it
back into R later then see ?dump or even ?save
On Sat, Sep 19, 2009 at 8:11 PM, Xi Ang wrote:
>
>
> Thanks for your reply.
>
> Is there a way I can save the data to an ascii file without losing the
> row/column structure?
> I have tried s
Another possiblity:
write.table( t(XYbyT), file="outcsv.csv", sep="\t")
On Sep 19, 2009, at 9:16 PM, David Winsemius wrote:
?cat
?apply
?t
You could follow each row of the transposed matrix with a :
apply(t(XYbyT), 1, function(x) cat(x, "\n", file="output.txt",
append=TRUE) )
On Sep
?cat
?apply
?t
You could follow each row of the transposed matrix with a :
apply(t(XYbyT), 1, function(x) cat(x, "\n", file="output.txt",
append=TRUE) )
On Sep 19, 2009, at 8:11 PM, Xi Ang wrote:
Thanks for your reply.
Is there a way I can save the data to an ascii file without losin
x <- seq(50)
y <- 10 + x * 2 + rnorm(50,0,10)
plot(y~x)
mylm = lm(y~x)
# Use str(mylm) to see how to get the residuals
plot(x,mylm$residuals)
On Sat, Sep 19, 2009 at 8:35 PM, Jason Priem wrote:
> Hi,
> I want to plot the residuals of a least-squares regression.
>
> plot(lm(y~x), which=1)
>
Hi,
I want to plot the residuals of a least-squares regression.
plot(lm(y~x), which=1)
does this, but it plots the y-axis of my data on the x-axis of the
residuals plot. That is, it plots the residual for each y-value in the
data. Can I instead use the x-axis of my data as the x-axis of the
Thanks for your reply.
Is there a way I can save the data to an ascii file without losing the
row/column structure?
I have tried save(...) and write.table(...) but the output file seems to
jumble up the order of the matrix.
Thanks
Xi
David Winsemius wrote:
>
> XYT <- array(1:150, dim=c(3,5,1
Thanks again!
On Sun, Sep 20, 2009 at 12:04 AM, Jorge Ivan Velez
wrote:
> Hi tzygmund,
> You can avoid the print() part and the result would be pretty much the same:
> # Data
> x1 <- x2<- x3 <- matrix( rnorm(20), ncol = 5)
> # Names to print
> Names <- paste('x', 1:3, sep="")
> # New suggestion
>
Hi tzygmund,
You can avoid the print() part and the result would be pretty much the same:
# Data
x1 <- x2<- x3 <- matrix( rnorm(20), ncol = 5)
# Names to print
Names <- paste('x', 1:3, sep="")
# New suggestion
sapply( Names, function( y ) list( get( y ) ) )
Best,
Jorge
On Sat, Sep 19, 2009 a
Try this:
sapply(ls(pattern = 'Table[0-9]'), get)
On Sat, Sep 19, 2009 at 7:51 PM, tzygmund mcfarlane
wrote:
> Jorge,
>
> Your suggestions produce the names of the matrices and not the
> contents. Sorry if this was not clear in the question.
>
>
>
> On Sat, Sep 19, 2009 at 11:46 PM, Jorge Ivan V
Ah, apologies. In the backing and forthing, I assigned the names to
the matrices. All sorted. Thanks!
On Sat, Sep 19, 2009 at 11:55 PM, Duncan Murdoch wrote:
> On 19/09/2009 6:51 PM, tzygmund mcfarlane wrote:
>>
>> Jorge,
>>
>> Your suggestions produce the names of the matrices and not the
>> con
On 19/09/2009 6:51 PM, tzygmund mcfarlane wrote:
Jorge,
Your suggestions produce the names of the matrices and not the
contents. Sorry if this was not clear in the question.
You must not have entered them correctly. His answer is fine.
Duncan Murdoch
On Sat, Sep 19, 2009 at 11:46 PM, Jo
Jorge,
Your suggestions produce the names of the matrices and not the
contents. Sorry if this was not clear in the question.
On Sat, Sep 19, 2009 at 11:46 PM, Jorge Ivan Velez
wrote:
> Dear tzygmund,
> Here are two suggestions:
> # Suggestion 1
> for (i in 1:10){
> disp<-paste("Table", i, sep
Dear tzygmund,
Here are two suggestions:
# Suggestion 1
for (i in 1:10){
disp<-paste("Table", i, sep="")
print(get(disp))
}
# Suggestion 2
disp <- paste("Table", 1:10, sep="")
sapply(disp, function(x) print( get(x) ) )
See ?print and ?get for more information.
HTH,
Jorge
On Sat, Sep 19, 20
Hi,
I am unable to do something fairly simple. I have matrices called
Table1,..., Table10. I want to be able to print them using a loop. So
I wrote:
##
for (i in 1:10){
disp<-paste("Table", i, sep="")
eval(parse(text=disp))
}
##
but this produces no output. Any
Hello R helpers,
I am producing a figure with dual strips, i.e., x~y | S1 + S2, where S1 and
S2 are two strips. For example, in figure 2.1 at
http://lmdvr.r-forge.r-project.org/figures/figures.html.
In this case, I would like to combine the the top strip, since all three
pictures in the same row
David,
You can used the sink function to direct the output to a file. When you do
this, nothing is printed on the screen.
e.g.
sink("c:\\RResu.txt") #Defines location to which output is to be written
#R code goes here
sink() #Turns off redirection, any code after thi
On Sep 19, 2009, at 4:48 PM, Nick Matzke wrote:
Hi,
I have a script which I source, which evaluates a changing
expression call hundreds of times. It works, but it prints to
screen each time, which is annoying. There must be simple way to
suppress this, or to use a slightly different se
Hi,
What about this,
eval(parse(text=expr))
(no print)
HTH,
baptiste
2009/9/19 Nick Matzke :
> Hi,
>
> I have a script which I source, which evaluates a changing expression call
> hundreds of times. It works, but it prints to screen each time, which is
> annoying. There must be simple way
Hi,
I have a script which I source, which evaluates a changing expression
call hundreds of times. It works, but it prints to screen each time,
which is annoying. There must be simple way to suppress this, or to use
a slightly different set of commands, which will be obvious to those
wiser t
On Sat, 19 Sep 2009, Axel Urbiz wrote:
Hi All,
My dependent variable is a ratio that takes a value of 0 (zero) for 95% of
the observations and positive non-integer values for the other 5%. What
model would be appropriate? I'm thinking of fitting a GLM with a Poisson ~.
Now, becuase it takes non
Hi All,
My dependent variable is a ratio that takes a value of 0 (zero) for 95% of
the observations and positive non-integer values for the other 5%. What
model would be appropriate? I'm thinking of fitting a GLM with a Poisson ~.
Now, becuase it takes non-integer values, using the glm function wi
The homals package
http://www.jstatsoft.org/v31/i04
will get a major programming overhaul. This will take some time,
but what's a few years on a 40-year project. Suggestions
from the audience are welcome.
homals() has a core loop over the m variables in which
1. tapply is used to compute categ
A few amendments might make this improved code more readable,
e = expression(alpha,"testing very large width", hat(beta),
integral(f(x)*dx, a, b))
library(grid)
rowMax.units <- function(u, nrow){ # rowMax with a fake matrix of units
matrix.indices <- matrix(seq_along(u), nrow=nrow)
do.call(uni
I've been using RGui and Tinn-R on Windows for a while now, but it
continues to be a hassle that RGui supports only very rudimentary line
editing. I can't even use Shift+arrows to select text, let alone use
things like Ctrl+arrows to jump left or right a word at a time.
I searc
Hi all,
I'm currently working on the fitdistrplus package (that basically fit
distributions). There is something I do not understand about the
generic function summary.
In the current version on CRAN, there is no NAMESPACE saying
S3method(summary, fitdist)
.
However if we use summary on an
XYT <- array(1:150, dim=c(3,5,10))
XYbyT= matrix(apply(XYT, 3, I), ncol=10)
...or even...
XYbyT= matrix(XYT, ncol=10)
--
David.
On Sep 19, 2009, at 1:11 PM, Xi Ang wrote:
Hi
I have some data with these dimensions:
5 3 100
which correspond to the x, y, and time dimensions, for a variabl
I made a python script to parse ">" and "+" marks, if someone is interested:
#- start --
#!/Python26/
# -*- coding: utf-8 -*-
import sys
def main(argv):
if len(argv) < 2:
sys.stderr.write("Usage: %s " % (argv[0],))
return 1
f = open(sys.argv[1
Dear Oscar,
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On
> Behalf Of oscar linares
> Sent: September-19-09 1:14 PM
> To: r-h...@stat.math.ethz.ch
> Subject: [R] Rcmdr
>
> Is there a UseR! manual in the works for the outstanding Rcmdr?
Is there a UseR! manual in the works for the outstanding Rcmdr?
--
Oscar
Oscar A. Linares, MD
Translational Medicine Unit
Bolles Harbor
Monroe, Michigan
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
https://stat.eth
Hi
I have some data with these dimensions:
5 3 100
which correspond to the x, y, and time dimensions, for a variable, p.
I need the data in this format: 100 rows (1 row per time unit), and 15
values in each row.
I have attempted to reshape my data
>dim(data)
5 3 100
>attr(data,'dim')<-c(dim
xyplot.zoo does that by default.
library(lattice)
library(zoo)
z <- zoo(cbind(1:4, 2:5, 3:6))
xyplot(z, type = "l")
On Sat, Sep 19, 2009 at 12:42 PM, Larry White wrote:
> Hi,
>
> I'm trying to create a lattice plot with three xyplots in one vertical
> column. I would like to reduce the vertica
As far as I know there isn't anything available for this, but I
thought I'd check before working up something of my own.
Is there a way to query Amazon SimpleDB and import the data results
directly into R?
Cheers,
Tim.
__
R-help@r-project.org mailing
The Lattice book shows different uses of the layout and between
parameters in the early examples in chapter 2. Why not go to the
book's website and take a look?
--
David.
On Sep 19, 2009, at 12:42 PM, Larry White wrote:
Hi,
I'm trying to create a lattice plot with three xyplots in one vert
Neat!
What if, instead, one wanted to format his/her code in the console
before sending it by email? Any tips for that?
(I proposed something like options("prompt"=" ") above, but got stuck
with adding a comment # to printed results)
Thanks,
baptiste
2009/9/19 Gabor Grothendieck :
> Combini
Hi,
I'm trying to create a lattice plot with three xyplots in one vertical
column. I would like to reduce the vertical space between the charts. My
code is below. There seems to be a "between" parameter for lattice.options,
but I can't find any examples. Aside from the data setup, the code is bel
Combining the code posted by myself, Duncan and David we have:
# Usage: copy code from r-help to clipboard, then in R enter this:
# source.commands()
#
source.commands <- function(echo = TRUE, max.deparse.length = Inf, ...) {
# L <- readLines(pipe("pbpaste")) # use this instead for Mac
L <
On Sep 19, 2009, at 11:58 AM, johannes rara wrote:
Thanks for the responses.
I think that the best way to avoid lots of hassle is that people
copy-paste their solutions from their code editor, NOT from R console.
For example, I usually save those solutions for my code archive, and
if I want to
Thanks for the responses.
I think that the best way to avoid lots of hassle is that people
copy-paste their solutions from their code editor, NOT from R console.
For example, I usually save those solutions for my code archive, and
if I want to run these later on (using Tinn-R), I have to parse ">"
I'm not sure I understand what you are doing below but to rearrange columns of
a data.frame you can just rearrange the indices. Is this what you mean?
A couple of examples:
(mydata <- data.frame(aa=as.character(c("a", "b", "c", "d", "e")), bb = 1:5))
(mydata <- mydata[,2:1])
df1 <- structur
Dear R'sians,
Would really appreciate if you could suggest a more efficient way to order
the columns of a dataset. The column names of the dataset contain indices
separated by a period. Following are examples of my code and the dataset.
oC <- function(tg=x2) {
lth<- length(grep("T",names(t
Dear list,
As a minimal test of a more complex grid layout, I'm trying to find a
clean and efficient way to arrange text grobs in a rectangular layout.
The labels may be expressions, or text with a fontsize different of
the default, which means that the cell sizes should probably be
calculated usi
On Sep 19, 2009, at 10:58 AM, Duncan Murdoch wrote:
On 19/09/2009 10:12 AM, Gabor Grothendieck wrote:
One solution would be to have a portable version of the
Windows
Edit | Paste commands only
functionality that works on all platforms.
For example if a command such as this were available:
so
On 19/09/2009 10:12 AM, Gabor Grothendieck wrote:
One solution would be to have a portable version of the
Windows
Edit | Paste commands only
functionality that works on all platforms.
For example if a command such as this were available:
source.commands <- function(echo = TRUE, ...) {
On 19-Sep-09 14:12:08, Gabor Grothendieck wrote:
> One solution would be to have a portable version of the
> Windows
>
>Edit | Paste commands only
>
> functionality that works on all platforms.
>
> For example if a command such as this were available:
>
> source.commands <- function(echo =
On Sep 19, 2009, at 5:39 AM, Sam Player wrote:
#I have a dataset with two factor. I want to combine those factors
into a single factor and count the number of data values for each
new factor. The following gives a comparable dataframe:
a <- rep(c("a", "b"), c(6,6))
b <- rep(c("c", "d"), c(
You could plot both histograms into the same file using this:
library(lattice)
jpeg(filename="combined.jpeg")
histogram(~d|f, data = df)
dev.off()
Schalk Heunis
On Sat, Sep 19, 2009 at 11:37 AM, Sam Player wrote:
> # I have a dataframe with data and factors similar to the following:
>
> a <- r
Sam,
Depending on what your ultimate aim is, perhaps you just want to add
the 'drop=TRUE' argument to your interaction call.
Peter
Sam Player wrote:
#I have a dataset with two factor. I want to combine those factors into
a single factor and count the number of data values for each new factor.
On Sep 19, 2009, at 5:37 AM, Sam Player wrote:
# I have a dataframe with data and factors similar to the following:
a <- rep(c("a", "b"), c(6,6))
df <- data.frame(f=a, d=rnorm(12))
df
# I am trying to write a 'for' loop which will produce a jpeg
histogram for each factor. I can individually
One solution would be to have a portable version of the
Windows
Edit | Paste commands only
functionality that works on all platforms.
For example if a command such as this were available:
source.commands <- function(echo = TRUE, ...) {
L <- readLines("clipboard")
L <- grep("^[>+] ",
Sam,
Your loop produces two jpegs but the second overwrites the first.
What do you expect
levels(df[i,"f"])
to produce? (Think about it.)
Try
jpeg(filename=paste(i,".jpg",sep=""))
and you may want to fix the titles as well.
Peter
Sam Player wrote:
# I have a dataframe with data and fac
I cannot offer direct experience with schools,
but perhaps you are interested in having a look at RExcel
(I am the author) which makes R accessible within Excel
on Windows. One of the reasons of writing it was to make R
more easily accessible for statistics education.
rcom.univie.ac.at
has more i
I think this is what you want
NAD$Sample.Id <- t(Prot.amount[NAD$Sample.Id])
HTH
Schalk Heunis
On Sat, Sep 19, 2009 at 12:18 PM, Monna Nygård wrote:
>
> Hi,
>
>
>
> This is a question of a newbie getting into the exciting world of R.
>
>
>
> I have several dataframes in the same format as NAD
On Sat, Sep 19, 2009 at 6:28 AM, John Maindonald
wrote:
> I am looking for information on experimentation with the use
> of R in the teaching of statistics and science in schools. Any
> leads would be very welcome. I am certain that there is such
> experimentation.
I read this paper
http://ww
Did lm(y ~ x | T) work for you? Let's see a reproducible example.
Peter
jrflanders wrote:
I know that simple line plots showing a point representing the mean + an
error bar are difficult in R, but I am clearly missing something. I simply
want to show how a the mean and 95% CI of a chemical co
Mag Gam wrote:
Hello:
I am very new to "R", and I am trying to plot a large data set. I
would like to get a line graph. My data looks like this in a csv file
(no header):
07/03/23,05:00,23
07/03/23,06:00,32
07/03/23,07:00,33
07/03/23,08:00,25
07/03/23,09:00,26
07/03/23,10:00,21
07/03/23,11:00,2
stephen sefick wrote:
> ?read.csv
> ?paste
> ?as.Date
> ?as.dataframe
> library(ggplot2)
> ?qplot
>
Also:
library(zoo)
?zoo
Stefan
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide htt
?read.csv
?paste
?as.Date
?as.dataframe
library(ggplot2)
?qplot
On Sat, Sep 19, 2009 at 7:19 AM, Mag Gam wrote:
> Hello:
>
> I am very new to "R", and I am trying to plot a large data set. I
> would like to get a line graph. My data looks like this in a csv file
> (no header):
>
> 07/03/23,05:00,
Thanks all for your help!
On Sat, Sep 19, 2009 at 2:05 AM, Ishwor wrote:
> Hi Duncan
>
> >> You can try putting this in your Rprofile
> >> options("keep.source=F")
> >>
> >> This will work in the R cmd but it will not work in the RGui
> >>
> >
> > The syntax is wrong there: that should be optio
Hello:
I am very new to "R", and I am trying to plot a large data set. I
would like to get a line graph. My data looks like this in a csv file
(no header):
07/03/23,05:00,23
07/03/23,06:00,32
07/03/23,07:00,33
07/03/23,08:00,25
07/03/23,09:00,26
07/03/23,10:00,21
07/03/23,11:00,23
07/03/23,12:00,
vikrant S wrote:
>
> I am new to R and I want to solve this following problem using R.
>
> My Objective function is a linear function with Quadratic constraints. I
> want to know how to solve this problem and which package will be helpful
> for me for solving such type of problems. Moreover my
Hi,
This is a question of a newbie getting into the exciting world of R.
I have several dataframes in the same format as NAD:
> NAD[1:3,1:3]
Sample.Id Main.abs..1 Main.abs..2
148 10a 0.04836 0.04994
167 11a_1109 0.32245 0.36541
173 11b_1109 0.29293
it might be possible to set up a particular mode before copying the history,
### start example ###
email = function(op){
if(!missing(op)) {
options(op) } else {
op <- options()
options("prompt" = " ")
options("continue" = " ")
op
}
}
op = email()
a = 1:10
a
email(op)
a = 1:10
a
On 19-Sep-09 08:48:45, johannes rara wrote:
> The R help mailing list posting guide
>
> http://www.r-project.org/posting-guide.html
>
> suggests to give an example in this form
>
> ...snip...
> f I have a matrix x as follows:
> > x <- matrix(1:8, nrow=4, ncol=2,
> dimnames=list
#I have a dataset with two factor. I want to combine those factors into
a single factor and count the number of data values for each new factor.
The following gives a comparable dataframe:
a <- rep(c("a", "b"), c(6,6))
b <- rep(c("c", "d"), c(6,6))
df <- data.frame(f1=a, f2=b, d=rnorm(12))
df
# I have a dataframe with data and factors similar to the following:
a <- rep(c("a", "b"), c(6,6))
df <- data.frame(f=a, d=rnorm(12))
df
# I am trying to write a 'for' loop which will produce a jpeg histogram
for each factor. I can individually isolate the data from a factor and
produce a jpeg
The R help mailing list posting guide
http://www.r-project.org/posting-guide.html
suggests to give an example in this form
...snip...
f I have a matrix x as follows:
> x <- matrix(1:8, nrow=4, ncol=2,
dimnames=list(c("A","B","C","D"), c("x","y"))
> x
x y
A 1 5
B 2 6
On 19-Sep-09 08:00:18, Cedrick W. Johnson wrote:
> At least in windows, if you right click directly in the r console,
> there's a command for 'Paste commands only' which may be one
> solution...
> Not sure about other platforms..
>
> hth
> c
It was precisely for this kind of reason that, when i
At least in windows, if you right click directly in the r console,
there's a command for 'Paste commands only' which may be one solution...
Not sure about other platforms..
hth
c
johannes rara wrote:
Hi,
How do you people avoid copy-pasting and manual editing of the code
posted in this list?
Hi,
How do you people avoid copy-pasting and manual editing of the code
posted in this list? I mean that if some one post a solution for an
answer like this:
> a <- 1:10
> a
[1] 1 2 3 4 5 6 7 8 9 10
> a[1:5]
[1] 1 2 3 4 5
>
I have to copy-paste it to e.g. Tinn-R and remove "> " part of
81 matches
Mail list logo