Displaying 20 results from an estimated 11000 matches similar to: "how to remove the names in the list result"
2006 Nov 22
1
how to merge these dataframes
Hi,
Having 3 dataframes with different row numbers, but equal column names
(see below) I want to merge them by Var1 so I've tried:
merge(j1,j2,j3,by="Var1")
merge(j,j1,j2,by=names("Var1"))
But always got the same message:
Erro en fix.by(by.x, x) : 'by' must specify column(s) as numbers, names
or logical
What I'm doing wrong?
Thanks,
Antonio
j1
2009 Sep 19
2
Counting observations of a combined factor
#I have a dataset with two factor. I want to combine those factors into
a single factor and count the number of data values for each new factor.
The following gives a comparable dataframe:
a <- rep(c("a", "b"), c(6,6))
b <- rep(c("c", "d"), c(6,6))
df <- data.frame(f1=a, f2=b, d=rnorm(12))
df
# I use the 'interaction' function to combine
2009 Jan 13
3
Comparing elements for equality
Suppose I have a dataframe as follows:
dat <- data.frame(id = c(1,1,2,2,2), var1 = c(10,10,20,20,25), var2 =
c('foo', 'foo', 'foo', 'foobar', 'foo'))
Now, if I were to subset by id, such as:
> subset(dat, id==1)
id var1 var2
1 1 10 foo
2 1 10 foo
I can see that the elements in var1 are exactly the same and the
elements in var2 are exactly
2012 Nov 22
1
ggplot2 and the legend
Dear all,
i try to plot with ggplot2. Therefor I have an matrix with 3 colums. With cbind I add an additional column called "col". I need this column "col" because in a later step and want to specify here some plot details which I will get from another analysis
If I want to plot with this code, I have the problem that the legend is wrong.
Blue changed to green and green to
2012 Sep 19
2
Data Frame (Very Simple Problem)
Hi List Members,
This is a very stupid problem but I am not able to know what the solution
can be.
I am trying to run a query like below
*Program Flow :*
1. a <- data.frame(table( cut( Sys.time() + seq(0,82800,3600), "60 mins")
)) # It generates the 60 minute intervals. Thanks David
2. b <- data.frame(a$Var1)
# To extract only First Column i.e.
2009 Feb 27
3
Making tapply code more efficient
Previously, I posed the question pasted down below to the list and
received some very helpful responses. While the code suggestions
provided in response indeed work, they seem to only work with *very*
small data sets and so I wanted to follow up and see if anyone had ideas
for better efficiency. I was quite embarrased on this as our SAS
programmers cranked out programs that did this in the blink
2006 Nov 26
1
adding elemens to a list
Hi,
I have a list of 20 elements, each of them of variable length and with a
structure like this:
lasker[[1]][1:10,]
Var1 Freq
1 1988-02 3
2 1988-03 1
3 1988-04 1
4 1988-05 2
5 1988-06 3
6 1988-07 1
7 1988-08 1
8 1988-09 1
9 1989-03 1
10 1989-04 1
How do I can insert in this list:
1988-01 0
1988-10 0
1988-11 0
1988-12 0
1989-01 0
2009 Dec 15
1
Changing Column names in (Output) csv file
Dear R helpers
Following is a part of R code.
data_lab <- expand.grid(c("R11", "R12", "R13"), c("R21", "R22", "R23"), c("R31", "R32", "R33"), c("R41", "R42", "R43"), c("R51", "R52", "R53"), c("R61", "R62", "R63"),
2008 Dec 24
2
Using 'cat' on data frame
Dear all,
I have the following data frame:
> raw.count
Var1
Freq
1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 707
2 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAC 14
3 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAT 3
But why when printint it using 'cat', it doesn't print
the desired string "AAA" ?
> cat(raw.count$Var1,
2012 Sep 06
4
Why the error is coming, can anyone help?
Hi everyone
Can anyone help?
x = c("Treatment", "Planned", "Actual", "Demographics", "Outcomes")
for (i in x) {
df <- paste(i)[, c("Reference_ID", "Arm_ID")]
unique(df) -> uniq
as.data.frame(table(uniq$Reference_ID)) -> y
i.Arms<- paste(y$Var1, y$Freq, sep="_")
Print_Message("Check for the Total No of
2008 Nov 16
1
Are you sure a table can become a data.frame?
Hi R users,
Imagine X as a data frame:
X=read.table(textConnection("
Var1 Var2
1 A H
2 B K
3 A H
4 B H
5 C L
"),header=TRUE)
closeAllConnections()
X X is a data frame
Var1 Var2
1 A H
2 B K
3 A H
4 B H
5 C L
Y<-table(X$Var1,X$Var2) Y is a cross table between Var1 and Var2
2013 May 25
3
When creating a data frame with data.frame() transforms "integers" into "factors"
Hello
I am novice to R and i was learning how to do a scatter plot with R using
an example from a website.
My setup is iMac with Mac OS X 10.8.3, with R 3.0.1, default install,
without additional packages loaded
I created a .csv file in vim with the following content
userID,user,posts
1,user1,581
2,user2,281
3,user3,196
4,user4,150
5,user5,282
6,user6,184
7,user7,90
8,user8,74
9,user9,45
2010 Feb 05
2
sum a particular column by group
Dear all,
I have a table like this:
> eds
R.ID Region Gender Agegr Time nvisits
1 1 A F 60--64 1:00 1
2 2 O F 55--59 1:20 1
3 3 O F 55--59 3:45 3
4 4 S M 60--64 1:10 3
5 5 W F 55--59 12:30 1
6
2013 Jan 24
3
From table to data.frame
Hello,
I have a dataframe (test.df) with intervals that were generated by table
(see below). I would prefer a dataframe labeled like this:
> test.tab <- table(cut(skn.test$density, seq (0,1, by=0.05)))
> test.tab
(0,0.05] (0.05,0.1] (0.1,0.15] (0.15,0.2] (0.2,0.25] (0.25,0.3]
(0.3,0.35]
68 87 85 72 65 73
74
(0.35,0.4] (0.4,0.45]
2004 Oct 28
3
Table question
I have a table (output from table(factor1,factor2)). I would like to
use write.table to output that table to a file. However, it seems that
as.data.frame converts such a table to three columns, Var1, Var2, and
Freq rather than converting to the data.frame with equivalent numbers
of rows and columns. I can use write.matrix from the MASS package, but
then I get no rownames. Any hints here?
2010 Jan 30
2
aggregate by factor
I have a data frame with two columns, a factor and a numeric. I want to create data frame with the factor, its frequency and the median of the numeric column
> head(motifList)
events score
1 aeijm -0.25000000
2 begjm -0.25000000
3 afgjm -0.25000000
4 afhjm -0.25000000
5 aeijm -0.25000000
6 aehjm 0.08333333
To get the frequency table of events:
> motifTable <-
2007 Jul 13
1
counting occurances of matching rows in a matrix
I need help regarding to the following problem:
Consider this matrix:
> M <- matrix(c(1,2, 4,3, 1, 2),3, 2, byrow=TRUE)
> M
[,1] [,2]
[1,] 1 2
[2,] 4 3
[3,] 1 2
I would like to have a matrix which counts the identical rows and places the counts into its third column. I tried with ftable():
> as.data.frame(ftable(M[,1], M[,2]))
Var1 Var2 Freq
1 1 2
2005 Jan 26
2
Linear Trend Analysis?
Hi all --
I'm trying to use R for my "Analysis of Categorical Data" class, but I
can't figure out how to do a weighted linear trend analysis. I have a table
of categorical data, to which I've assigned weights to the rows and columns.
I need to calculate r and M^2, which is apparently done in SAS using "PROC
FREQ" and in STATA using "correlate var1 var2
2011 May 19
2
trouble with summary tables with several variables using aggregate function
Dear all,
I am having trouble creating summary tables using aggregate function.
given the following table:
Var1 Var2 Var3 dummy
S1 T1 I 1
S1 T1 I 1
S1 T1 D 1
S1 T1 D 1
S1 T2 I 1
S1 T2 I 1
S1 T2 D 1
S1 T2 D 1
S2
2005 Nov 12
1
how to make automatically each level from data.frame to vector
Dear R-helpers,
Suppose I have dataset like this below:
data(HairEyeColor)
dfHEC <- as.data.frame(as.table(HairEyeColor))
my.dfHEC <- data.frame(Hair=rep(dfHEC$Hair,dfHEC$Freq),
Eye=rep(dfHEC$Eye,dfHEC$Freq),
Sex=rep(dfHEC$Sex,dfHEC$Freq))
my.dfHEC
my.dfHEC$Hair
my.dfHEC$Eye
my.dfHEC$Sex
and I know all levels for Hair, Eye and Sex.
In my case, I