Displaying 20 results from an estimated 4000 matches similar to: "Selecting a subgroup"
2011 Jun 30
1
Match strings across two differently sized dataframes and copy corresponding row to dataframe
Hello-
Sorry, this is a bit of a noob question, but I can't seem to progress
it any further.
I have two dataframes which contain a series of strings which exactly
match. The problem is one has more rows than the other (more cases
have been added) and they have been sorted so that they are not in the
same order. The smaller dataframe, though, contains in another column
which has codes
2010 Dec 06
1
R cmd batch with parameters
hello!
I'm trying to make a very simple calculation using R that would called
from bash with two parameters, the names of the input and output files.
the first one is just an 4 by 100 numerical table- the function finds
the index of the maximal elements in each columns and writes it into the
output file.
I cannot deal somehow with passing the parameters to the function it
works from R with the
2013 Mar 14
1
ggplot2 problem
Hello all!
I have a problem with ggplot2 library. I want to do an heat map and the y
variables are the year months. If I use the following code, he y values are
in alphabetical order, but I want it in month order.
The code is:
library(reshape)
library(ggplot2)
library(scales)
p <- ggplot(data.m, aes(variable, Month)) + geom_tile(aes(fill = value),
2006 May 12
3
optimal way to compute matrix subtotals?
Hi!
I have large matrices, one column per variable and I have a vector of factors / grouping symbols. Then I am computing subtotals for the groups but it takes pretty long and thus I wanted to ask if there is a better way to do it or if this is already the best way:
subTotals <- function(x, groupvec) do.call("rbind",lapply(split(x,groupvec),colSums,na.rm=T))
Thanks reading my
2016 Apr 15
0
Difficulty with LRSM Rasch analysis with eRm package in R.
Hi,
I am trying to do an LRSM Rasch analysis for 72-item data. 67 of the
items are binary, and 5 are ternary. I have tried it with and without a
specified matrix, and cannot get it to work.
The primary problems I am having are:
1. Without a matrix, I get an error:
Error in `rownames<-`(`*tmp*`, value = betanames) : length of 'dimnames'
[1] not equal to array extent
This is from
1999 Jan 18
1
Program advice
Hi
Starting to use R as a serious tool, I have come across a programming
problem that I can't see the answer too yet. Can someone advise me plese.
The problem is that I want to plot a series of lines which represent short
term growths. All the data is in a single vector and I can indicate
the index via a second vector. In GLIM, if the second vector is a factor,
a single $GRA Size Year
2017 Jul 05
0
Help with reshape/reshape2 needed
The reason it doesn't work easily with reshape/reshape2 is that the
order of the rows is not determined. Your answer could be
1957 1958 ... 1985 1986
0.8625000 0.7500000 ... 0.7307692 0.23750000
0.0733945 0.6435644 ... NA 0.05769231
0.5096154 NA ... NA 0.65137615
or
1957 1958 ... 1985 1986
0.0733945 0.6435644 ... NA
2017 Jul 05
1
Help with reshape/reshape2 needed
Hi Tom,
Or perhaps:
#assume the data frame is named "tadf"
library(prettyR)
stretch_df(tadf,1,2)
Jim
On Thu, Jul 6, 2017 at 6:50 AM, Ista Zahn <istazahn at gmail.com> wrote:
> The reason it doesn't work easily with reshape/reshape2 is that the
> order of the rows is not determined. Your answer could be
>
> 1957 1958 ... 1985 1986
>
2017 Sep 22
0
require help
thankx to everyone for your valuable suggestions. one query regarding the
GARCH model.
I have applied the GARCH model for the same data that I send you all . and
my results coming like
Error in .sgarchfit(spec = spec, data = data, out.sample = out.sample, :
ugarchfit-->error: function requires at least 100 data
points to run
can you suggest something on it.
On Fri, Sep 22, 2017 at 6:02
2017 Jul 05
0
Help with reshape/reshape2 needed
This does not use reshape/reshape2, but it is pretty straightforward. Assuming X is your example data:
> Y <- split(X[, 2], X[, 1])
> vals <- sapply(Y, length)
> pad <- max(vals) - vals
> Y2 <- lapply(seq_along(Y), function(x) c(Y[[x]], rep(NA, pad[x])))
> names(Y2) <- names(Y)
> X2 <- do.call(cbind, Y2)
> X2[, 1:6]
1957 1958 1959
2017 Sep 16
0
require help
oky.. thank you very much to all of you
On Sat, Sep 16, 2017 at 2:06 PM, Eric Berger <ericjberger at gmail.com> wrote:
> You can just use the same code that I provided before but now use your
> dataset. Like this
>
> df <- read.csv(file="data2.csv",header=TRUE)
> dates <- as.Date(paste(df$year,"-01-01",sep=""))
> myXts <-
2017 Sep 22
2
require help
Assuming the input data.frame, DF, is of the form shown reproducibly
in the Note below, to convert the series to zoo or ts:
library(zoo)
# convert to zoo
z <- read.zoo(DF)
# convert to ts
as.ts(z) #
Note:
DF <- structure(list(year = c(1980, 1981, 1982, 1983, 1984), cnsm = c(174,
175, 175, 172, 173), incm = c(53.4, 53.7, 53.5, 53.2, 53.3),
with = c(60.3, 60.5, 60.2, 60.1, 60.7)),
1999 Feb 11
2
An idea for something better than read.table
I was recently converting some datasets for use in an R package and it
occurred to me that there really is no "neat" way to input a data
frame if it is to contain factor variables.
One can use dput()/source or dump() after massaging data into the
right format, of course, but there isn't really anything which allows
you to store the input instructions with the data beyond the simple
2007 Dec 06
0
alternatives to latex() or xtable()
An alternative solution that allows you to break it down by categories is in
the functions below. Comments/suggestions welcome and encouraged.
Note that much thanks is due to those who responded to an earlier post of
mine on a similar topic.
To use (assuming you have a data.frame falled pathDist with columns
distances (your numeric data of interest), Capacity, Surface, and SITE
(vectors of
2008 Nov 04
1
perform Kruskal-Wallis test without using the built-in command in R
Hi,
again i am stuck in my presentation, and i have never learn R before in my
life but need this to be done, so please help me out for a favour:
http://www.nabble.com/file/p20333155/kew.dat kew.dat
run this in R and these comes up:
Month Year Rain
1 Jan 1900 74.400000
2 Feb 1900 80.500000
3 Mar 1900 23.600000
4 Apr 1900 23.600000
5 May 1900 25.100000
6
2009 Jan 14
1
publication statistics from Web of Science
Dear list,
This is a bit of an off-topic question, but I'm hoping to get some
advice from more experienced people. I've used the website "Web of
Science" to manually collect publication counts responding to several
keywords as a function of date, since the 1960s.
http://apps.isiknowledge.com/RAMore.do?product=UA&search_mode=&SID=P1g9lFJp9 at
2017 Sep 16
2
require help
You can just use the same code that I provided before but now use your
dataset. Like this
df <- read.csv(file="data2.csv",header=TRUE)
dates <- as.Date(paste(df$year,"-01-01",sep=""))
myXts <- xts(df,order.by=dates)
head(myXts)
#The last command "head(myXts)" shows you the first few rows of the xts
object
year cnsm incm wlth
2004 Mar 09
1
vector extraction
Hello,
I could need some help on this one:
>From the data.frame "Test.dataset2" below (TSCS data for 151
"countries.to.map" for "year" 1973-95; each "country.to.map" is described by
a unique code), I would like to extract a vector "color" that for each
"country.to.map" takes on the value of "dv" (a categorical variable with
2005 Aug 13
1
How to make a lagged variable in panel data?
Suppose we observe N individuals, for each of which we have a
time-series. How do we correctly create a lagged value of the
time-series variable?
As an example, suppose I create:
A <- data.frame(year=rep(c(1980:1984),3),
person= factor(sort(rep(1:3,5))),
wage=c(rnorm(15)))
> A
year person wage
1 1980 1 0.17923212
2 1981
2011 Mar 16
0
Quantmod getSymbol.MySQL
I am trying to read a table from MySQL, I have loaded the file in "ts"
database, in table name ACC. but i am unable to read it in R through
getSymbol function.
mysql> show databases;
+--------------------------------+
| Database |
+--------------------------------+
| information_schema |
| mysql |
| test |
| ts