Displaying 20 results from an estimated 1000 matches similar to: "data.frame - transform"
2002 Jun 09
1
Logical operators
Hello,
I have a csv-file which looks like:
#### pwt6_r.csv ####
code;year;rgdpch
AGO;1998;1234
ALB;1998;3576
ARG;1998;#NA
SVN;1996;13439
SWE;1996;21492
AGO;1960;#NA
ALB;1960;2345
ARG;1960;4634
#### pwt6_r.csv ####
To import this file i call:
pwt6<-read.csv("d:/pwt6_r.csv",header=T,na.strings="#NA",sep=";")
Now I want to generate a new data.frame which include
2002 May 26
3
Read a Time Serie CSV
Hi,
I want to read some Times Series of GDP from OECD-Countrys.
First I call:
> oecd96<-ts(read.csv("oecd96.csv",header=T,sep=";"),start=1950,freq=1)
> summary(oecd96)
gdpcausb gdpcautb gdpcbelb gdpccanb
Min. : 8567 Min. : 4533 Min. : 6616 Min. : 8966
1st Qu.:10771 1st Qu.: 8717 1st Qu.: 9440 1st Qu.:11694
Median
2004 Feb 02
2
ordering in dotplot
Dear R-friends,
the dataset I am using (data.it) is organized as follows
partner stp btp reg
hk 0.64 1 s
ger 0.27 1 d
tur 0.27 1 s
rom 0.24 1 s-f
por 0.24 1 s
spa 0.23 1 s
gre 0.22 1 d-f
aus 0.17 1 d
uk 0.16 1 s
be 0.16 1 d
arg 0.15 1 s
usa 0.13 1 d-f
fra 0.13 1 s
neth
2012 Aug 13
1
Fine Tuning Country Map
Dear All,
Please see the short script at the end of the email, which I assembled
looking for bits and pieces on the web.
It essentially does what I need: it plots several countries as a
color-coded map.
I just would like to fine-tune a bit the final image, in particular
(1) Select my own colors for "painting" the countries (i.e. associate
manually a color to every level)
(2) Be
2006 Jul 18
2
how can I delete rows?
Hello, I am very new in R so I am so sorry for this question.
I have the Barro-Lee data set which contains 98 countries and I want to run the regressions only for the Latin America countries, so what do you recomend? How can I delete all the other countries or how can I select the countries of Lat. Am. thank you
this is the list of countries
SHCODE COUNTRY NAME WBCTRY
2004 Apr 14
3
A bug report?
Folks,
I have a strange situation, which I may have isolated as a bug
report. Or, it could just be that there's something about R that I
don't know. :-) I have attached the data file and the program file but
don't know whether these attachments will make it into the list. Here
is my bugreport.R program --
---------------------------------------------------------------------------
2001 Sep 24
3
x axis point labels
I am attempting to manually specify x axis value labels (NOT x axis label as
in xlab) on a density plot. Generally speaking, I would like to erase the
default x axis point labels and replace them with arbitrary x axis point
labels relating to specific CDF points.
I am sure this can be done, but it isn't obvious to me how. Has anyone done
this before?
My R code follows if it helps (new
2011 Dec 07
1
removing specified length of text after a period in dataframe of char's
Dear all,
I'm trying to remove some text after the period (a decimal point) in
the data frame 'hi', below. This is one step in formatting a table. So
I would like e.g.
"2.0" to become "2"
and "5.3" to be "5.3",
where the variable digordered contains the number of digits after the
decimal that I would like to display, in the same order in which
2008 Jan 30
2
numeric coercion when one or more elements is non numerice
I don't understand this behavior. Why does the every data point get trashed by data.matrix when there is one non-numeric element in the array? Thanks.
> temp
GDP CPIYOY
19540 2098.1 garbage
19632 2085.4 0.9
19724 2052.5 0.8
19814 2042.4 1.1
> data.matrix(temp)
GDP CPIYOY
19540 4 4
19632 3 2
19724 2 1
19814 1
2012 Apr 30
5
Different varable lengths
Hi!
I'm trying to do a lm() test on three objects. My problem is that R protests
and says that the variable lengths differ for one of the objects
(Sweden.GDP.gap). But I have double checked that the number of observations
are the same. All three objects should contain 9 observations but R only
accepts 9 observations in two of the objects. The third must have 10! Very
confusing because there
2002 Jul 03
2
Adding text to a plot
Dear R-users,
again two question...
# Question 1
Adding two lines of text to a plot, I am using:
# -------------------------------
plot(k[,1], k[,2], pch=16,
ylim=range((min(k[,2])-0.2):(max(k[,2])+1)))
a <- paste("Cor.:" ,cor(k[,2],k[,1]))
b <- paste(nrow(k), "Countries")
text(90, max((k[,2])-0.51), a)
text(90, max((k[,2])-0.83), b)
#
2003 Oct 04
2
(no subject)
Dear all,
I have the following question. I have to fit the hierarchical model for the
hypothesis concern the individual-level effects by controlling for the
individual -level attributes and national-level contextual effects on
individuals by using R.
O have to obtain the estimates of the impact of the second-level (national:
GDP per capita) effects on individuals ( in this instance the impact
2011 Nov 16
1
geom_bar with missing data in package ggplot
Dear all,
I was hoping someone could help with a ggplot question. I would like
to generate a faceted bar chart, but missing data are causing
problems.
g<-structure(list(Date = structure(c(11322, 11687, 12052, 11322,
11687, 12052, 11322, 11687, 12052, 11322, 11687, 12052), class = "Date"),
variable = c("Govt Revenues to GDP", "Govt Revenues to GDP",
2000 Dec 17
1
multiframe in postscript
I was hoping that the following specification
postscript(file="fig.ps",height=2,width=4)
par(mar=c(5,5,2,2)+.1,mfrow=c(1,2),mex=.6)
would yield the same scaling effect as
postscript(file="fig.ps",height=2,width=6)
par(mar=c(5,5,2,2)+.1,mfrow=c(1,3),mex=.6)
but the fact is that the 'mfrow=c(1,2)' yields smaller plotting frame
and bigger font size.
2001 May 06
1
legend/text in time series plot
hi,
i need help on placing legend/text in a time series plot. here is what
i am doing (i am using rw1022 on windoze 2000):
#read data file
gdpn <- scan("jngdpsa.dat", list(year=0, qtr=0, gdp=0));
gdpr <- scan("jrgdpsa.dat", list(year=0, qtr=0, gdp=0));
#convert to time series object
gdpn <- ts(gdpn$gdp, frequency=4, start=c(1955,2));
gdpr <- ts(gdpr$gdp,
2005 Jul 11
1
small first graph of par(3,2), other 5 are correct
Hi,
I'm trying to produce 6 graphs on a single page using code I've borrowed
from an example by Paul Murrell:
(http://www.stat.auckland.ac.nz/~paul/RGraphics/custombase-xmastree.R).
It involves placing 6 horizontal barplots on one page and adding common
labels.
The problem is the first graph in my figure (the one in the (1,1)
position) is smaller than the other 5. A toy example is
2011 Aug 04
1
Running a column loop through the Moran.I function.
Dear R users,
I have two data frames that consist of statistical information for most
countries around the world. One dataframe consists of the latitude and
longitude ("coord.csv") of each country, while the other consists of 100's
of different attributes ("countryattri.csv") for each country (like, GDP,
Population, etc.). The data is organized with a header and then
2006 Jul 07
1
convert ms() to optim()
How to convert the following ms() in Splus to Optim in R? The "Calc" function is also attached.
ms(~ Calc(a.init, B, v, off, d, P.a, lambda.a, P.y, lambda.y,
10^(-8), FALSE, 20, TRUE)$Bic,
start = list(lambda.a = 0.5, lambda.y = 240),
control = list(maxiter = 10, tol = 0.1))
Calc <- function(A.INIT., X., V., OFF., D.,
P1., LAMBDA1., P2., LAMBDA2.,
TOL., MONITOR.,
2002 Jun 21
1
rbind
Hello,
I am sure this is a trivial question, but I don't get it...
Having a dataframe (b.70) like that:
> b.70[1:4,2:3]
ARG AUS
1960 19041 25949
1961 19675 25451
1962 19302 26463
1963 18121 27644
Now I want to calculate the log for each year and save the
result in a new dataframe called 'x'.
x<- data.frame(w=NULL)
for(i in 1:3)
2011 Jun 26
2
Accessing variables in a data frame
Hello
My data.frame (dat) contains many variables named var.names and others
named var.names_var.id
For example
var.name <- c("gdp","inf","unp")
var.id <- c("w","i")
x <- paste(var.name, rep(var.id, each=length(var.name)), sep="_")
How can I access variables in the dama.frame by names listed in x, for
example to compute