Displaying 20 results from an estimated 900 matches similar to: "How to split two levels several times?"
2012 Aug 10
4
subsetting levels of a vector
Hi,
I need to subset different levels of vector in a dataset to create a new dataframe that contains only these. These observations are not numerical, so I can't use the subset() function (at least this is the response I get from R).
Suppose the dataframe looks like this:
ParticipID ERP Electrode
1 s1 0.0370 FP1
2 s2 35.0654 FP2
3 s3
2013 Oct 17
1
pamer.fnc y la nueva versión de R
Hola buenas noches,
tengo un problema bastante gordo. ¿A alguno le ha dejado de funcionar las
funciones pamer.fnc y mcp.fnc con la nueva versión de R? La semana pasada
formatee el ordenador y ahora scripts antiguos no funcionan. La cuestión es
que me precupa que no funcione el ejemplo de tutorial del autor.
Os dejo un script que debería de funcionar y no lo hace
2012 Oct 30
2
help with lme
Dear Madam or Sir
I am writing you hoping, that you can help me with a problem concerning the output of regressions done with the function lme in R.
I would need the standard deviations for intercepts and predictors, but in the output I can only find those for the intercepts. Could it be, that this is my fault? (I am just a beginner with R and multilevel modeling).
I am sorry to annoy you with
2010 Apr 16
2
managing data and removing lines
Hi,
I am very new to R and I've been trying to work through the R book to gain a
better idea of the code (which is also completely new to me).
Initially I imputed my data from a text file and that seemed to work ok, but
I'm trying to examine linear relationships between gdist and gair, gdist and
gsub, m6dist and m6air, etc.
This didn't work and I think it might have something to do
2010 Sep 01
1
xyplot (Lattice): Group order in display
Dear R users,
I would like one of my groups in xyplot to appear to lie 'behind' the other
groups. I have searched for help and find many, many topics about panel
order (e.g., "as.table"), but that is not what I need.
What is odd is that the group that I want to appear 'behind' the others
(PROFILE) is the last in alphabetical order but xyplot is plotting it first.
Any
2004 Oct 06
3
read.delim problem with trailing spaces
I'm trying to read a comma delimited dataset that uses '.' for NA. I
found that if the last field on a line was a missing '.'
it was not read as NA, but just a '.', and the life variable was made a
factor. The data looks like this,
income,imr,region,oilexprt,imr80,gnp80,life
Afghanistan,75,400.0,4,0,185.0,.,37.5
Algeria,400,86.3,2,1,20.5,1920,50.7
2013 Apr 25
2
Selecting and then joining data blocks
Hi all,
I have 4 matrices, each having 5 columns and 4 rows .....denoted by
B1,B2,B3,B4.
I have generated a vector of 7 indices, say (1,2,4,3,2,3,1} which refers to
the index of the matrices to be chosen and then appended one on the top of
the next: like, in this case, I wish to have the following mega matrix:
B1over B2 over B4 over B3 over B2 over B3 over B1.
1> How can I achieve this?
2007 Feb 08
5
remove component from list or data frame
Sorry to ask such a simple question, but I can't find the answer after
extensive searching the docs and the web.
How do you remove a component from a list? For example say you have:
lst<-c(5,6,7,8,9)
How do you remove, for example, the third component in the list?
lst[[3]]]<-NULL generates an error: "Error: more elements supplied
than there are to replace"
Also,
2013 Sep 05
2
binary symmetric matrix combination
Hi,
May be this helps:
m1<- as.matrix(read.table(text="
y1 g24
y1 0 1
g24 1 0
",sep="",header=TRUE))
m2<-as.matrix(read.table(text="y1 c1 c2 l17
?y1 0 1 1 1
?c1 1 0 1 1
?c2 1 1 0 1
?l17 1 1 1 0",sep="",header=TRUE))
m3<- as.matrix(read.table(text="y1 h4??? s2???? s30
?y1 0 1 1 1
?h4 1 0 1 1
?s2 1 1 0 1
?s30 1 1 1
2012 Jan 11
3
turning a list of vectors into a data.frame (as rows of the DF)?
As a newer R practicioner, it seems I stump myself weekly (at least) with issues that have spinning my wheels. Here is yet another... I'm trying to turn a list of numeric vectors (of uneual length) inot a dataframe. Each vector held in the list represents a row, and there are some rows of unequal length. I would like NAs as placeholders for "missing" data in the shorter vectors.
2007 Jul 18
1
Neuman-Keuls
hello,
I have programmed this function to calculate the Neuman-Keuls test but I have a problem the function return an empty list and I don't know why.
summary(fm1)
E <- sqrt((summary(fm1)[[1]]["Residuals","Mean Sq"])/length(LR))
lst <- list()
lst1 <- list()
lst2 <- list()
NK <- function (x) {
if (length(x) == 2) {
Tstudent <- t.test(subset(exple,
2013 Apr 24
2
Distance matrices Combinations
Dear UseRs,
MY PROBLEM IS A SMALL PIECE OF A REAL BIG AND A COMPLICATED PROBLEM. IF I DELIBERATE IN A VERY SIMPLE WAY THEN ALL I
WANT IS TO PUT ALL THE POSSIBLE COMBINATIONS OF 75 DISTANCE MATRICES (BY TAKING 4 MATRICES, MORE COMMONLY 75C4), in the following equation.
t<-as.matrix((MAT1)^2+(MAT2)^2+(MAT3)^2+(MAT4)^2+,upper=T,diag=T))
Then "1215450" values of "t"(one for
2013 Apr 10
6
means in tables
Hi.
I have 2 tables, with same dimensions (8000 x 5). Something like:
tab1:
V1 V2 V3 V4 V5
14.23 1.71 2.43 15.6 127
13.20 1.78 2.14 11.2 100
13.16 2.36 2.67 18.6 101
14.37 1.95 2.50 16.8 113
13.24 2.59 2.87 21.0 118
tab2:
V1 V2 V3 V4 V5
1.23 1.1 2.3 1.6 17
1.20 1.8 2.4 1.2 10
1.16 2.6 2.7 1.6 11
1.37 1.5 2.0 1.8 13
1.24 2.9 2.7 2.0 18
I need generate a table of averages, the
2012 Aug 10
5
help error histograma
Hi,
My error isErro em hist.default(dados[[1]], freq = TRUE, seq(0, 30, 0.5), prob = FALSE, : some 'x' not counted; maybe 'breaks' do not span range of 'x'
hist(dados[[1]],seq(0, 30, 0.5), prob=TRUE, xlab="chuva (mm/dia)",ylab="frequência", main="", cex.lab=1.6, cex.sub=3,cex.axis=3,cex.main=6)
Someone help me?
[[alternative
2011 Sep 03
3
Saving a list as a Matrix
Hi there.
I went through the manual but I couldn't find a solution for my problem.
I have list like this one :
> lst1
[[1]]
[1] 0 1 2 3
[[2]]
[1] 0 1 5
[[3]]
[1] 2 3 4
and I want to save it as Matrix in Matlab mat format like :
0 1 2 3
0 1 5 0
2 3 4 0
can any body help me ? Appreciate your help and thanks in advance.
Reza
--
View this message in context:
2013 Aug 24
1
Divide the data into sub data on a particular condition
Hi,
Use ?split()
#dat1 is the dataset:
lst1<- split(dat1,dat1$BaseProd)
lst1
#$`2231`
?# BaseProd? CF OSA
#1???? 2231 0.5 0.7
#2???? 2231 0.8 0.6
#3???? 2231 0.4 0.8
#
#$`2232`
?# BaseProd CF OSA
#4???? 2232? 1?? 2
#5???? 2232? 3?? 1
#
#$`2233`
?# BaseProd? CF OSA
#6???? 2233 0.9 0.5
#7???? 2233 0.7 0.5
#8???? 2233 4.0 5.0
#9???? 2233 5.0 7.0
lst1[[1]]
#? BaseProd? CF OSA
#1???? 2231 0.5 0.7
2013 Sep 27
3
Compare species presence and absence between sites
Dear List,
I want to compare the presence and absence of bird species based on the
sites in a matrix.
The matrix has 5 rows for Island A, B, C, D, and E.
It has 100 columns for bird species D001-D100.
In each cell of the matrix,
the presence-absence of bird species will be recorded as 1 or 0.
(For example, if species D001 is found on Island D,
the matrix cell of species D001 and Island D
2013 Mar 26
2
GAM model with interactions between continuous variables and factors
Hi all,
I am not sure how to handle interactions with categorical predictors in the
GAM models. For example what is the different between these bellow two
models. Tests are indicating that they are different but their predictions
are essentially the same.
Thanks a bunch,
> gam.1 <- gam(mortality.under.2~ maternal_age_c+ I(maternal_age_c^2)+
+ s(birth_year,by=wealth) +
+
2008 Oct 01
3
lapply where each list object has multiple parts
Hi. I have a list where each object in the list has multiple parts. I'd
like to take the mean of just one part of each object. Is it possible to do
this with lapply? If not, can you recommend another function? Thanks.
eric
> x1 <- c(0,1,2,3)
> x2 <- c(7,8)
> x3 <- c(2,6,6,8)
> x4 <- c(4,8)
>
> Lst1 <- list(label1 = x1,label2 = x2)
> Lst2 <-
2009 Sep 29
1
Comparing vectors from lists
Hi guys,
I still did not solve my problem properly! I have to compare the values of two lists of 250 numbers as a result of using the ?by function!
List1 of 250
$ 0 : num [1:28] 22 11 31...
$ 1 : num [1:15] 12 14 9 ...
..
..
..
- attr(*, "dim")= int 250
- attr(*, "dimnames")=List of 1
List2 of 250
$ 0 : num [1:24] 20 12 22...
$ 1 : num [1:17] 11 12 19 ...
..
..