Sorry, there was a mistake in the previous mail:
Domenico Vistocco wrote:
A different solution (using aggregate for the table of means and merge
for adding it to the dataframe):
x1<-rep(c("A","B","C"),3)
x2<-c(rep(1,3),rep(2,3),1,2,1)
x3<-c(1,2,3,4,5
A different solution (using aggregate for the table of means and merge
for adding it to the dataframe):
x1<-rep(c("A","B","C"),3)
x2<-c(rep(1,3),rep(2,3),1,2,1)
x3<-c(1,2,3,4,5,6,2,6,4)
x<-data.frame(x1,x2,x3) #here using data.frame the x1 variable is directly
converted to factor
x3means <-
You should find the functions:
bitAnd, bitOr and bitXor
in the bitops package.
Ciao,
domenico
mau...@alice.it wrote:
I cannot find any R function or operator that performs a binary AND operation, as
performed by Fortran built-in function "iand".
Ideally either R operator "&" or "&&" should d
WXE83 wrote:
Dear all,
I got one problem here and hoping someone can help me on this. Say I have a
50 by 2 matrix and I don't know how to randomly select:
data <- matrix(1:25, 50, 2)
1. a pair of observations from the last 10th of the 50 observation from the
matrix.
data[sample(41:50, 1
Steven Lubitz wrote:
Hello, I'm switching over from SAS to R and am having trouble merging data
frames. The data frames have several columns with the same name, and each has a
different number of rows. Some of the values are missing from cells with the
same column names in each data frame. I h
Jacopo Anselmi wrote:
Dear List,
I am trying to solve a problem: I have approximately 100 Excel
spreadsheets each with approximately 4 sheet each that I would like to
download and import in R for analysis.
Unfortunately i realized (i also sent an email to the author or
xlsReadWrite() ) that the
soeren.vo...@eawag.ch wrote:
### example:start
v <- sample(rnorm(200), 100, replace=T)
k <- rep.int(c("locA", "locB", "locC", "locD"), 25)
tapply(v, k, summary)
### example:end
This one is better:
do.call(cbind, tapply(v,k,summary))
Ciao,
domenico
... (hopefully) produces 4 summaries of v acc
soeren.vo...@eawag.ch wrote:
### example:start
v <- sample(rnorm(200), 100, replace=T)
k <- rep.int(c("locA", "locB", "locC", "locD"), 25)
tapply(v, k, summary)
### example:end
Maybe this could be a solution:
t1 <- tapply(v, k, summary)
t2 <- sapply(t1, cbind)
rownames(t2) <- names(t1[[1]])
t2
If I well understand, maybe you have still apply at your disposal:
arrayA <- 1:60
dim(arrayA) <- c(3,4,5)
apply(arrayA, 2, sum)
You have the same result of:
res<-numeric(4);for (i in 1:4) res[i]<-sum(arrayA[,i,])
Ciao,
domenico
PS:
have a look at plyr package for more "slicing" and "applying"
Jason Rupert wrote:
I have a tightly coupled collection of variables with different lengths and types (some characters and others numerics). I looked at the documentation for data.frame, but indicates that it expects all variables to have the same length, i.e. number of elements.
I think you
Alan Smith wrote:
Hello R Users and Developers,
I have a basic question about how R works. Over the past few years I have
struggled when I try to generate a new data frame that I believe should
contain numeric data in some columns and character data in others only to
find everything converted t
gina patel wrote:
I would like to add the greek letter mu to replace u in my title shown below.
main="R=[0.001uM]:A=[750uM]"
i tried using main=expression(R=[0.001~mu~M]:A=[750~mu~M])
plot(1:3, main=expression(paste("R=[0.001~",mu,"~M]:A=[750~",mu,"~M]")))
Ciao,
domenico
but this is not work
Alina Sheyman wrote:
I've downloaded the RcolorBrewer package, but when I try to run
mypalette<-brewer.pal(7,"Greens")
(or any other command with brewer.pal)
I get the following error message - Error: could not find function
"brewer.pal"
Does anyone know why that's happening? Is there smth els
diego Diego wrote:
Dear R experts:
I have a list (a very long one) and I need to create successively txt
outputs (on diferent files ideally) for the data of each component of the
list.
How can I do this?
Maybe this could help you:
list2Files <- list(1:3, letters[1:10], matrix(1:15, 5, 3))
Harsh wrote:
Hi list,
I would like to use ggplot2 in creating a line plot with 4 lines (groups), 2
of which I want in colour and the remaining two as dotted lines.
### R code ###
library(ggplot2)
### create data
vals <- rnorm(400)
div<- c(rep("A",100),rep("B",100),rep("C",100),rep("D",100
Dear All,
is there a way to superimpose points and/or lines on a surface plot?
Below I try to explain my problem.
Suppose I have the following surface plot (likelikood for the normal
variable when both parameters are unknown):
---
Try this:
unSpells[tail(Atr,1)==0] <-
apply(Atr,2,function(x)sum(x==0))[tail(Atr,1)==0]
Or (if you don't have to preserve the value in the unSpells vector):
unSpells <- apply(Atr,2,function(x)sum(x==0))
But in this case you have 0 instead of 1 in the second and fourth position.
Ciao,
domenico
Dear All,
I am working on some slides using LaTeX/Beamer and R/Sweave.
I have the two questions below (sorry if they are stupid or already
solved but I didn't find solutions on the web).
1) Using the following code:
\begin{frame}[containsverbatim]
<>=
help('dim')
@
\end{frame}
I have only:
> h
I know that there are packages implementings the probabilistic expert
systems (the so-called probabilistic networks or bayesian networks).
You find (at least) the following packages:
bnlearn (bayesian network structure learning)
deal (learning bayesian networks with mixed variables)
G1DBN (for dy
If you type
> example(barplot)
you will find an example.
Ciao,
domenico
CHENYS wrote:
> Hi, I'm looking for a tool which can fill bar chart with dash, skewed line,
> or grids, rather than pure color. Any one have the idea how to do that in R?
> Or maybe in Matlab will also be helpful.
>
> Than
You could use ggplot2:
library(ggplot2)
x=rnorm(100)
y=rnorm(100)
df=melt(data.frame(x,y))
#for "vertical" histogram
ggplot(data=df,aes(x=value))+geom_histogram()+facet_grid(.~variable)
#for "horizontal" histogram
ggplot(data=df,aes(x=value))+geom_histogram()+facet_grid(.~variable) +
coord_flip
You could have a look at the reshape package.
Ciao,
domenico
tom soyer wrote:
> Hi,
>
> I am trying to reproduce some functionalities of Excel pivot table in R,
> sadly, I couldn't figure out how to do it. I am wondering if this is even
> possible in R. Does anyone know?
>
> Here is an example:
>
Karin Lagesen wrote:
> I am sorry if this is a faq or tutorial somewhere, but I am unable to
> solve this one.
>
> What I am looking for is a count of how many different
> categories(numbers in this case) that appears for a given factor.
>
> Example:
>
>
>> l <- c("Yes", "No", "Perhaps")
>> x <-
Domenico Vistocco wrote:
> Pilar Loren wrote:
>
>> Hi, is it possible to do a multivariable barplot with ggplot2?
>>
>> I have something like that:
>>
>>
>>
>>> df
>>>
>>>
>>LENGTH
Pilar Loren wrote:
> Hi, is it possible to do a multivariable barplot with ggplot2?
>
> I have something like that:
>
>
>> df
>>
>LENGTH LAT
> 091639 10.002 42.26282
> 091640 30.808 42.26834
> 091641 21.591 42.31689
> 091642 22.030 41.53246
> 091643 22.744 42
Thompson, David (MNR) wrote:
> Hello Hadley,
>
> I am trying to reproduce the following with ggplot:
> a <- seq(0, 360, 5)*pi/180 ; a
> ac <- sin(a + (45*pi/180)) + 1 ; ac
> plot(a, ac, type='b', xaxt = "n")
> axis(1, at=seq(0,6,1), labels=round(seq(0,6,1)*180/pi),1)
> abline(v=
[EMAIL PROTECTED] wrote:
> Hello everyone,
>
> I have an overlay plot it's nice but you can't see all the data. I would
> like to know if there is a way to get a plot that gives a side by side
> plot so that each plot would be next to each other. The two plots have
> the same data are of different
?subset
The select argument allows to select the columns and the subset argument
the rows.
domenico
Laura Hollink wrote:
> Hi all,
> I have a dataframe called 'table' in which both factors and numerical
> values are stored.
>
> > dim(table)
> [1] 990 6
>
> The fist 10 lines of table, to get
tom soyer wrote:
> oops, it should be: rms=(sum((x-mean(x))^2)/(length(x)-1))^(1/2)
>
sd(x) does the same thing.
domenico
> On 1/3/08, tom soyer <[EMAIL PROTECTED]> wrote:
>
>> Thanks Jim. Yes it does... but I calculated the root mean square (rms),
>> and couldn't reproduce the result withou
You should look for your answer using the help for the if statement (?"if").
The cond argument should be a scalar (otherwise only the first element
is used).
?"if"
.
cond: A length-one logical vector that is not 'NA'. Conditions of
length greater than one are accepted with a warnin
You changed the intial letter: the function is qplot and not gplot.
domenico
Ricardo Perrone wrote:
> Hi all,
>
> i installed the ggplot2 package via install.packages(), but the gplot
> function was not recognized in R console command. Is there any paths to
> configure? The error message report
Jonas Malmros wrote:
> Hi, everyone
>
> I wonder if there is a function in R with which I can create a square
> matrix with elements off main diagonal (for example one diagonal below
> the main diagonal).
>
> Thanks in advance!
>
>
You could combine rbind, diag and cbind:
rbind(rep(0,3),cbind(d
From your post it is not clear how the data are organized. Supposing
they are in a data frame you could use the ~ sintax.
For example:
timeColumn=as.Date("01-01-1970") + 1:500
timeSeries=rnorm(500)
df=data.frame(time=timeColumn, index=timeSeries)
> > head(df)
> time index
> 1 1-01-20 -
Sorry, there were mistakes in variable names... (I realized only after
pressed the send button)
Domenico Vistocco wrote:
> dave mitchell wrote:
>
>> Dear all,
>> Possibly a rudimentary question, however any help is greatly appreciated. I
>> am sorting a large matrix
dave mitchell wrote:
> Dear all,
> Possibly a rudimentary question, however any help is greatly appreciated. I
> am sorting a large matrix into an array of dim(p(i),q,3). I put each entry
> into a corresponding matrix (1 of the 3) based on some criteria. I figure
> this will assist me in condens
cut(data, breaks=n)
splits the data in n bins of (approximately) the same size.
The used size is obtained by:
max(data) - min(data)
n
> x=rnorm(x)
> cut(x,breaks=3)
[1] (1.79,9.97] (-6.39,1.79] (9.97,18.2] (9.97,18.2] (-6.39,1.79]
[6] (
The conditional have to be a single element:
> ?"if"
cond: A length-one logical vector that is not 'NA'. Conditions of
length greater than one are accepted with a warning, but only
the first element is used. Other types are coerced to
logical if possible, ignoring
[EMAIL PROTECTED] wrote:
> Hello everyone,
>
> I'll to request some input on what is available for use as an R/Excel
> interface; any help will be appreciated.
>
> Tony.
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing
There is an agreement plot (and a relative measure) in the vcd package.
Maybe it could be useful.
domenico
Ioannis Dimakos wrote:
> Patrik,
>
>
>> help.search("kappa")
>>
>
> is a good place to start. Alternatively,
>
>
>> RSiteSearch("measure of agreement")
>>
>
> provides helpf
If you are using a windows system you could take a look at the
xlsReadWrite packages (there are functions for reading xls files).
domenico
jim holtman wrote:
> ?count.fields
>
> count.fields will tell you how many items are in each line. As you
> said, they should all be the same, but this will
marciarr wrote:
> Hello R users,
> I have been looking through Help files and Nabble list for the answers for
> these simple questions, but it seems to be fruitless.
> 1- in a data frame with two columns, x and y, how do I get the corresponding
> value of x to, let's say, the minimum value of the y
You could use a table with one row and two columns:
HTML("",file=HTMLoutput)
HTML(tab,file=HTMLoutput)
HTML("",file=HTMLoutput)
HTMLInsertGraph(graf,file=HTMLoutput,caption="Esempio di grafico")
HTML("",file=HTMLoutput)
domenico
PS:
You could create a function if this is a common operation:
tab
If you are using correspondence analysis you could see the plot.ca
function in the ca library.
Petr PIKAL wrote:
> Dear all
>
> I tried to make a biplot with color coded labels but I was not successful.
> Searching archives I found that it is probably not so simple.
> I found
> http://tolstoy.ne
http://tolstoy.newcastle.edu.au/R/help/05/06/6104.html
http://tolstoy.newcastle.edu.au/R/help/05/06/6103.html
domenico
faisal afzal siddiqui wrote:
> Pls advise how I can use R in conjoint analysis??
>
> regds
> Faisal Afzal Siddiqui
> Karachi, Pakistan
>
>
>
>
You could use the qqnorm function to obtain the correlation, as:
> qqp=qqnorm(rstudent(regrname))
> cor(qqp$x,qqp$y)
If you do not want see the plot (as the qq.plot is richer):
> qqp=qqnorm(rstudent(regrname), plot.it=F)
domenico vistocco
Tom Fitzhugh wrote:
> Hi,
>
&
> class(fff(x))
[1] "Date"
Perhaps your function use a different input (not a vector of dates but a
dataframe)?
domenico vistocco
Ranjan Bagchi wrote:
> On Wed, 5 Dec 2007, Prof Brian Ripley wrote:
>
>> [...]
>>
>
> Thanks I'll read it more car
This command works:
qplot(x=Categorie,y=Total,data=mydata,geom="bar",fill=Part)
for your data.
domenico vistocco
Stéphane CRUVEILLER wrote:
> Hi,
>
> the same error message is displayed with geom="bar" as parameter.
> here is the output of dput:
>
> >
library(R.utils)
pos=which(diff(x)==1)+1
insert(x,ats=pos,rep(list(rep(0,3)),length(pos)))
domenico vistocco
Serguei Kaniovski wrote:
> Hallo,
>
> suppose I have a vector:
>
> x <- c(1,1,1,2,2,3,3,3,3,3,4)
>
> How can I generate a vector/sequence in which a fixed numbe
4,sep="")
> library(ggplot2)
> dfm=melt(x)
> qplot(as.factor(x=X1),y=value,geom="histogram",data=dfm,fill=X2)
domenico vistocco
Stéphane CRUVEILLER wrote:
> Dear R-Users,
>
> I would like to know whether it is possible to draw several
>
n to set the missing in the third row to 0:
> y[3,,][which(is.na(y[3,,]))]=0
and to set the missing in the other rows to 1:
> y[-3,,][which(is.na(y[-3,,]))]=1
domenico vistocco
Luis Ridao Cruz wrote:
> R-help,
>
> I have a 3-way array:
>
>
>> dim(bugvinP)
>
qplot(data=dataset, x, y, colour=z)
ONKELINX, Thierry wrote:
> Dear useRs,
>
> I'm trying to specify the colour of a factor with ggplot2. The example
> below gets me close to what I want, but it's missing a legend.
>
> Any ideas?
>
> Thanks,
>
> Thierry
>
> library(ggplot2)
> dataset <- data.frame
qplot(data=dataset, x, y, colour=z)
ONKELINX, Thierry wrote:
> Dear useRs,
>
> I'm trying to specify the colour of a factor with ggplot2. The example
> below gets me close to what I want, but it's missing a legend.
>
> Any ideas?
>
> Thanks,
>
> Thierry
>
> library(ggplot2)
> dataset <- data.frame
52 matches
Mail list logo