Displaying 20 results from an estimated 9000 matches similar to: "Accessing data in groups created with split() and other beginner questions"
2017 Jun 07
2
purrr::pmap does not work
Hi All,
I try to do a scatterplot for a bunch of variables. I plot a dependent
variable against a bunch of independent variables:
-- cut --
graphics::plot(
v01_r01 ~ v08_01_up11,
data = dataset,
xlab = "Dependent",
ylab = "Independent #1"
)
-- cut --
It is tedious to repeat the statement for all independent variables. Found
an alternative, i.e. :
-- cut --
mu
2011 Aug 16
2
postscript( does not save the plot
Dear all,
I am using the following code to write the plot to an eps format
postscript(file="test.eps",horizontal=FALSE)
2009 Aug 07
3
How do I plot a line followed by two forecast points?
Good day all,
I'm trying to plot a continuous line plot, which is followed by two
forecast points eg. one forecast point is 12 months out, and another
24 months out from the last date of the line plot.
In my attempts so far, the second plot (the forecast points) is scaled
against a new axis scale, thus the two plots are not directly
comparable (I need the forecast points to be scaled
2010 Nov 17
0
X11 module cannot be loaded
HI, Dear R community,
I have used the following codes this morning, but this afternoon, I got the
following errors:
> x <- seq(0,10, by=1)
> y <- c(0.952, 0.947, 0.943, 0.941, 0.933, 0.932, 0.939, 0.932, 0.924,
0.918, 0.920) # missense
> z <- c(0.068, 0.082, 0.080, 0.099, 0.108, 0.107, 0.101, 0.105, 0.118,
0.130, 0.132) # missense False Negative
> p <- c(0.035, 0.036,
2010 Mar 18
5
One-time script to update 1000s of values in a single column in a table: nil error?
Hi, I have a model called Stock with a value called "strength." I
wrote a simple method in the Stock.rb model file to update the value
of "strength" for each record in the stocks table. I created a
controller called fix_controller.rb. I don''t have access to the live
system, so the idea is that an admin will go to http://url/fix and a
script will run to check and
2005 Aug 18
8
Extending a js class
It''s been a few days since I posted my last two emails (of which, no one
replied to) so I''ve gone ahead and coded a working slider class as well
as a ''resizeable'' class that allows a user to drag and resize the
element. I also linked these two together as I want to have slider
behavior that can resize the resizeable element. The end result is both
the
2010 Nov 06
1
Prettier axis labels when using log scales in Lattice
Hello,
I am trying to alter the way in which lattice functions (specifically xyplot) print the axis labels when one uses the 'scales' parameter.
I can obtain the effect I want by using
scales=list(y=list(log=10, labels=expression(yvalues)))
where yvalues are the values that would have been printed as the y-axis labels if the "labels" argument had not been present. To help
2016 Apr 25
1
Please assist -- Unable to remove '-' character from char vector--
Thank you Jim,
The code did assist me to get the what I needed.
Also, I learnt that there are different types of dashes
(en-dash/em-dash/hyphen) as explained on this site :
http://www.punctuationmatters.com/hyphen-dash-n-dash-and-m-dash/
I achieved it by executing below command after going through this page
on stackoverflow:
2016 Apr 25
0
Please assist -- Unable to remove '-' character from char vector--
Hi Sunny,
Try this:
# notice that I have replaced the fancy hyphens with real hyphens
end<-c("2001-","1992-","2013-","2013-","2013-","2013-",
"1993-2007","2010-","2012-","1984-1992","1996-","2015-")
splitends<-sapply(end,strsplit,"-")
last_bit(x)
2016 Apr 25
3
Please assist -- Unable to remove '-' character from char vector--
Hi,
I have a char vector with year values. Some cells have single year
value '2001-' and some have range like 1996-2007.
I need to remove hyphen character '-' from all the values within the
character vector named as 'end'. After removing the hyphen I need to
get the last
number from the cells where there are year range values i.e if the
cell has range 1996-2007, the code
2010 Oct 27
2
keep adding elements to the matrix
Hello everyone,
I would like to create a "dynamic" array to keep storing number in it
for (i in c(2:length(final))){
myarray <-final[i]-final[i-1]
myarray2<-2*final[i]
}
At the end I would like to use myarray as the x values of an array
and the myarray2 as the yvalues of the same array.
I tried cbind but it didnot work.
Could you please help me with that?
Best
2017 Jun 07
0
Determining which.max() within groups
cumsum() seems to be what you need.
This can probably be done more elegantly, but ...
out <- aggregate(Q ~ wyr, data = Daily, which.max)
tbl <- table(Daily$wyr)
out$Q <- out$Q + cumsum(c(0,tbl[-length(tbl)]))
out
## yields
wyr Q
1 1990 4
2 1991 6
3 1992 9
4 1993 15
5 1994 18
I leave the matter of Julian dates to you or others.
Cheers,
Bert
Bert Gunter
"The trouble
2017 Jun 07
4
Determining which.max() within groups
Using the dataset below, I got close to what I'm after, but not quite all
the way there. Any suggestions appreciated:
Daily <- read.table(textConnection(" Date wyr Q
1911-04-01 1990 4.530695
1911-04-02 1990 4.700596
1911-04-03 1990 4.898814
1911-04-04 1990 5.097032
1911-04-05 1991 5.295250
1911-04-06 1991 6.569508
1911-04-07 1991 5.861587
1911-04-08 1991 5.153666
2003 Nov 01
4
Beginner: Homogenity of Variances
Hello,
for my meta-analysis I try to test if two varainces are equal without
using the raw scores. I have is the SD's, N's and the Means.
I want to test the variances from dependent and independend
samples.
I assume I can use the var.test procedure for the independent
samples, but what about the dependent samples ? Has anyone an
idea how to realise this with R ?
Thanks in advance
2012 Jun 10
3
Data.frames can not hold objects...What can be done in the following scenario?
R-Help community,
I understand that data.frames can hold elements of type double, string
etc but NOT objects (such as a matrix etc). This is not convenient for
me in the following situation. I have a function that takes 2 inputs
and returns a vector:
testfun <- function (x,y) seq(x,y,1)
I have a data.frame defined as follows:
testframe<-data.frame(xvalues=c(2,3),yvalues=c(4,5))
I would
2009 Mar 19
1
problem with Dates
Hi all,
I am strugling with date formates and caliculating diferent operations like
different between 2 dates and
getting minimum in vector of dates
that is i m working with dates in formate "6/22/1992 12:00:00 AM"
and the vector is
[1] 6/4/1992 12:00:00 AM 2/13/1992 12:00:00 AM 6/19/1992 12:00:00 AM
[4] 2/11/1992 12:00:00 AM 6/22/1992 12:00:00 AM 10/3/1991
2009 Sep 11
4
Sorting
I have following object :
> date2
[,1] [,2]
[1,] "apr" "1992"
[2,] "aug" "1992"
[3,] "dec" "1992"
[4,] "feb" "1992"
[5,] "jan" "1992"
[6,] "jul" "1992"
[7,] "jun" "1992"
[8,] "mar" "1992"
[9,] "may"
2006 Nov 23
1
how to loop this?
Hi,
I have the next procedure:
t1<-data.frame(table(substr(names(subset(lasker[[1]], lasker[[1]] >=
4)), 1, 7)))
t1[1:5,]
Var1 Freq
1 1988-02 3
2 1988-03 1
3 1988-04 1
4 1988-05 2
5 1988-06 3
How to make a new list?, dataframe? having 189 elements in the 'lasker'
list:
> str(lasker[[1]])
'table' int [, 1:1274] 1 1 3 2 1 5 4 1 1 4 ...
-
2012 Apr 22
10
Assignment problems
The text below is a part of, some work I have to do, which is due in 2 days
and I am strung up with a lot of other stuff, so I was hoping someone would
take 5 mins and help me ??
Here is a part of my data.frame:
year country1 country2 contig comlang pop1 gdp1
pop2 gdp2 rta dist avgflow
1 1992 AUS AUT 0 0 17.4950008 321708.281
2012 Feb 07
6
Setting up infile for R CMD BATCH
Suppose I create an R program called myTest.R with only one line like
the following:
type <- as.integer(readline("input type (1: type1; 2: type2)? "))
Then I'd like to run myTest.R in batch mode by constructing an input
file called answers.R with the following:
source("myTest.R")
1
When I ran the following at the terminal:
R CMD BATCH answer.R output.Rout
it failed