Displaying 20 results from an estimated 20000 matches similar to: "Grouping data"
2024 Nov 29
3
Trying to get the prior value of a record from a data.frame . . . data.frame
I need to write code that will give me the previous value of from a data.frame. I have written the following code using the shift function from data.table . It does not work. I hope someone can help me correct the code.
###########################
# Try to understand shift #
###########################
if(!require(data.table)) install.packages("data.table")
library(data.table)
# Create
2024 Feb 05
1
Help
Hi,
the command line with 'text' should be:
text(-8,-8, expression(R^2 * " = 0.62, r = 0.79, N = 161"), cex = 2 )
Best,
Kimmo
su, 2024-02-04 kello 17:16 +0100, Jibrin Alhassan kirjoitti:
> Here is the script I used to plot the graph indicating the text I
> wanted to
> insert. The line in the script that I have issues with is: text(-8,-
> 8,
> "R^2=?
2024 Oct 25
1
readLines() and unz() and non-empty final line
Hi,
you could use "scan" instead, it seems to work fine also when wrapped
around "unz".
Or, alternatively, you could use "unzip" instead of "unz". It works as
expected, i.e. reads the last incomplete line and throws a warning about
this.
So it seems to me that "unz" creates a non-blocking connection, whereas
"unzip" creates a
2024 Feb 26
1
igraph_vertex
Hi,
a quick additional note: try
"edge.width= E(.)$weight"
instead of the current "edge.width= network". Seems to work and makes a
visible difference...
HTH,
Kimmo
su, 2024-02-25 kello 19:11 +0000, Kimmo Elo kirjoitti:
>
> Hi again,
>
> your code is still not reproducible without modifications, but I
> succeed in getting the data straight. All
2012 Mar 08
1
Adding mean line to a lattice density plot
Hi!
I have used the following command:
densityplot(~PV1CIV, groups=SGENDER, data=ISGFINC2,
lwd=2, col=1, lty=c(1,2), pch=c("+","o"),
key=list(text=list(lab=levels(ISGFINC2$SGENDER), col=1),
space="bottom", columns=2, border=T, lines=T, lwd=2,
lty=c(1,2), col=1), ref=T, plot.points=F)
to produce a lattice density plot presenting the distribution of
2006 Jan 08
1
lmer with nested/nonnested groupings?
I'm trying to figure out how to use lmer to fit models with factors that
have some nesting and some non-nested groupings. For example, in this
paper:
http://www.stat.columbia.edu/~gelman/research/published/parkgelmanbafumi.pdf
we have a logistic regression of survey respondents' political
preferences (1=Republican, 0=Democrat), regressing on sex, ethnicity,
state (51 states within 5
2024 Mar 22
1
geom_edge & color
Hi,
this seems to work (assuming that your problem was the setting of
colours...):
--- snip ---
network %>%
ggraph(., layout = "auto") +
# This produces an error...
# geom_edge_arc(curvature=0.3, aes(width=(E(network)$weight/10),
color=c("darkblue", "red")[as.factor(edge_list$relationship)], alpha=0.5))
+
# ... this works :-)
2008 May 06
2
Lattice problems / cannot load lattice
Hi,
My problem is simple: since having updated the lattice package, I cannot
load lattice anymore. If I type in the command 'library(lattice)' the
loading fails with the following message:
--- cut here ---
Error in library.dynam(lib, package, package.lib) :
shared library 'lattice' not found
In addition: Warning messages:
1: In loadNamespace(package, c(which.lib.loc,
2008 Sep 25
1
Lattice: how to reduce/shrink plot area
Hi,
is there a command or parameter for reducing the plotting area with
lattice? What I am looking for is an option similar to 'mai' or 'mar'
from the graphs package.
Background: I have plotted several charts with horizontal stacked bars
and now I would like to add info about percentages of each "sub bar"
beneath the plot (with mtext (?) ). So the plot should look
2008 Feb 03
2
(Small) problem with barchart
Hi,
I have a small problem when using barchart. I have the following data:
letters a
6 f 18
1 a 15
10 j 12
9 i 12
4 d 9
5 e 6
The data is from a survey and summaries the alternatives selected in one
question. The idea is to have a bar chart illustrating the count of
each selection in descending order. The data frame is already ordered
in
2024 Feb 25
1
igraph_vertex
Hi again,
your code is still not reproducible without modifications, but I
succeed in getting the data straight. All read.csv-command are missing
'sep="\t"', it is need to read you tsv-data.
And it could be more reproducible if you used e.g.
--- snip ---
aes<-read.csv(text=" A.A B.B C.C D.D E.E F.F
A.A 0 0 5 5 5 5
B.B 4 0 1 1 1 1
C.C 5 5 0 5 4 2
D.D 5 0 5 0 5 3
E.E
2007 Oct 28
1
tree problem
I am trying to use tree to partition a data set. The data set has 3924
observations. Partitioning seems to work for small subsets of the data,
but when I use the entire data set, no partitioning occurs. The
variables are:
RESP respondent to a survey (0 = not a respondent, 1 =
respondent)
AGE_P Age (continuous)
ORIGIN_I Hispanic Ethnicity (1 = Hispanic, 2 = non-Hispanic)
RACRECI2 Race
2012 Aug 02
1
Cannot install the 'igraph' package
Hi!
I want to use R for network analysis and have tried to install the
'igraph' package. Unfortunately, the installation is aborted by an error:
--snip--
gcc -std=gnu99 -I/usr/lib64/R/include -DNDEBUG -I/usr/local/include
-DUSING_R -I. -Ics -Iglpk -Iglpk/amd -Iglpk/colamd -I/usr/local/include
-fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector
-funwind-tables
2008 Mar 18
2
read.dta for files from stata 9.0
Dear R-helpers,
if I want to read a .dta-file generated by stata 9.0 with read.dta
(foreign), I get the message
"not a stata version 5-8 .dta-file". I'm using R-2.6.2 and the latest
version of the foreign package. Has someone any hint?
With many thanks,
Albrecht
2024 Feb 24
1
igraph_vertex
Hi,
first of all, your example was not reproducible! But once I added
"library(igraph)" and "library(scico)" plus generally replaced
"aes_collapsed" by "edge_list", I started to work :-)
Anyway, the error is produced by this line:
+ edge.width= network,
It seems to me that you have forgotten to name a variable here (you now
use the whole network
2024 Sep 27
7
Is there a sexy way ...?
I have (toy example):
x <- list(`1` = c(7, 13, 1, 4, 10),
`2` = c(2, 5, 14, 8, 11),
`3` = c(6, 9, 15, 12, 3))
and
f <- factor(rep(1:3,5))
I want to create a vector v of length 15 such that the entries of v,
corresponding to level l of f are the entries of x[[l]]. I.e. I want
v to equal
c(7, 2, 6, 13, 5, 9, 1, 14, 15, 4, 8, 12, 10, 11, 3)
I can create v
2024 Mar 22
1
geom_edge & color
Dear community
Find enclosed the full working example.
Many thanks
Sibylle
Test_cat.csv
Names
Subcategory_type
sources.cyto
source
Factor
A.A
material
"A"
A
1
B.B
material
"B"
B
1
C.C
regulation
"C"
C
1
D.D
regulation
"D"
D
1
E.E
habitat
"E"
E
1
F.F
cultural
"F"
F
1
Test_adjac.csv
2008 Feb 19
3
simple usage of "for"
Hi list
I have a data frame I would like to loop over. To begin with I would
like crosstabulations using the first variabel in the data frame,
which is called "meriter".
> table(meriter[[1]], meriter[[3]])
ja nej
Annan 0
2009 Jul 20
1
Automatically assign symbol for statistical significance to x given value of x
Dear r-help users,
I am using Sweave and Latex to create tables with output from several
statistical test. As an example: I have a grouping variable "group"
with two levels ("x" and "y") which I compare on variables ("a" and
"b").
I have created a table in which means, standard deviations, and the
statistic and p.value resulting from a t.test is
2011 Jan 14
4
test
Hi, i have that table
Thesis Day A B C
1 0 83.43 90.15 22.97
1 0 85.50 94.97 16.62
1 0 83.36 95.38 20.70
1 0 84.47 92.16 23.58
1 0 83.98 95.33 19.39
1 0 82.86 93.78 24.55
1 0 83.39 92.67 19.56
1 0 85.17 95.24 17.95
1 0 81.62 93.32 28.49
1 0 82.99 92.85 19.73
1 0 81.11 95.67 27.20
1 0 83.39 94.69 16.51
1 0 79.56 89.87 30.39
1 0 80.54 93.32 21.76
1 0 82.11 92.58 22.17
1 14 85.65 94.00 19.19
1 14