Displaying 20 results from an estimated 124 matches for "usarrest".
Did you mean:
usarrests
2010 Nov 25
1
RODBC
...but I am having an error.
library(RODBC)
library(termstrc)
path = getwd()
setwd(getwd())
dbName = "data.mdb"
pathdbname = paste(path,"/",dbName,sep="")
accesChannel = odbcConnectAccess(pathdbname, uid = "", pwd = "")
sqlSave(accesChannel, USArrests, rownames = "state", addPK=TRUE)
sqlFetch(accesChannel , "USArrests", rownames = "state") # get the lot
foo <- cbind(state=row.names(USArrests), USArrests)[1:3, c(1,3)]
foo[1:3,2] <- 9999
sqlUpdate(accesChannel , foo, "USArrests")
The sqlSave and s...
2002 Jan 27
5
EPS->LaTeX problem
...9;m using graphicx to include the file:
\usepackage{graphicx}
...
\resizebox{\textwidth}{\textheight}{\includegraphics{crime.eps}}
When I do this, the entire slide (including the page number) is rotated
180 degrees. Any ideas why this happens?
The graph was created using the syntax in R:
data(USArrests)
postscript(file="crime.eps")
plot(USArrests$Murder, USArrests$Assault)
abline(lm(USArrests$Assault ~ USArrests$Murder))
dev.off()
Thanks for any advice. This is rather urgent, as I'm trying to use it for
a lecture in my class Monday morning.
ap
-----------------------------------...
2003 Jul 15
2
"na.action" parameter in princomp() (PR#3481)
Full_Name: Jerome Asselin
Version: 1.7.1
OS: Red Hat Linux 7.2
Submission from: (NULL) (24.77.125.119)
Setting the parameter na.action=na.omit should remove
incomplete records in princomp. However this does not
seem to work as expected. See example below.
Sincerely,
Jerome Asselin
data(USArrests)
princomp(USArrests, cor = TRUE) #THIS WORKS
USArrests[1,3] <- NA
princomp(USArrests, cor = TRUE, na.action=na.omit) #THIS FAILS!
#Error in cov.wt(z) : x must contain finite values only
2009 Dec 23
1
prcomp : plotting only explanatory axis arrows
Dear all,
I have a very large dataset (1712351 , 20) and would like
to plot only the arrows that represent the
contribution of each variables.
On the sample below I woild like to plot
only the explanatory variables (Murder, Assault..)
and not the sites.
prcomp(USArrests) # inappropriate
prcomp(USArrests, scale = TRUE)
prcomp(~ Murder + Assault + Rape, data = USArrests, scale = TRUE)
plot(prcomp(USArrests))
summary(prcomp(USArrests, scale = TRUE))
biplot(prcomp(USArrests, scale = TRUE))
Thanks a lot,
milton
[[alternative HTML version deleted]]
2004 Nov 25
3
Searching for a string in RSQLite
...e other fixup
that would let me do the queries below? In the real situation I don't
have control over what strings get searched for.
Example based on ?SQLite:
> library(RSQLite)
> m <- dbDriver("SQLite")
> con <- dbConnect(m, dbname = "base.dbms")
> data(USArrests)
> dbWriteTable(con, "USArrests", USArrests, overwrite = T)
[1] TRUE
> state <- "Wyoming"
# this works fine:
> dbGetQuery(con, paste("SELECT * from USArrests where row_names='",state,"'",sep=""))
row_names Murder Assault Urb...
2003 Dec 17
2
Easiest way to get the mean of a row of a data.frame?
Dear r-helpers!
I am kind of new to R.
I would like to calculate the mean of the numbers of this expression:
data(USArrests)
USArrests[row.names(M) == "Alabama",]
class() tells me it's a ``data.frame,'' what I actually desire is to get
all numbers of a row as a vector or a list to let mean() calculate the mean
of the whole row. (I know this doesn't make sense with USArrests, I just
used...
2005 Sep 16
1
About princomp
Hi,
I run the example for princomp for R211
I got the following error for biplot
> ## The variances of the variables in the
> ## USArrests data vary by orders of magnitude, so scaling is appropriate
> (pc.cr <http://pc.cr> <- princomp(USArrests)) # inappropriate
Erreur dans cov.wt(z) : 'x' must contain finite values only
> princomp(USArrests, cor = TRUE) # =^= prcomp(USArrests, scale=TRUE)
Erreur dans cov.wt(z)...
2010 Jun 16
2
Accessing the elements of summary(prcomp(USArrests))
Hello again,
I was hoping one of you could help me with this problem. Consider the sample data from R:
> summary(prcomp(USArrests))
Importance of components:
PC1 PC2 PC3 PC4
Standard deviation 83.732 14.2124 6.4894 2.48279
Proportion of Variance 0.966 0.0278 0.0058 0.00085
Cumulative Proportion 0.966 0.9933 0.9991 1.00000
How do I access the information contained within this sum...
2003 Apr 02
1
RODBC sqlSave problem.
...d the RODBC interface, I
am somewhat confused by some of the problems I am experiencing trying to
connect R to the database.
Whai I am trying is basically the example part of the help file for the
sqlSave function:
> library(RODBC)
> odbcConnect("theodor") -> channel
> data(USArrests)
> sqlSave(channel, USArrests, verbose = TRUE)
Query: CREATE TABLE USArrests (rownames varchar(255) ,Murder float8
,Assault int4 ,UrbanPop int4 ,Rape float8 )
Error in sqlSave(channel, USArrests, verbose = TRUE) :
[RODBC] ERROR: Could not SQLExecute
When issuing this comamnd, a t...
2002 Mar 20
1
RODBC under Windows
...Here is what I did:
(1) I created an empty Excel file (workbook).
(2) I setup this file as a data source named "Excel Test" using Data
Sources(ODBC) under Control Panel/Administrative Tools (I am using
Win2000).
(3) In R I did
cc <- odbcConnect("Excel Test")
data(USArrests)
sqlSave(cc, USArrests, rownames="States")
sqlTables(cc) # shows the Sheet1$ and
USArrests$ as system tables and USArrests as a table
sqlQuery(cc, "select state, murder from USArrests") # works
fine
sqlQuery(cc, "...
2003 Apr 04
2
biplot
Dear list,
I want to perform a biplot, using customized titels for the x and y axis.
Setting xlab="" and ylab="" resulted in an error, e.g.:
> data(USArrests)
> biplot(princomp(USArrests),xlab="",ylab="")
Error in biplot.default(t(t(scores[, choices])/lam), t(t(x$loadings[, :
length of dimnames[1] not equal to array extent
>
How do I proceed?
Thanks in advance!
Wolfgang Koller
----------------------------------...
2006 Sep 06
2
biplot label size
Which is the parameter that is used to decrease the size of ylabs
plotted in biplot? I tried playing with cex and cex.lab I am not getting
it right
pc <- princomp(USArrests)
biplot(pc, xlabs = rep("", nrow(USArrests)),ylabs=(colnames(USArrests)))
Thanks../Murli
[[alternative HTML version deleted]]
2004 Nov 25
0
Problem with ODBC access to SQL database
...ith MySQL as ODBC server:
- a new database is created, but no data is written to it
- the example code works just fine when I use MS Access as ODBC server.
----------- offending code and output -------------------
> library(RODBC);
> channel <- odbcConnect("opus");
> data(USArrests) # R < 2.0.0 only
> sqlSave(channel, USArrests, rownames = "state", addPK=TRUE)
Error in sqlColumns(channel, tablename) : USArrests : table not found on
channel
Check case parameter in odbcConnect
> sqlSave(channel, USArrests, rownames = "state", addPK=TRUE)
Error i...
2012 Feb 06
0
sqsSave() test using Test.R script returning error suggesting no values upon "insert"
Hi.
I attempted to use RODBC and decided to execute all the tests provided in "Test.r" under the unpacked package RODBC folder.
Beginning with the following:
library(RODBC)
library(MASS)
USArrests[1,2] <- NA
hills <- hills[1:15,]
row.names(hills)[12] <- "Dollar ('$')"
set.seed(1)
# MySQL
## testdb3 is ODBC/Connector 3.51.x, testdb5 is 5.1.x
channel <- odbcConnect("MysqlODBC") #my database
odbcGetInfo(channel)
sqlTypeInfo(channel)
sqlTables(channel)...
2005 Jul 08
2
extract prop. of. var in pca
Dear R-helpers,
Using the package Lattice, I performed a PCA.
For example
pca.summary <- summary(pc.cr <- princomp(USArrests, cor = TRUE))
The Output of "pca.summary" looks as follows:
Importance of components:
Comp.1 Comp.2 Comp.3 Comp.4
Standard deviation 1.5748783 0.9948694 0.5971291 0.41644938
Proportion of Variance 0.6200604 0.2474413 0.0891408 0.04335752
Cumulati...
2011 Dec 12
1
how to colour labels (each label with a colour) in a dendrogram?
...he different labels of my dendrogram each one with a
different colour. How can I do? I guess I could do using *edgetext* and
then *t.col* or* lab.col* but I don't know how to add edgetext to my
dendrogram. Can you help me please?
Example:
require(graphics); require(utils)
hc <- hclust(dist(USArrests), "ave")
(dend1 <- as.dendrogram(hc))
plot(dend1)
labels (USArrests) [[1]] # to know how many cities (labels) = 50
nP <- list(col=3:2, cex=c(2.0, 0.75), pch= 21:22,
bg= c("light blue", "pink"),
lab.cex = 0.75, lab.col = 1:50) # or use a...
2011 Mar 02
2
clustering problem
...000 genes each.
I'd like to perform clustering on these. It turned out to become much faster
when I transform the underlying matrix with t(matrix). Unfortunately then
I'm not anymore able to use cutree to access individual clusters. In general
I do something like this:
hc <- hclust(dist(USArrests), "ave")
library(RColorBrewer)
library(gplots)
clrno=3
cols<-rainbow(clrno, alpha = 1)
clstrs <- cutree(hc, k=clrno)
ccols <- cols[as.vector(clstrs)]
heatcol<-colorRampPalette(c(3,1,2), bias = 1.0)(32)
heatmap.2(as.matrix(USArrests), Rowv=as.dendrogram(hc),col=heatcol,
trace...
2003 Apr 04
2
sqlSave() Question
All,
I am new in R. I found sqlSave() doesn't work for our Oracle9i. The
following was the message:
> sqlSave(channel, USArrests, rownames="state")
Error in sqlColumns(channel, tablename) : USArrests : table not found on
channel
Check case parameter in odbcConnect
>
sqlQuery() works OK.
Please help. Thanks.
-MY
2008 Jan 13
1
What is the 'scale' in princomp() function?
...ear R users,
When I tried to use princomp() from stats packages to do Principal
Components Analysis, I am not very clear what is the "scale".
And the scores are different from "PROC PRINCOMP" procedure from SAS.
Using the example data from this package:
restpc <- princomp(USArrests, cor = TRUE)
> restpc$scale
Murder Assault UrbanPop Rape
4.311735 82.500075 14.329285 9.272248
> sd(USArrests)
Murder Assault UrbanPop Rape
4.355510 83.337661 14.474763 9.366385
Why 'restpc$scale' is different from 'sd(USArrests)'?
felix
2009 Apr 30
1
Creating datasets in packages
...package which includes datasets. The build and
install works correctly. However, when I access the dataset
("BowRiver"), I get:
> data(BowRiver)
> BowRiver
Error: object "BowRiver" not found. However, I can access the dataset
from
> data
Example R datasets (such as USArrests) are loaded and can be accessed by
the dataset name:
> data(USArrests)
> USArrests
Murder Assault UrbanPop Rape
Alabama 13.2 236 58 21.2
Alaska 10.0 263 48 44.5
Arizona 8.1 294 80 31.0
Arkansas 8.8 190...