Displaying 20 results from an estimated 20000 matches similar to: "Concatenating two vectors into one"
2008 Jun 20
2
Problem with "date"-x-axis in lattice
Hello list,
i am trying to plot a continous variable y against a "date" variable, both 
in one dataframe named "df", using a code like this
library(lattice)
plot1<-xyplot(y~date, data=df, type="b")
"date" is of class "Date", of course, format="%d.%m.%Y", and spans two 
calendar years. The problem is that the x-axis is labeled with
2012 Sep 14
4
concatenating two vectors
Dear all,
I want to concatenate the elements of two vectors such as
a<-c("a1","a2")
b<-c("b1","b2")
and obtain
"a1b1", "a1b2","a2b1","a2b2"
I tried the paste and paste0 functions, but they yielded elementwise
concatenation such as
"a1b1","a2b2"
I am wondering that is there an efficient
2008 Jul 16
2
barchart with bars attached to y=0-line
Dear R users,
i am using the following code to produce barcharts with lattice:
Compound<-c("Glutamine", "Arginine", "Glutamate", "Glycine", "Serine", 
"Glucose", "Fructose", "Raffinose",
"Glycerol", "Galacglycerol", "Threitol", "Galactinol", "Galactitol")
2008 Jul 28
2
axis.break on Date-x-axis in lattice xyplot
Dear list,
i am using the following code to produceĀ  a lattice xyplot, but the 
axis.break-function is seemingly not executed.
Date<-seq(as.Date("2006-08-29"), as.Date("2007-08-28"), by="2 weeks")
Period<-
var1<-rnorm(27, 90000000, 30000000)
var2<-rnorm(27, 500000000,250000000)
var3<-rnorm(27, 1000000,500000)
var4<-rnorm(27, 600000,300000)
2008 Jul 10
2
xYplot customizing y-axis scaling
Dear list,
using the packages Hmisc and lattice i produced some nice xYplots. However, 
since the data range of the conditioning variable is very big, i need to 
define more than one y-scale for the plot (in some panels you just see a 
flat line of data points very close to the x-axis), e.g. different y-axis 
scales for the different rows of the plot.
Is there a way to do so?
Thanks,
Henning  
2009 Jan 16
1
(no subject)
Dear users,
i just installed the lastest version of R, 2.8.1 on my computer (OS Windows 
XP). Then i tried to update the packages copied from my old R version by
>update.packages(ask=F)
However i get the following warning:
"Warning: unable to access index for repository 
http://cran.ch.r-project.org/bin/windows/contrib/2.8
Warning: unable to access index for repository 
2008 Aug 04
1
xyplot strip=function for two conditioning variables
Dear list,
for a data structure like in df:
set.seed(100)
Treatment<-rep(c("Nitrogen","Carbon", "Sulfur"),each=9)
week<-rep(c(1,5,9),3,each=3)
genes<-rep(c("18s", "EF1b", "NR"),9)
copies<-rnorm(27, 1000000,400000)
df<-data.frame(Treatment,week,genes,copies)
i wrote this code for a xyplot:
library(lattice)
2007 Sep 04
2
Recursive concatenation
Colleagues,
I want to create the following array:
	"A1", "A2", "A3", "B1", "B2", "B3", "C1", "C2", "C3"
I recall that there is a trick using "c" or "paste" permitting me to  
form all combinations of c("A", "B", "C") and 1:3.  But, I can't  
recall the
2012 Apr 19
3
How to "flatten" a multidimensional array into a dataframe?
Hi,
I have a three dimensional array, e.g.,
my.array = array(0, dim=c(2,3,4), dimnames=list( d1=c("A1","A2"),
d2=c("B1","B2","B3"), d3=c("C1","C2","C3","C4")) )
what I would like to get is then a dataframe:
d1 d2 d3  value
A1 B1 C1 0
A2 B1 C1 0
.
.
.
A2 B3 C4 0
I'm sure there is one function to do
2009 Mar 20
4
how to make aggregation in R ?
Hi,
I am trying to aggregate the sum of my test data.frame as follow:
testDF <- data.frame(v1 = c("a", "a", "a", "a", "a", "b", "b", "b", "b",
"b", "c", "c", "c", "c", "c", "d", "d", "d", "d",
2010 Feb 09
2
How can I rearange my dataframe
An embedded and charset-unspecified text was scrubbed...
Name: ???????????
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20100209/db12d14b/attachment.pl>
2005 Aug 15
2
queer data set
I have a dataset that is basically structureless. Its dimension varies 
from row to row and sep(s) are a mixture of tab and semi colon (;) and 
example is
HEADER1 HEADER2 HEADER3   HEADER3
A1       B1      C1       X11;X12;X13
A2       B2      C2       X21;X22;X23;X24;X25
A3       B3      C3       
A4       B4      C4       X41;X42;X43
A5       B5      C5       X51
etc., say. Note that a blank
2005 Jun 03
2
rearrange data
Dear all: 
I have this: 
A1 B1 C1 D1 E1 
A2 B2 C2 D2 E2 
A3 B3 C3 D3 E3 
And I want this 
A1 E1 
B1 E1 
C1 E1 
D1 E1 
A2 E2 
B2 E2 
C2 E2 
D2 E2 
A3 E3 
B3 E3 
C3 E3 
D3 E3 
Example: 
m<- matrix(1:15,nrow=3,byrow=T) 
m 
v<- unlist(list(t(m[,1:4]))) 
u<- rep(c(5,10,15),c(4,4,4)) 
data.frame(v,u) 
This is the result I want but I would like to learn a simpler way to do it. 
Any clue?
2011 Aug 27
3
all combinations of the elements of two vectors
Dear R-help readers,
I'm sure this problem has been answered but I can't find the solution.
I have two vectors
v1 <- c("a","b")
v2 <- c(1,2,3)
I want an easy way to produce every possible combination of v1, v2 elements
Ie I want to produce
c("a1","a2","a3", "b1","b2","b3")
regards
Desmond
Desmond
2010 Dec 06
2
ggplot2: Controlling line width of panel borders
Dear R-users,
i encountered some problems when trying to adjust the line width of the 
axes and stripes in a plot created with ggplot2.
I use the "barley" dataset of the lattice package to illustrate my problem:
library(ggplot2)
library(lattice)
barley[["SD"]] <- 5
limits <- aes(ymax=barley$yield + barley$SD,ymin=barley$yield - barley$SD)
p1 <-
2011 Mar 05
2
Repeating the same calculation across multiple pairs of variables
Hi all,
 
I frequently encounter datasets that require me to repeat the same calculation across many variables. For example, given a dataset with total employment variables and manufacturing employment variables for the years 1990-2010, I might have to calculate manufacturing's share of total employment in each year. I find it cumbersome to have to manually define a share for each year and
2004 Jul 08
2
Getting elements of a matrix by a vector of column indice s
See if the following helps:
> m <- outer(letters[1:5], 1:4, paste, sep="")
> m
     [,1] [,2] [,3] [,4]
[1,] "a1" "a2" "a3" "a4"
[2,] "b1" "b2" "b3" "b4"
[3,] "c1" "c2" "c3" "c4"
[4,] "d1" "d2" "d3" "d4"
[5,]
2017 Aug 07
3
AliasAnalysis: may-alias subcategory
There are function which does have optimization opportunities but because of may-alias memory dependencies sometimes optimization is not effective. May be runtime checks kills the gains of optimization. For such cases aiming to do interprocedural function specialization optimization where in the clone function version no-alias assumption can be assumed and the original function version will hold
2012 Apr 10
1
Matrix problem
Friends
I am extracting sub-sets of the rows of a matrix.  Generally the result is
a matrix.  But there is a special case.  When the result returned is a
single row it is returned as a vector (in the example below an integer
vector).  If there are 0, or more than 1 rows returned the result is a
matrix.
I am doing this in a function and I cannot be sure how many rows I am
removing.  How can I do
2005 Apr 20
1
newby trying to solve a system
Dear R-gurus,
being very new to R, (as well as lazy and not too smart !) I have some 
problems (and get lost in the docs)  trying to write something to find 
the 9 values (A1,B1,C1,A2,B2,C2....C3) which are solutions of a 12 
equations system of the form :
 > x1-(A1/(A1+B1+C1)) = 0
 > y1-(B1/(A1+B1+C1))= 0
 > z1-(C1/(A1+B1+C1)) = 0
 > 3 same equations with subscript 2
 > 3 same