On 5/21/20 9:24 AM, YANJUN CHEN via R-help wrote:
Dear R community,
I am new to R—did some online tutorials and exercises in R playground. I was
wondering if I could seek guidance on the following matter.
I have a set of 403 .csv files. Each.csv file contains the same layouts and
distinguis
Dear R community,
I am new to R—did some online tutorials and exercises in R playground. I was
wondering if I could seek guidance on the following matter.
I have a set of 403 .csv files. Each.csv file contains the same layouts and
distinguished by subject ID and date in the file name. The datas
__
> De : Chris Evans
> Envoyé : mardi 10 décembre 2019 15:41
> À : Alain Guillet
> Cc : r-help@r-project.org
> Objet : Re: [R] table and unique seems to behave differently
>
> This doesn't answer your question but I get exactly the same vector o
Thanks a lot, it answers my question.
Alain
De : Jeff Newmiller
Envoy� : mardi 10 d�cembre 2019 16:31
� : r-help@r-project.org ; Duncan Murdoch
; Alain Guillet ;
r-help@r-project.org
Objet : Re: [R] table and unique seems to behave differently
I think the
On 10/12/2019 10:32 a.m., Sarah Goslee wrote:
Back to the table part of the question, but using Duncan's example.
x <- c(3.4, 3.4 + 1e-15)
unique(x)
[1] 3.4 3.4
table(x)
x
3.4
2
The question was, why are these different.
table() only works on factors, so it converts the numeric vector t
c : r-help@r-project.org
Objet : Re: [R] table and unique seems to behave differently
This doesn't answer your question but I get exactly the same vector of length
210 with unique(toto) and names(table(toto)) using the same version of R that
you are and I can't see any obvious reason w
Back to the table part of the question, but using Duncan's example.
> x <- c(3.4, 3.4 + 1e-15)
> unique(x)
[1] 3.4 3.4
> table(x)
x
3.4
2
The question was, why are these different.
table() only works on factors, so it converts the numeric vector to a
factor before tabulation.
factor() tries to
I think the question was about table vs unique. Table groups by character
representation, unique groups by the underlying representation.
On December 10, 2019 7:03:34 AM PST, Duncan Murdoch
wrote:
>On 10/12/2019 3:53 a.m., Alain Guillet wrote:
>> Hi,
>>
>> I have a vector (see below the dput)
On 10/12/2019 3:53 a.m., Alain Guillet wrote:
Hi,
I have a vector (see below the dput) and I use unique on it to get unique values. If I
then sort the result of the vector obtained by unique, I see some elements that look like
identical. I suspect it could be a matter of rounded values but tab
To: r-help@r-project.org
> Sent: Tuesday, 10 December, 2019 09:53:29
> Subject: [R] table and unique seems to behave differently
> Hi,
>
> I have a vector (see below the dput) and I use unique on it to get unique
> values. If I then sort the result of the vector obtained b
Hi,
I have a vector (see below the dput) and I use unique on it to get unique
values. If I then sort the result of the vector obtained by unique, I see some
elements that look like identical. I suspect it could be a matter of rounded
values but table gives a different result: unlike unique outp
table converts its non-factor arguments to factors using the exclude
argument that you supply. If you want the arguments to be handled
differently, then convert them to factors
yourself, in the way you want. E.g.,
> with(df, table(x=factor(x, exclude=1), y))
y
x 1 2 3
2 0 1 0
3 1 0 0
>
Hi,
I have a data frame with two variables x, y, both of which take values
in the set {1,2,3}. I'd like to count the frequency by the command "table",
but exclude the value "1" in variable x, but keep "1" in variable y. Is it
possible? When I use "exclude", value 1 in both x and y are excluded
> On Feb 10, 2016, at 7:10 PM, Val wrote:
>
> Hi all,
>
> I want create a frequency table using this :
>
> xc1<- sample(c(1:10), 100, replace = TRUE)
> xc2<- sample(c(0,1), 100, replace = TRUE)
>
> xc3<- cbind(xc1,xc2)
>
> tab1<- xc3[,list( d1=sum(xc2==0), d2=sum(xc2==1)),by=xc1]
>
> but no
Hi Val,
Does this help:
library(plyr)
ddply(as.data.frame(xc3), .variables = "xc1", summarise, d1 = sum(xc2 ==
0), d2 = sum(xc2 == 1))
You could also try
aggregate(xc3, by = list(xc1, xc2), FUN = sum)
and modify the output.
Best,
Ulrik
On Thu, 11 Feb 2016 at 04:12 Val wrote:
> Hi all,
>
>
Hi all,
I want create a frequency table using this :
xc1<- sample(c(1:10), 100, replace = TRUE)
xc2<- sample(c(0,1), 100, replace = TRUE)
xc3<- cbind(xc1,xc2)
tab1<- xc3[,list( d1=sum(xc2==0), d2=sum(xc2==1)),by=xc1]
but not working.
Error in `[.data.frame`(xc3, , list(d1 = sum(xc2 == 1), d2
gston ON Canada
> -Original Message-
> From: marissa.fahlb...@gmail.com
> Sent: Thu, 23 Jul 2015 16:08:10 -0500
> To: r-help@r-project.org
> Subject: [R] Table Looks Funny
>
> Hey, I can't seem to import my csv file in such a way that the table
> looks
> &
Hi Marissa,
Unfortunately we didn't "get the picture". If you want to send an
image, PDF is probably your best bet. If that is not possible, perhaps
a description of the weirdness that has confronted you will allow
someone to suggest a solution.
Jim
On Fri, Jul 24, 2015 at 7:08 AM, Marissa Fahlbe
Hey, I can't seem to import my csv file in such a way that the table looks
"normal". The dimensions are correct, 4x7, and I set my header =TRUE, but
it still looks weird. Attached is the picture. Any ideas??
Thanks!!
-Marissa
__
R-help@r-project.org mai
Hi Jeff,
I don't have that package, but reading the documentation, I think you are
right. Plus the tabular function already has the formatting worked out.
Jim
On Tue, Mar 3, 2015 at 7:26 PM, Jeff Newmiller
wrote:
> I suspect that the tabular function in the tables package would handle
> this t
I suspect that the tabular function in the tables package would handle this
task.
---
Jeff NewmillerThe . . Go Live...
DCN:Basics: ##.#. ##.#. Live Go...
Hi maicel,
This may be completely off the mark, but the brkdnNest function in the
plotrix package can produce a nested list of counts which can be
transformed into percents (100*count/total).
require(plotrix)
data$dummy<-1
brkdnNest(dummy~Provincial+Municipios+unit,data,FUN="sum")
The counts in y
Hello List,
I am trying to obtain a table containing absolute and relative
frequencies but it must be done by strata. Each strata have to contain
totals and subtotals being the sum of the subtotals equal to the total
in upper strata in same column. As this could be some vague I am
includi
You can make make a factor with a common set of levels out of each slice of
the matrix so all the tables are the same size:
f <- function (charMatrix, levels = unique(sort(as.vector(charMatrix
{
apply(charMatrix, 1, function(x) table(factor(x, levels = levels)))
}
used as
> m <- cbind(c("A
On Jul 10, 2014, at 12:03 PM, Jonathan Greenberg wrote:
> R-helpers:
>
> I'm trying to determine the frequency of characters for a matrix
> applied to a single dimension, and generate a matrix as an output.
> I've come up with a solution, but it appears inelegant -- I was
> wondering if there i
R-helpers:
I'm trying to determine the frequency of characters for a matrix
applied to a single dimension, and generate a matrix as an output.
I've come up with a solution, but it appears inelegant -- I was
wondering if there is an easier way to accomplish this task:
# Create a matrix of "factors
On 26/09/2013 10:33 AM, Duncan Murdoch wrote:
On 25/09/2013 11:38 PM, Ben Harrison wrote:
> Hello,
> I am mildly annoyed each time I use a PDF doc of an R package that the
> table of contents hyperlinks are *only* on the page numbers. To activate
> a hyperlink, one must carefully scan sideways fr
On 27/09/13 00:33, Duncan Murdoch wrote:
On 25/09/2013 11:38 PM, Ben Harrison wrote:
Hello,
It's been the way it is for about 14 years, and I don't recall anyone
else complaining, so I'd conclude it must have been set that way with
you in mind.
Ah-hah, I knew it! I *am* special.
More ser
On 27/09/13 00:03, Ista Zahn wrote:
Hi Ben,
On Wed, Sep 25, 2013 at 11:38 PM, Ben Harrison
wrote:
Hello,
I agree that it would be nicer to have the whole TOC entry
hyperlinked. But out of curiosity, why are you using the pdf
documentation? I find the html much nicer.
Best,
Ista
It's ju
On 25/09/2013 11:38 PM, Ben Harrison wrote:
Hello,
I am mildly annoyed each time I use a PDF doc of an R package that the
table of contents hyperlinks are *only* on the page numbers. To activate
a hyperlink, one must carefully scan sideways from the text item wanted
to the far right of the page a
Hi Ben,
On Wed, Sep 25, 2013 at 11:38 PM, Ben Harrison
wrote:
> Hello,
> I am mildly annoyed each time I use a PDF doc of an R package that the table
> of contents hyperlinks are *only* on the page numbers. To activate a
> hyperlink, one must carefully scan sideways from the text item wanted to
Hello,
I am mildly annoyed each time I use a PDF doc of an R package that the
table of contents hyperlinks are *only* on the page numbers. To activate
a hyperlink, one must carefully scan sideways from the text item wanted
to the far right of the page and click on a tiny box. Multiply that mild
On 13-05-20 4:34 AM, James Savage wrote:
Hi all,
Just a quick question:
I want to generate a column of counts of a particular variable. The easiest way
seems to be using table(). For reasonably small amounts of data, there seems to
be no problem.
C <- data.frame(A1 = sample(1:1000, 10, repl
Hi all,
Just a quick question:
I want to generate a column of counts of a particular variable. The easiest way
seems to be using table(). For reasonably small amounts of data, there seems to
be no problem.
C <- data.frame(A1 = sample(1:1000, 10, replace = TRUE), B1 =
sample(1:1000, 10, r
On 11/04/2013 8:40 AM, Paul Miller wrote:
Hello Dr. Murdoch,
Thanks for your reply. Your tables package is interesting. Spent some time
experimenting with it yesterday and it looks like something I can use.
The n(%) format seems to be the standard for what I'm doing. So I can't
directly use t
Hello Dr. Murdoch,
Thanks for your reply. Your tables package is interesting. Spent some time
experimenting with it yesterday and it looks like something I can use.
The n(%) format seems to be the standard for what I'm doing. So I can't
directly use the output your package produces. It does pro
On 10/04/2013 11:59 AM, Paul Miller wrote:
Hello All,
Am learning to create tables with n(%) formatting using R. Below is a working
example. I think this is not bad but wondered if there are better ways of doing
it. Although it can be quite humbling, seeing good code helps me assess my
progre
Hello All,
Am learning to create tables with n(%) formatting using R. Below is a working
example. I think this is not bad but wondered if there are better ways of doing
it. Although it can be quite humbling, seeing good code helps me assess my
progress as an R programmer.
Ultimately want to h
perfect.
thanks for the quick reply
soon yi wrote
> Hi
>
> I have a list such as this
>
> list(c("q","w"),"r",c("r","w"),c("q","w"))
>
> How do i create a table to include the count of groups of terms please?
>
> ie so output is like / similar to
>
> q","w""r" "r","w"
> 2
try this:
> x <-
+ list(c("q","w"),"r",c("r","w"),c("q","w"))
> x
[[1]]
[1] "q" "w"
[[2]]
[1] "r"
[[3]]
[1] "r" "w"
[[4]]
[1] "q" "w"
> # create vectors of what is in the list
> x.v <- sapply(x, paste, collapse = ', ')
> table(x.v)
x.v
q, wr r, w
211
>
On Thu, Jan 3, 2013 at
Hi
I have a list such as this
list(c("q","w"),"r",c("r","w"),c("q","w"))
How do i create a table to include the count of groups of terms please?
ie so output is like / similar to
q","w""r" "r","w"
211
thanks for any help
--
View this message in contex
ces.
Some editors actually offer the option to import a csv file and convert it to
LaTeX, gnumeric (and
possibly LibreOffice) can export to LaTeX, but I would possibly use option 2)
or 1)
Cheers,
Rainer
>
> Thanks Christian
>
>
>
> - Christian Langkamp christian.langka
rate into
> LaTeX, keep their format etc.
>
> Thanks
> Christian
>
>
>
> -
> Christian Langkamp
> christian.langkamp-at-gmxpro.de
>
> --
> View this message in context:
http://r.789695.n4.nabble.com/R-table-as-integrable-object-for-large-Latex-Document
stian
>
>
>
> -
> Christian Langkamp
> christian.langkamp-at-gmxpro.de
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/R-table-as-integrable-object-for-large-Latex-Documents-avoiding-SWeave-tp4640183.html
> Sent from the R help mailing list
CSV style objects that *easily* integrate into
LaTeX, keep their format etc.
Thanks
Christian
-
Christian Langkamp
christian.langkamp-at-gmxpro.de
--
View this message in context:
http://r.789695.n4.nabble.com/R-table-as-integrable-object-for-large-Latex-Documents-avoiding-SWeave-tp4640183
Hi.
You should check function addtable2plot from plotrix package.
Also, here is an example of modified addtable2plot function that I
sometimes use.
This function is probably to far from perfect but, maybe, it will give you
some ideas how to solve your problem:
t2p <- function(x=par("usr")[1],y=
There are functions that allow for the "plotting" of text and R
objects that could be used to plot to a bitmap. Look at the
'addtable2plot' function in the plotrix package and the textplot
function in the gplots package (look for alternative spellings if you
don't find them based on those exact sp
I would like to output a nicely formatted data frame to a bitmap.
Is this possible in R?
--
View this message in context:
http://r.789695.n4.nabble.com/Table-Frame-output-tp4636790.html
Sent from the R help mailing list archive at Nabble.com.
__
R-
Thank you
From: Rui Barradas
To: Sarah Auburn
Cc: r-help@r-project.org
Sent: Monday, 2 July 2012, 17:39
Subject: Re: [R] table function in a matrix
Hello,
See the difference.
a <- b <- c("A", "A", "B", "B", "C", "A", &quo
. Sorry one more query for one of my datasets which has NAs
(missing genotypes). Is there any way in which I can count NAs?
Many thanks!
Sarah
From: Sarah Auburn
To: Petr Savicky
Cc: "r-help@r-project.org"
Sent: Thursday, 7 June 2012, 23:24
Subject: Re: [R] table function in a mat
ct: Re: [R] table function in a matrix
Perfect, thank you!
From: Petr Savicky
To: r-help@r-project.org
Sent: Thursday, 7 June 2012, 19:42
Subject: Re: [R] table function in a matrix
On Wed, Jun 06, 2012 at 11:02:46PM -0700, Sarah Auburn wrote:
> Hi,
> I am trying to get a summary of the cou
Perfect, thank you!
From: Petr Savicky
To: r-help@r-project.org
Sent: Thursday, 7 June 2012, 19:42
Subject: Re: [R] table function in a matrix
On Wed, Jun 06, 2012 at 11:02:46PM -0700, Sarah Auburn wrote:
> Hi,
> I am trying to get a summary of the cou
On Wed, Jun 06, 2012 at 11:02:46PM -0700, Sarah Auburn wrote:
> Hi,
> I am trying to get a summary of the counts of different variables for each
> sample in a matrix of the form "m" below to generate an output as shown.
> (Ultimately I want to generate a stacked barchart for each sample). I am on
Hi,
I am trying to get a summary of the counts of different variables for each
sample in a matrix of the form "m" below to generate an output as shown.
(Ultimately I want to generate a stacked barchart for each sample). I am only
able to get the "table" function to work on one sample (column) at
Hello David,
yes! this is what I was looking for!
Thank you very much for your help.
Marion
2012/4/2 David Winsemius
>
> On Apr 2, 2012, at 7:11 AM, Marion Wenty wrote:
>
> Dear people,
>>
>> I would like to create a table out of a data.frame.
>>
>> How can I determine, which variables are p
On Apr 2, 2012, at 7:11 AM, Marion Wenty wrote:
Dear people,
I would like to create a table out of a data.frame.
How can I determine, which variables are put in the rows and which
in the
columns?
I would like to get all the variables in the ROWS:
I am including a simple example:
D<-data.
Dear people,
I would like to create a table out of a data.frame.
How can I determine, which variables are put in the rows and which in the
columns?
I would like to get all the variables in the ROWS:
I am including a simple example:
D<-data.frame(age=c(8,9,10),county=c("B","W","W"))
the output
Hello,
Thanks to all for your answers.
The solution given by R. Michael was perfect ! Thank you very much, that
helped a lot !
Thomas
On Tue, Feb 28, 2012 at 11:50 AM, Alemtsehai Abate wrote:
> Perhaps, the following does it as well.
>
> (d <- data.frame(x1=letters[2*1:4 - 1], x2=letters[2*1:4]))
Perhaps, the following does it as well.
(d <- data.frame(x1=letters[2*1:4 - 1], x2=letters[2*1:4]))
c(t(d))
Alemtsehai
>> Hello,
>> I am looking for a way to transform an array into a list (or a string).
>> My array has two columns 1 and 2, and I would like to create a list of
the
>> values
My apologies. The last line should have been
with(d, sort(c(as.character(x1), as.character(x2
Regards,
Jorge.-
On Sat, Feb 25, 2012 at 2:03 AM, Jorge I Velez <> wrote:
> Perhaps the following?
>
> d <- structure(list(x1 = structure(1:4, .Label = c("a", "c", "e",
> "g"), class = "factor"),
My apologies: I missed the order of the desired output: the easiest
thing to do is likely to use the same techniques given below (and by
others in this thread) with a transpose t() before.
Michael
On Sat, Feb 25, 2012 at 2:05 AM, R. Michael Weylandt
wrote:
> Your question is not well formed: do
Your question is not well formed: do you want a list or a string
(totally different things)? Or even more likely, a character vector?
What do you have now: is it really an array (=matrix) or is it the
data.frame it looks like?
If it's a matrix:
x <- matrix(letters[1:8], ncol = 2)
x <- as.vector(x
Perhaps the following?
d <- structure(list(x1 = structure(1:4, .Label = c("a", "c", "e",
"g"), class = "factor"), x2 = structure(1:4, .Label = c("b",
"d", "f", "h"), class = "factor")), .Names = c("x1", "x2"), class =
"data.frame", row.names = c("1",
"2", "3", "4"))
with(d, c(as.character(x1), as
Hello,
Try
(d <- data.frame(x1=letters[2*1:4 - 1], x2=letters[2*1:4]))
c(apply(d, 1, identity))
Note that you'll need the concatenation 'c()'.
Hope this helps,
Rui Barradas
--
View this message in context:
http://r.789695.n4.nabble.com/Table-into-a-list-tp4418804p4419091.html
Sent from the
Hello,
I am looking for a way to transform an array into a list (or a string).
My array has two columns 1 and 2, and I would like to create a list of the
values.
Let's say I have :
x1 x2
1 a b
2 c d
3 e f
4 g h
What I would li
d blue
8 8 0.8945757 1230 open blue
(You could have used Dunlap's resutl and tested for both the meanOpen
and meanClosed values being not-is.na.)
--
David
Jeffrey
CC: r-help@r-project.org
From: dwinsem...@comcast.net
To: johjeff...@hotmail.
Hi David,
Totally forgot line 3! So "513 red" should be ok but "420 red" and "917
yellow" aren't.
Jeffrey
> CC: r-help@r-project.org
> From: dwinsem...@comcast.net
> To: johjeff...@hotmail.com
> Subjec
co.com
From: dwinsem...@comcast.net
To: johjeff...@hotmail.com
Subject: Re: [R] Table rearranging
Date: Tue, 7 Feb 2012 09:08:00 -0500
On Feb 7, 2012, at 4:21 AM, Jeffrey Joh wrote:
Thank you for your help, Bill.
From the original table (not the plyr output), I would like to
remove all the line
red" condition has an open measurement, but no closed
measurement. Therefore, line 1 should be deleted.
Jeffrey
> CC: r-help@r-project.org; wdun...@tibco.com
> From: dwinsem...@comcast.net
> To: johjeff...@hotmail.com
> Subject: Re: [R]
ize,
meanClosed=mean(measurement[door=="closed"]),
nClosed=sum(door=="closed"))
--
David
Jeffrey
From: wdun...@tibco.com
To: johjeff...@hotmail.com; r-help@r-project.org
Subject: RE: [R] Table rearranging
Date: Tue, 7 Feb 2012 00:43:
nt, then the Closed yellow should be deleted.
How can I make this change?
Jeffrey
> From: wdun...@tibco.com
> To: johjeff...@hotmail.com; r-help@r-project.org
> Subject: RE: [R] Table rearranging
> Date: Tue, 7 Feb 2012 00:43:25 +
&
0
Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
> Behalf Of Jeffrey Joh
> Sent: Monday, February 06, 2012 4:28 PM
> To: r-help@r-project.org
> Sub
I have a table that looks like this:
measurement date door color
0.93529385 513 open red
0.97419293 420 open red
0.962053514 513 closed red
0.963909937 1230 open blue
0.97652034 1230 open green
0.989310795 1230 closed blue
0.9941022
thank you a lot :)
--
View this message in context:
http://r.789695.n4.nabble.com/Table-Intersection-tp4306968p4309929.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listi
Thank you. I used capture.output(); this is fine.
From: R. Michael Weylandt
Cc: R General Forum
Sent: Wednesday, 18 January 2012, 19:44
Subject: Re: [R] R Table
Capture in what file format / device?
If you want a plain text log, sink() or capture.output
My mistake: MASS::write.matrix() or utils::write.table()
Michael
On Wed, Jan 18, 2012 at 2:44 PM, R. Michael Weylandt
wrote:
> Capture in what file format / device?
>
> If you want a plain text log, sink() or capture.output() probably will
> do it. MASS::write.table() might also help.
>
> I beli
Capture in what file format / device?
If you want a plain text log, sink() or capture.output() probably will
do it. MASS::write.table() might also help.
I believe library(Hmisc) has some functions for converting to LaTeX
tables as well, but I haven't used those myself.
Michael
On Wed, Jan 18, 2
Given a table with colnames and rownames, print(mytable) displays the table
nicely formatted.
How can I capture all of what is displayed as a character matrix?
Thanks.
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
ht
On 01/18/2012 07:25 AM, rantree wrote:
I've got two tables
first one(table1):
ID chromstart end
Ex1 2152 180
Ex2 10 2000 2220
Ex3 15 3000 4000
second one ( table2):
chrom loca
I've got two tables
first one(table1):
ID chromstart end
Ex1 2152 180
Ex2 10 2000 2220
Ex3 15 3000 4000
second one ( table2):
chrom locationname
2 16
On May 26, 2011, at 10:01 AM, David Hugh-Jones wrote:
> Hi all
>
> Just a quick question which I can't find an answer for in the usual places:
> I would like to create a table of regression output, with one or more
> regressions in the columns, a la xtable. But I am using models from the
> Design
Hi all
Just a quick question which I can't find an answer for in the usual places:
I would like to create a table of regression output, with one or more
regressions in the columns, a la xtable. But I am using models from the
Design package. Is there anything out there that will play nicely with th
Sender: r-help-boun...@r-project.org
On-Behalf-Of: j...@bitwrit.com.au
Subject: Re: [R] table() reading problem
Message-Id: <4d81c14a.2000...@bitwrit.com.au>
Recipient: killian.door...@barclayscapital.com
___
e at 1 Churchill Place, London, E
On 03/16/2011 08:20 PM, fre wrote:
I have the following problem:
I have some string with numbers like k. I want to have a table like the
function table() gives. However I am not able to call the first row, the 1,
2, 3, 5, 6 or 9. I tried to do that by a data.frame, but that doesn't seem
to work
On 16/03/11 09:20, fre wrote:
I have the following problem:
I have some string with numbers like k. I want to have a table like the
function table() gives. However I am not able to call the first row, the 1,
2, 3, 5, 6 or 9. I tried to do that by a data.frame, but that doesn't seem
The first
> k<-c(1,1,1,1,1,3,5,6,2,1,3,9,2,3,1,1,1)
> table(k)
k
1 2 3 5 6 9
9 2 3 1 1 1
> names(table(k))
[1] "1" "2" "3" "5" "6" "9"
> as.numeric(names(table(k)))
[1] 1 2 3 5 6 9
> x <- table(k)
> as.numeric(names(table(k)))[4]
[1] 5
You can always save the (numeric version of the) names as an object, too
It isn't entirely clear to me what you want.
table() can function with many kinds of data, not just integers, so it
returns a vector with names.
For your case, with integer classes, you seem to possibly want:
> x <- table(k)
> x <- rbind(as.numeric(names(x)), as.numeric(x))
> x
[,1] [,2] [,3
Dear reader,
I have the following problem:
I have some string with numbers like k. I want
to have a table like the function table() gives. However I am not able
to call the first row, the 1, 2, 3, 5, 6 or 9. I tried to do that by a
data.frame, but that doesn't seem to work either. The levels
I have the following problem:
I have some string with numbers like k. I want to have a table like the
function table() gives. However I am not able to call the first row, the 1,
2, 3, 5, 6 or 9. I tried to do that by a data.frame, but that doesn't seem
to work either. The levels keep bothering me.
This is!
Thank you everyone.
Caveman
On Tue, Mar 15, 2011 at 4:24 PM, Dimitris Rizopoulos <
d.rizopou...@erasmusmc.nl> wrote:
> try the following:
>
> DF <- as.data.frame(matrix(sample(2, 120, TRUE), 10, 12))
>
> Results <- data.frame(
>var = names(DF),
>count = colSums(DF == 1),
>
try the following:
DF <- as.data.frame(matrix(sample(2, 120, TRUE), 10, 12))
Results <- data.frame(
var = names(DF),
count = colSums(DF == 1),
percentage = colMeans(DF == 1)
)
I hope it helps.
Best,
Dimitris
On 3/15/2011 3:13 PM, Orvalho Augusto wrote:
I have a dataset like thi
Try this:
data.frame(count = colSums(x == 1), percentage = colSums(x == 1) / nrow(x))
On Tue, Mar 15, 2011 at 11:13 AM, Orvalho Augusto wrote:
> I have a dataset like this:
>
> q25_1 q25_2 q25_3 q25_4 q25_5 q25_6 q25_7 q25_8 q25_9 q25_10 q25_11
> q25_12
> 1 2 2 1 1 2
I have a dataset like this:
q25_1 q25_2 q25_3 q25_4 q25_5 q25_6 q25_7 q25_8 q25_9 q25_10 q25_11 q25_12
1 2 2 1 1 2 1 2 1 1 2 1 3
2 2 2 2 1 2 1 2 1 1 2 1 2
3 2 1 1 1 2
Running ‘table’ on a factor with levels containing non-ASCII characters
seems to result in *extremely* bad performance on Windows. Here’s a simple
example with benchmark results (I’ve reduced the number of replications to
make the function finish within reasonable time):
library(rbenchmark)
x.
This is a "tableplot", available on R-Forge at
https://r-forge.r-project.org/projects/tableplot/
install.packages("tableplot", repos="http://R-Forge.R-project.org";)
will install, as long as you are using R 2.12.x; otherwise, you'll
have to download the source package and install from source.
-
On Fri, Nov 5, 2010 at 4:45 AM, fugelpitch wrote:
>
> I was just thinking of a way to present data and if it is possible in R.
>
> I have a data frame that looks as follows (this is just mockup data).
>
> df
> location,"species1","species2","species3","species4","species5"
> "loc1",0.44,0.28,0.37,
hn Tukey
> -Oorspronkelijk bericht-
> Van: r-help-boun...@r-project.org
> [mailto:r-help-boun...@r-project.org] Namens fugelpitch
> Verzonden: vrijdag 5 november 2010 9:45
> Aan: r-help@r-project.org
> Onderwerp: [R] table with values as dots in increasing sizes
>
I was just thinking of a way to present data and if it is possible in R.
I have a data frame that looks as follows (this is just mockup data).
df
location,"species1","species2","species3","species4","species5"
"loc1",0.44,0.28,0.37,-0.24,0.41
"loc2",0.54,0.62,0.34,0.52,0.71
"loc3",-0.33,0.75,-0.
for the loop part:
put all your xml files in a directory with no other files,
do
setwd("directory/with/xml/files")
files <- list.files()
for (file in files)
kjetil
2010/10/27 Ista Zahn :
> Hi Jørgen,
> You will be better served by learning how to find the answers to these
> kinds of questions
Hi Jørgen,
You will be better served by learning how to find the answers to these
kinds of questions on your own. You can either use a general search
engine such as google:
http://lmgtfy.com/?q=read+multiple+files+in+R
http://lmgtfy.com/?q=read+xml+data+in+R
or using an R specific search engine. At
1 - 100 of 213 matches
Mail list logo