Displaying 20 results from an estimated 600 matches similar to: "string split at xth position"
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
2009 Jan 30
2
reshape with two time variables
I have a data frame in wide format that I'd like to convert to long format.
For example, in wide format I have:
id A1B1 A1B2 A2B1 A2B2
1 1 400 475 420 510
2 2 390 500 470 472
3 3 428 512 555 610
4 4 703 787 801 822
5 5 611 634 721 705
6 6 543 522 612 788
7 7 411 488 506 623
8 8 654 644 711 795
A is one repeated-measures variable with levels 1 and 2. B is a second
repeated-measures variable
2010 Jan 03
1
Anova in 'car': "SSPE apparently deficient rank"
I have design with two repeated-measures factor, and no grouping
factor. I can analyze the dataset successfully in other software,
including my legacy DOS version BMDP, and R's 'aov' function. I would
like to use 'Anova' in 'car' in order to obtain the sphericity tests
and the H-F corrected p-values. I do not believe the data are truly
deficient in rank. I
2012 Mar 21
2
Type II and III sum of squares (R and SPSS)
To whom it may concern
I made some analysis with R using the command Anova. However, I found
some problmes with the output obtained by selecting type II o type III
sum of squares.
Briefly, I have to do a 2x3 mixed model anova, wherein the first factor
is a between factor and the second factor is a within factor. I use the
command Anova in the list below, because I want to obtain also the sum
2010 Jul 02
4
Some questions about R's modelling algebra
Hi all,
In preparation for teaching a class next week, I've been reviewing R's
standard modelling algebra. I've used it for a long time and have a
pretty good intuitive feel for how it works, but would like to
understand more of the technical details. The best (online) reference
I've found so far is the section in "An Introduction to R"
2004 Jun 15
4
"Glueing" factors together
Hi folks,
Suppose I have a series of cases each with categorical
factors A, B.
What is the best way to "glue" A and B together into a single
factor? For example, given
A0 B1 ...
A1 B1 ...
A0 B2 ...
A1 B0 ...
A0 B0 ...
A1 B2 ...
then I'd like to end up with a single factor with levels
A0B0, A0B1, A0B2, A1B0, A1B1, A1B2
according to all the combinations which actually occur in
2012 Sep 27
4
Colsplit, removing parts of a string
Hi,
I am using colsplit (package = reshape) to split all strings
in a column according to the same patterns. Here
an example:
library(reshape2)
df1 <- data.frame(x=c("str1_name2", "str3_name5"))
df2 <- data.frame(df1, colsplit(df1$x, pattern = "_", names=c("str","name")))
This is nearly what I want but I want to remove the words
2012 Dec 11
5
Renaming column names according to another dataframe
Hi,
I've got a dataframe having a code as column name.
Addtionally I have another dataframe with a two columns (and lots of
rows), the first
containing the code and the second some Text (real name).
Now I'd like to use the information (pairs of code and name) of the
second dataframe to rename all the columnnames in the first dataframe.
How is it possible to achieve that?
Here a small
2013 Jan 11
3
split & rbind (cast) dataframe
Hi,
I would like to split dataframe based on one colum and want
to connect the two dataframes by rows (like rbind). Here a small example:
# The orgininal dataframe
df1 <- data.frame(col1 = c("A","A","B","B"),col2 = c(1:4), col3 = c(1:4))
# The datafame how it could look like
df2 <- data.frame(A.col2 = c(1,2), A.col3 = c(1,2), B.col2 = c(3,4),
B.col3
2013 Jun 26
1
Error when using median as aggregation function in dcast
Hi,
I am trying to calculated various summary statistics using the dcast
function
of reshape2. This works perfectly for getting the mean, sum, length, sd. But
when I want to calculate the median I get an error. I tried it with and
without removing
NAs:
my_median <- function(x) median(x, na.rm = FALSE)
median_df <- dcast(patch_stats_dfm,formula=species~input+barriers,my_median)
Error in
2013 Jun 26
1
Margins in dcast (reshape2)
Hi,
I'd like to get mean values for the margins of my casted data.frame.
For the casting I am using dcast() from reshape2. However, when I set
the margins parameter (margins=c("grand\_row")) I get following error
concerning
an unrecognized escape character '\_'. So what is the correct command
to get the outermost margins only in reshape2?
/johannes
[[alternative HTML
2013 Mar 07
1
Colour branches/labels of dendrogram according to a grouping variable
Hi,
is there a way to color the branches or text label of the branches of
dendrograms e.g. from hclust() according to a grouping variable. Here
I have something in mind like:
http://www.sigmaaldrich.com/content/dam/sigma-aldrich/life-science/biowire/biowire-fall-2010/proteome-figure-1.Par.0001.Image.gif
(ectodermal, endodermal, mesodermal).
/johannes
2006 Apr 10
3
SE estimates for treatment groups from nlme
I am wondering how to obtain SE estimates for fixed effects from a nonlinear mixed effects model?
I have fixed effects corresponding to three factors A, B and C with 2, 3 and 3 levels respectively. I have fit a model of the following general form:
nlme1<-nlme(y~ SasympOrig(x, Asym, lrc), data=df, fixed=list(Asym~A*B*C, lrc~A*B*C),
start=c(fixef(ETR.nlme)[1], rep(0,17), fixef(ETR.nlme)[2],
2013 Oct 08
3
Latin Hypercube Sample and transformation to uniformly distributed integers or classes
Hi,
I'd like to use Latin Hypercube Sampling (LHC) in the the context of
uncertainty / sensitivity analysis of a complex model with approximately 10
input variables. With the LHC approach I'd like to generate parameter
combinations for my model input variables.
Therefore I came across an simple example here on the mailing list (
2003 May 02
1
Admin issues the Xth..
Hi there.
I just switched from icecast1 to icecast2. Right now I'm not sure if
that was a very good idea. I do like the ogg-support, but I lack a good
amount of documentation (Hey, I'd be glad to help you out, but how can
there be consistent documentation for a software that is only available
through cvs(-snapshots)?) and good linux source clients.
I used xmms-liveice or muse before, but
2010 Mar 31
1
position of mismatches in all.equal()?
Dear R users,
I would like to compare two dataframes, actually their categorical
variables (as factors) only (there are 12, from column 1 to 12).
The reason I do that is that I got 2 datasets from two different methods
and I would like to be sure that each method used the same data (3D
images) to extract 2 different sets of 3D parameters. Is it clear so far?
So I thought about using
2012 Feb 08
4
"unsparse" a vector
Suppose I have a vector of strings:
c("A1B2","A3C4","B5","C6A7B8")
[1] "A1B2" "A3C4" "B5" "C6A7B8"
where each string is a sequence of <column><value> pairs
(fixed width, in this example both value and name are 1 character, in
reality the column name is 6 chars and value is 2 digits).
I need to
2011 Mar 30
2
[PATCH] xenstore-stat v2
The entries in xenstore have permission attributes. The
attributes can be easily altered by xenstore-chmod, however,
I cannot find a easy way to see them.
I''ve modified xenstore_client.c to raise a new utility.
The utility checks the permission and makes an easy-look output.
Please tell me any suggestions.
Thanks.
Signed-off-by: Frank Pan <frankpzh@gmail.com>
---
2020 Sep 20
2
expresiones regulares
Hola a tod en s
?alquien sabria como convertir estas frases con expresiones regulares?
1.3ptd -> 1.3 ptd
1.3ptdm -> 1.3 ptdm
4.4ptdm23j -> 4.4 ptdm 23j
7.716s -> 7.7 16s
1.4hola -> 1.4 hola
1.4hola.hola -> 1.4 hola.hola
5.5v6 -> 5.5 v6
5.5v6sdp -> 5.5 v6 sdp
5.5v10sdp -> 5.5 v10 sdp
de forma que esta frase
"hola 1.3ptd 1.3ptdm 4.4ptdm23j 7.716s 1.4hola pepe
2023 Jan 26
2
Resumen de R-help-es, Vol 167, Envío 10
Hola esta es una solución
library(data.table)
library(stringr)
dt <- data.table( V1a = sample(c("1","0"), 10, TRUE)
, V1b = sample(c("1","0"), 10, TRUE)
, V2a = sample(c("1","0"), 10, TRUE)
, V2b = sample(c("1","0"), 10, TRUE)
, V3a =