Just wondering if there is a better way to do this?
x <- seq(4,20,1)
y <- sapply(x, function(x) (max(x-10,0)))
Is there a easier way to get to y? i.e. max(x-10,0)
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEAS
Hello,
I am trying to use RJSONIO
I have:
x <- c(0,4,8,9)
y <- c(3,8,5,13)
z <- cbind(x,y)
Any idea how to convert z into the JSON format below?
I want to get the following JSON output to put into a php file.
[[0, 3], [4, 8], [8, 5], [9, 13]]
Thank you.
__
;
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
> On Behalf Of Santosh Srinivas
> Sent: Saturday, December 11, 2010 8:37 AM
> To: r-help@r-project.org
> Subject: [R] Rapache on windows
>
> Hello all,
>
> I sear
Hello R-Group,
I am trying plotting simple time-series with ggplot2 because the output
looks better and I've heard its richer in features.
I have the following dataset.
> dput(dat)
structure(list(Date = structure(c(14970, 14971, 14972, 14973,
14974, 14977, 14978, 14979, 14980, 14981), class = "D
2011 18:59
To: Santosh Srinivas
Cc: r-help@r-project.org
Subject: Re: [R] Basic ggplot question
Hi,
Try this,
m = melt(dat, id="Date")
head(m)
qplot(Date, value, data=m, colour=variable, geom="line")
ggplot(m) + facet_grid(variable~., scales="free_y") +
geom_path
Hello,
Just wondering why I am unable to run this in parallel.
A dput of my dataset is attached at the end. Please use to create my data
object.
I want to run this function in parallel (not sure if this is an efficient
implementation):
#Function to calculate the time to maturity for the option
r
tcc.new2 <- droplevels(tcc.new)
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Ben Harrison
Sent: 19 January 2011 12:24
To: r-help@r-project.org
Subject: [R] Using subset to filter data table
I am having difficulty understanding ho
Hi Marc,
I've exactly the same question and it looks like most of the heavy users
from the threads I've followed use Unix/Linux/Mac.
Some threads have given rationale for a 64bit system due to memory benefits
but there seems to be not much buy-in from the guys here (so I'd give that a
pass). The C
would this work (shorter)?
apply(a, 1, function(x) x[order(x)[2]])
On Tue, Apr 26, 2011 at 5:31 PM, Lars Bishop wrote:
> Hi,
>
> I need to extract the second largest element from each row of a
> matrix. Below is my solution, but I think there should be a more efficient
> way to accomplish the s
Dear Group,
Is there a more efficient way to create a data frame structure (using rep I
guess?)
require(plyr)
week <- rdply(10, data.frame(week = 1:52))
names(week) <- c("Year", "Week")
week$Year <- week$Year + 2000
Basically trying to create a year and week data frame to start appending
data t
Hi Ivan, Take a look dataFrame in R.utils ... is that what you want?
from the help file:
Examples
df <- dataFrame(colClasses=c(a="integer", b="double"), nrow=10)
df[,1] <- sample(1:nrow(df))
df[,2] <- rnorm(nrow(df))
print(df)
Thanks,
Santosh
On Mon, May 16, 2011 at 1:42 PM, Ivan Calan
Check data.table ... It benefits a lot from indexing data in data frames
On Thu, May 19, 2011 at 7:41 PM, xiagao1982 wrote:
> Hi all,
>
> I wonder if I can create indexes for columns in a data frame to speed up data
> selection by matching column values, just like indexes for large tables in a
Hello cmaster1331,
I had asked a similar question sometime back. You may want to check out
these responses that I got.
A) http://code.google.com/p/gridextra/wiki/tableGrob
B)
1) latex (via xtable, Hmisc, r2lh, reporttools ...)
2) html (via xtable, r2lh, R2HTML, hwritter, HTMLUtils ...)
3) graphi
You question has multiple answers that you can choose from and the group has
been trying to help you.
My suggestion would be to write it to the database using PHP and use R to
extract and analyze (and write back) the data.
The integration of R with web functionality is quite nascent but the Rapac
Please take a look at the introduction to R too ...
> df <- read.delim(textConnection(Lines),sep="")
> df
A B CD
1 0.1 0.7 0.9 0.80
2 0.2 0.6 0.8 0.70
3 0.4 0.8 0.7 0.76
> d['A-B'] <- with(df, A-B)
Error in d["A-B"] <- with(df, A - B) : object 'd' not found
> d$v1 <- with(df, A-B)
Erro
?subset
On Mon, Feb 7, 2011 at 7:46 AM, Christopher Porter wrote:
> Hello. I came across your response in an R forum and could use your help. I
> have a data set with 472 rows. I want to delete rows 416 through 472. The
> name of my data set is MERGE.
>
> I am an extreme R novice. How do I writ
Hi Group,
I am having a strange problem for this simple task.
I am using read.table to read a plan 3 column CSV file . the file is getting
read .
But the first column has datetime in the csv file in the following format:
20110221.114041
But this is being read as 20110221 only . the tim
for excel .. see library(xlsx)
On Tue, Mar 1, 2011 at 2:57 PM, JoonGi wrote:
>
> Thanks in advance.
>
> I'm having a trouble with data saving.
>
> I want to run the same data which is in Ecdat library at different statistic
> programs(excel, stata and matlab)
>
> The data I want to use is
>
> lib
reshape2 Like this?
> require(reshape2)
Loading required package: reshape2
> melt(xx)
Using country as id variables
country variable value
1 USAx10
2 UKx50
3 Canadax20
4 USAy40
5 UKy80
6 Canaday35
7 U
Dear All,
I am trying to create a empty structure that I want to fill gradually
through the code.
I want to use something like rbind to create the basic structure first.
I am looking for a possibility to do an rbind where the columns names
dont match fully (but the missing columns can be defaulte
Sender: r-help-boun...@r-project.org
On-Behalf-Of: santosh.srini...@gmail.com
Subject: [R] Flexible rbind
Message-Id:
Recipient: simon.r...@barclayscapital.com
___
e at 1 Churchill Place, London, E14 5HP. This email may relate to or be sent
from ot
Sender: r-help-boun...@r-project.org
On-Behalf-Of: santosh.srini...@gmail.com
Subject: [R] Flexible rbind
Message-Id:
Recipient: killian.door...@barclayscapital.com
___
e at 1 Churchill Place, London, E14 5HP. This email may relate to or be sent
fr
Hi Group,
I often need to print out data frames with results of analysis into a
neat little image to copy and paste into documents. I need apply
formatting like bold, currency signs, number formats, header shading
etc.
I currently output the data into csv and format using good old excel.
Any sugg
Thanks.
On Tue, Apr 19, 2011 at 5:16 PM, Gabor Grothendieck
wrote:
> On Tue, Apr 19, 2011 at 6:59 AM, santosh wrote:
>> Dear Group,
>>
>> I am doing an apply function on a zoo object. I need the rownames to
>> be passed to the function.
>> Any suggestions on how to accomplish this?
>>
>> Here is
Hello Vijayan,
Depending on your end goal the following could possibly help
substr(string,nchar(string1)+1, nchar(string))
or
strsplit(string," ")
HTH,
Santosh
On Sat, Jun 18, 2011 at 2:06 PM, Vijayan Padmanabhan
wrote:
> Dear R Group
> Here is what i am trying to do.. but couldnt figure ou
101 - 125 of 125 matches
Mail list logo