Displaying 20 results from an estimated 20000 matches similar to: "conversion of a list of matrices into a dataframe"
2012 Jul 01
2
list to dataframe conversion-testing for identical
HI R help,
I was trying to get identical data frame from a list using two methods.
#Suppose my list is:
listdat1<-list(rnorm(10,20),rep(LETTERS[1:2],5),rep(1:5,2))
#Creating dataframe using cbind
dat1<-data.frame(do.call("cbind",listdat1))
colnames(dat1)<-c("Var1","Var2","Var3")
#Second dataframe conversion
2013 Apr 24
1
matching observations and ranking
Hi,
It is not that clear.
If VAR1 is a match between columns AB001A, AB0002A, VAR2? between AB001A, AB362 and VAR3 between AB0002A and AB362:
Also, I assume row8 match would be taken as 1.
dat1<- read.table(text="
? S.No AB001A AB0002A AB362
?? 1?? -/-??????? C/C?? A/A???????????????????????
??? 2?? C/C??????? C/C?? A/A???????????????????????
??? 3?? C/C??????? C/C??
2010 Jul 29
1
(no subject)
Dear R Users!
I have a dataframe with duplicate cases. Var1 duplicated by var2.
var1 var2 var3 var4 var5 var6 1 4 500 1 2 a 1 3 200 2 5 b 1 8 125 1 9 b
2010 Jul 29
1
duplicates
Sorry!
I try it again
Dear R Users!
I have a dataframe with duplicatecases. Var1 duplicated by var2.
var1 var2 var3 var4 var5
1 4 500 1 2
1 3 200 2 5
1 8 125 1 9
2 2 120 2 52
2 6 22 1 20
2 9 400 1 22
3 1 100 2 8
3 2 200 5 40
4
2010 Jul 29
3
Fwd: duplicates
-- Eredeti üzenet --
Feladó: Dévaványai Agamemnón <devavanyai@citromail.hu>Címzett: r-hel@r-project.org, r-hel@r-project.orgElküldve: 2010. július 29. 16:29Tárgy : duplicates
Sorry!
I try it again
Dear R Users!
I have a dataframe with duplicatecases. Var1 duplicated by var2.
var1 var2 var3 var4 var5
1 4 500 1 2
1 3 200 2 5
1
2008 Aug 07
2
List of "occurrence" matrices
R users,
I don't know if I can make myself clear but I'll give it a try. I have
a data.frame like this
x <- "var1,var2,var3,var4
a,b,b,a
b,b,c,b
c,a,a,a
a,b,c,c
b,a,c,a
c,c,b,b
a,c,a,b
b,c,a,c
c,a,b,c"
DF <- read.table(textConnection(x), header=T, sep=",")
DF
and I would like to sum all the combinations/occurences by a factor
(letter in this case) between
2009 Nov 25
1
Sampling dataframe
Hi,
I have a table like that:
> datatest
var1 var2 var3
1 1 1 1
2 3 1 2
3 8 1 3
4 6 1 4
5 10 1 5
6 2 2 1
7 4 2 2
8 6 2 3
9 8 2 4
10 10 2 5
I need to create another table based on that with the rules:
take a random sample by var2==1 (2 sample rows for example):
var1 var2 var3
1 1
2013 Nov 27
0
MANOVA Question
I'm running a MANOVA on survey data. The dependent variables are the
ranking of each DV. So the respondent was asked to rank 7 different
subject lines, each subject line is a DV with what the respondent ranked as
datum.
I had the code running yesterday, had a computer crash, then had to rewrite
plus append some new data. Now it's not working.
And I didn't think I'd run into a
2004 Dec 07
1
how to test the existence of a name in a dataframe
I wanted to test if there exists already a name (which is
incidentally a substring of another name) in a dataframe.
I did e.g.:
> data(swiss)
> names(swiss)
[1] "Fertility" "Agriculture" "Examination" "Education"
[5] "Catholic" "Infant.Mortality"
> ! is.null(swiss$EduX)
[1] FALSE
> !
2004 Sep 13
1
Adding ranks to a repeatedly ragged array
How can I add an extra column containing the rank
to a ragged array indexed by more than one grouping
factors?
E.g. with the barley dataset:
How can I to add an additional column ``rank''
containing the rank of the ``yield'' of
the different varieties in relation to the indices
``year'' and ``site'' to the barley dataframe?
I achieved to calculate the ranks with:
2008 Jan 24
3
Reshaping a dataframe with conditional summary of columns - apply or reshape?
I need to do a somewhat complex rearrangement of an existing dataframe that
involves an "on-the-fly" conditional summary as well. I've tried to make
the example as simple as possible. Code to produce the object being acted
on is at the end of the message. I hope this isn't too much for a single
posting. Any guidance will be much appreciated.
The input example looks like
2011 Oct 14
1
Selecting multiple vectors from a list of lists of matrices
Hi all,
I was unable to find a solution to my problem in the archives, but this might be due to a lack knowledge on the correct terminology on my part. Please forgive me if this has been explained before and please forgive me my probably clumsy way of explaining things.
This is what I want to do:
I have a list made up of 6 lists containing 7 4x4 matrices each.
My goal is to select a large
2010 Mar 18
1
Using a function to consolidate variables
Dear List,
I'm getting the error: object of type 'closure' is not subsettable
And am not sure how to get around the problem. I've included two
short code sets below. One that shows what I want to do and works,
but without using the function much, and another that tries to use the
function but causes the error.
# THIS WORKS AND SHOWS WHAT I'D LIKE TO DO
a <- c(1,2,3)
b
2011 Jun 24
1
Converting an ftable (contingency table) to a dataframe in R
I am generating an ftable (by running ftable on the results of a xtabs command) and I am getting the following.
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Var1? Var2
date ? ? ? ? ? ? ? ? group? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
2007-01-01? ? ? ? ? q1 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?1? ? 9
? ? ? ? ? ? ? ? ? ? ?q2 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
2008 Oct 10
1
Correlation among correlation matrices cor() - Interpretation
Hello,
If I have two correlation matrices (e.g. one for each of two treatments) and
then perform cor() on those two correlation matrices is this third
correlation matrix interpreted as the correlation between the two
treatments?
In my sample below I would interpret that the treatments are 0.28
correlated. Is this correct?
> var1<- c(.000000000008, .09, .1234, .5670008, .00110011002200,
2002 Nov 11
2
repeating a dataframe n times in the direction of the rows
Question:
How can a repeat a dataframe n times
in the direction of the rows?
(Or: How I can rbind a dataframe n times ?)
Example Data:
x <- data.frame( alpha=letters[1:3], num=1:3 )
n <- 4
Complicated solution: To rbind a dataframe n times I can program a loop:
xr <- x
for( i in 2:n ) xr <- rbind( xr, n )
Observation: To cbind a dataframe n times I
2011 Mar 18
1
help please: put output into dataframe
Dear R community members
I have been struggling on this simple question, but never get appropriate
solution. So please help.
# my data, though I have a large number of variables
var1 <- rnorm(500, 10,4)
var2 <- rnorm(500, 20, 8)
var3 <- rnorm(500, 30, 18)
var4 <- rnorm(500, 40, 20)
datafr1 <- data.frame(var1, var2, var3, var4)
# my unsuccessful codes
nvar <- ncol(datafr1)
2010 Feb 12
2
Access dataframe with variable name in function
Sorry guys, but I have another one:
I want to write a function that returns a certain column of a
dataframe. The function accepts two argument: the dataframe and the
name of the column, but the column is not given as a "string" but as
a variable name.
EXAMPLE
----------------------
> testdata
start stop censor groupvar var1 var2
1 0 1 0 1
2006 Oct 23
1
Lmer, heteroscedasticity and permutation, need help please
Hi everybody,
I'm trying to analyse a set of data with a non-normal response, 2 fixed
effects and 1 nested random effect with strong heteroscedasticity in the
model.
I planned to use the function lmer : lmer(resp~var1*var2 + (1|rand)) and
then use permutations based on the t-statistic given by lmer to get
p-values.
1/ Is it a correct way to obtain p-values for my variables ? (see below)
2005 Nov 29
1
Indexing variables within lapply?
Hello
I am using R 2.2.0 with Windows XP.
I've got a five element list object, each element containing two
dataframes of equivalent size.
> str(mylist)
List of 1
$ data1:List of 2
..$ data1a :`data.frame': 77 obs. of 63 variables:
.. ..$ var1 : num [1:77] 0.41375 0.00056 1.43040 1.43528 0.61730 ...
.. ..$ var2 : num [1:77] 1.154 1.686 0.673 0.800 0.760 ...
..