In your sample data.frame, MyDate and MyDes are factors; is that what you want?
rs
On Samstag, 16. März 2019 01:40:01 CET Ek Esawi wrote:
> Hi All—
>
> I have a data frame with over 13000 rows and 4 columns. A mini data
> frame is given at the bottom. I want to split the data frame into
> lists
Reading in the data from the file
x <- read.csv( "ExampleData.csv", header = TRUE, stringsAsFactors = FALSE )
Subsetting as you want
x <- x[ x$Location != "MW01", ]
This selects all rows where the value in column 'Location' is not equal to
"MW01". The comma after that ensures that
I may not be understanding the question well enough but for me
df[ df[ , "first"] != "Alex", ]
seems to do the job:
first week last
Rainer
On Sonntag, 12. Februar 2017 19:04:19 CET Rolf Turner wrote:
>
> On 12/02/17 18:36, Bert Gunter wrote:
> > Basic stuff!
> >
> > Either
Probably wrong list, but anyway:
Same problem here, after a
apt-get dist-upgrade
On Tuesday, April 19, 2016 05:23:37 PM Lorenzo Isella wrote:
> Dear All,
> I have never had this problem before. I run debian testing on my box
> and I have recently update my R environment.
> Now, see what
Quotation marks help also for exists():
exists( "meanedf" )
[1] TRUE
On Saturday 07 November 2015 04:48:04 Margaret Donald wrote:
> I have a variable meanedf which may sometimes not be defined due to a
> complex set of circumstances.
> I would like to be able to find out whether or not it
For me,
"meanedf" %in% ls()
works:
meanedf <- 1
"meanedf" %in% ls()
[1] TRUE
rm( meanedf )
"meanedf" %in% ls()
[1] FALSE
Rgds,
Rainer
On Saturday 07 November 2015 04:48:04 Margaret Donald wrote:
> I have a variable meanedf which may sometimes not be defined due to a
> complex set of
Try
y - x[ -( 30596:678013 ), ]
Please note that I have replaced 30595 with 30596 which is I think what you
mean.
You can add a new column with
y$new - new_column # this is your vector of length 30595
Good luck,
Rainer
On Friday 03 July 2015 07:23:28 Charles Thuo wrote:
I have a data
The way the sample data is provided is not useful. I have re-built your data,
please find the dput() version below (and pls check whether I got it right...).
This is not my area of competence at all, but from what I see from the help
page is that the expected parameters are, among others:
x
Hi Nick,
Your code is not exactly commented, minimal, self-contained, reproducible and
contains a number of inconsistencies (Data has three elements, your loop
expects six). Try something like
Data - c(July, August, September)
...
for( x in Data )
{
currentData - read.csv( paste( x,
Michael, thanks, that was it!
I had installed the packages as root and tried them out as root (not a good
idea I know, but I was lazy), while running the the X11 display as user.
Worse is that I have done that many times. One more thing learned.
Thanks again,
Rainer
On Thursday 23 October 2014
Maybe not the most elegant way but at least works:
library( stringr )
x - as.factor( 123.4- )
x - -as.numeric( str_replace( as.character( x ), -, ) )
x
[1] -123.4
On Monday 20 October 2014 09:03:36 PIKAL Petr wrote:
Dear all.
Before I start fishing in (for me) murky regular expression
... and it is also missing the 15 at position 15.
Can't explain but
which( neilist %in% pfriends )
should give you what you want.
On Tuesday 18 March 2014 11:14:08 Thomas wrote:
Does anyone know why this is happening? Which() is picking up the
indices of the numbers 13 and 15 in
What I would do:
# read in your sample data
mbr - read.table( clipboard, header = TRUE, stringsAsFactors = FALSE )
# create a vector with the codes you want to consider
code.list - c(A,B,C,D,E)
# reduce the data accordingly
mbr - mbr[ mbr$code %in% code.list, ]
# get your model matrix using
You could initialize one list per chapter,
x1 - list( Chapter One )
and then crate your variables as list members
x1$A - c( 1, 2, 3 )
x1$B - bla
x1$tv.data - data.frame( m = sample( LETTERS, 5 ),
n = round( runif( 5 ), 2 ) )
x1
[[1]]
[1] Chapter One
$A
[1] 1
### How I would do it:
# container for the result
res - NULL
# number of strings to be created
n - 50
# random length of each string
v.length = sample( c( 2:4), n, rep = TRUE )
# letter sources
src.1 = LETTERS[ 1:10 ]
src.2 = LETTERS[ 11:20 ]
src.3 = z
src.4 = c( 1, 2 )
# turn into a list
src
You get the cation to the top of the table with
print( saxtab, caption.placement = top )
Formatting the table the way you want can be done like this - I did not manage
to carry the LaTeX math formatting for the row names over ($k$ and $n_k$)but
the rest should be very much what you want:
{table}
On Wednesday 27 November 2013 17:43:30 Rainer Schuermann wrote:
You get the cation to the top of the table with
print( saxtab, caption.placement = top )
Formatting the table the way you want can be done like this - I did not
manage to carry the LaTeX math formatting for the row
I'm trying to install.packages( RCurl ) as root but get
ERROR: 'configure' exists but is not executable
I remember having had something like that before on another machine and tried
in bash what is described here
http://mazamascience.com/WorkingWithData/?p=1185
and helped me before:
# mkdir
, Nov 1, 2013 at 7:43 PM, Rainer Schuermann rainer.schuerm...@gmx.net
wrote:
I'm trying to install.packages( RCurl ) as root but get
ERROR: 'configure' exists but is not executable
I remember having had something like that before on another machine and
tried in bash what is described here
It would be helpful if
- you give us some sample data:
dput( head( myData ) )
- tell us what kind of function you want to apply, or
how the result looks like that you want to achieve
- show us what you have done so far,
and where you are stuck
On Saturday 17 August 2013 19:33:08
I'm sure there are better, more elegant ways avoiding the nested loop I'm
suggesting - but if it was my problem, here is what I would do (assuming that
my understanding of your question is correct):
### separate function for 'doing something' with the data subset
do.something - function( qA, qB
What about
?lubridate
particulatrly week()?
On Wednesday 14 August 2013 22:00:42 Christofer Bogaso wrote:
Hello again,
I need to calculate the week number of the corresponding month given a date.
Is there any function available with R to calculate that?
Thanks and regards,
Not sure whether I understand your question fully but I guess paste() is your
friend:
ggtitle( paste( RR(overall) =, RR, N =, N, alpha =, alpha1 ) )
On Friday 19 July 2013 17:17:24 Manisha Brahma chary wrote:
Hello,
I am using ggplot2 to plot a graph and I want to give a title to the plot
Maybe a simple
dbWriteTable( db, frames, iris )
does what you want?
On Monday 15 July 2013 23:43:18 Simon Zehnder wrote:
Dear R-Users,
I need a very fast and reliable database solution so I try to serialize a
data.frame (to binary data) and to store this data to an SQLite database.
Is
merge( data[1], data1 )
what you want?
On Tuesday 25 June 2013 12:00:23 Nico Met wrote:
Many thanks Rui,
However If I want to extract only first column (data1) from data file, then
how Can I do it?
Thanks again
Nico
On Tue, Jun 25, 2013 at 11:43 AM, Rui Barradas
Supposed your data.frame is called x, try
x[ which( substr( colnames( x ), 1, 4 ) == Peak ) ]
On Sunday 16 June 2013 15:20:37 Suparna Mitra wrote:
Hello R experts,
I need a help to create a subset file. I know with subset comand, its very
easy to select many different columns, or threshold.
df1 - data.frame( A = runif( 10 ), B = runif( 10 ) * 5, C = runif( 10 ) * 10,
D = runif( 10 ) * 20 )
df2 - data.frame( X = runif( 10 ), Y = runif( 10 ) * 5, Z = runif( 10 ) * 10 )
rename_columns - function( dataset )
{
for( i in 2:ncol( dataset ) )
colnames( dataset )[i] -
Try
?grep
or
library( stringr )
?str_detect
On Saturday 15 June 2013 00:33:31 Yasin Gocgun wrote:
Hi,
I need to check whether certain digits of a number, say, last five digits,
appear in a column of a data frame. For instance,
For example,103 in 000103 ( data [data[,3] == ...103]
The comments on StackOverflow are fair, I believe...
Please dput() your matrices, so that your code becomes reproducible!
On Wednesday 12 June 2013 11:14:35 maggy yan wrote:
I have to use a loop (while or for) to return the result of hadamard
product. now it returns a matrix, but when I use
On Thursday 30 May 2013 02:57:04 Camilo Mora wrote:
do you know why is this? or is there another way to sum by row in a
given number of columns?
Without data.table:
x - structure(list(col1 = c(NA, 0, -0.015038, 0.003817, -0.011407
), col2 = c(0.003745, 0.007463, -0.007407, -0.003731,
Using the data generated with your code below, does
rbind( DF1, DF2[ !(DF2$X.TIME %in% DF1$X.TIME), ] )
DF1 - DF1[ order( DF1$X.DATE, DF1$X.TIME ), ]
do the job?
Rgds,
Rainer
On Thursday 23 May 2013 05:54:26 Adeel - SafeGreenCapital wrote:
Thank you Blaser:
This is the exact solution I
Have you tried xtable?
library( xtable )
x - structure(list(Record = 1:3, Average = c(34L, 14L, 433L), Maximum =
c(899L,
15L, 1003L)), .Names = c(Record, Average, Maximum), class = data.frame,
row.names = c(NA,
-3L))
x - xtable( x )
print( x )
% latex table generated in R 2.15.2 by xtable
Not sure whether this really helps you but at least it works for your sample:
d3 - merge( d1, d2, by = c( a, b ) )
d3
I read your data into a dataframe
x - read.table( clipboard )
and renamed the only column
colnames( x )[1] - orig
With a loop, I created a 2nd column miss where in every 10th row the
observation is set to NA:
for( i in 1 : length( x$orig ) )
{
if( as.integer( rownames( x )[ i ] ) %% 10
Probably not very R-ish but it works (your data in a dataframe called x), if
I understand your question right:
# replace NA with 0
x$mth - ifelse( is.na( x$mth ), 0, x$mth )
# loop through observation numbers and replace 0 with the month no
for( i in unique( x$obs ) ) x$mth[ x$obs == i ] - max(
This might help:
http://www.omegahat.org/ROpenOffice/
Rgds,
Rainer
On Thursday 28 March 2013 17:32:23 Shane Carey wrote:
Hi,
Can R read open office.org Calc files
Thanks
__
R-help@r-project.org mailing list
Is
?expand.grid
what you are looking for?
Rgds,
Rainer
On Friday 15 March 2013 09:22:15 Amir wrote:
Hi every one,
I have two sets T1={c1,c2,..,cn} and T2={k1,k2,...,kn}.
How can I find the sets as follow:
(c1,k1), (c1,k2) ...(c1,kn) (c2,k1) (c2,k2) (c2,kn) ... (cn,kn)
What have you tried so far that did not work, and what do you want the result
of your reading the text file look like? What is store somewhere?
Why does
myDF - read.table( myData.txt )
which gives you
myDF
V1 V2 V3 V4
1Monday 12 78 89
2 Tuesday 34 44 67
3 Wednesday 78 98 2
Does
A$TIME - ifelse( A$TIME = 24, A$TIME + 24, A$TIME )
what you want?
Rgds,
Rainer
On Wednesday 21 November 2012 09:05:39 york8866 wrote:
Hi all,
I had a dataset A like:
TIME DV
0 0
1 10
520
24 30
36 80
48 60
72 15
I would like to add 24 to those values higher
x - as.data.frame( matrix( 0:255, nrow = 16 ) )
ifelse( x 127.5, 1, -1 )
Is that what you want?
Rgds,
Rainer
On Wednesday 21 November 2012 10:32:49 Brian Feeny wrote:
I have a dataframe in which I have values 0-255, I wish to transpose them
such that:
if value 127.5 value = 1
if
Not sure where the problem is?
Since you did not provide sample data, I took the iris data set and converted
it to your structure:
x - cbind( iris[5], iris[1:3] )
head( x )
Species Sepal.Length Sepal.Width Petal.Length
1 setosa 5.1 3.5 1.4
2 setosa 4.9
Assuming that you actually mean
a1(b2+b3+b4) + a2(b1+b3+b4) + a3(b1+b2+b4) + a4(b1+b2+b3)
^ ^ ^
this might give you what you want:
x - data.frame( a = sample( 1:10, 4 ), b = sample( 11:20, 4 ) )
x
the
following:
a1(b2+...+b190) + a2(b1+b3+...+b190) + ...
I managed to solve it, quite similar to what you just emailed.
Thanks!
On 19 October 2012 09:20, Rainer Schuermann rainer.schuerm...@gmx.netwrote:
Is it possible that you mean
a1(b2+b3+b4) + a2(b1+b3+b4) + a3(b1+b2+b4) + a4(b1+b2+b3
If I understand your problem correctly (as Milan has pointed out, sample data
and code would help enormously) this should get you where you want:
unique( shopdata$name[ shopdata$employee 10 ] )
If not, something is wrong from the outset (or with my understanding, but then
... see above)!
You can't do that on disk - try:
dfr - read.table ( /Users/MAC/Desktop/data.txt )
dfr
A1 A2 A3 A4 A5
If I understand your question correctly, you want to identify the one column
that has the lowest mean of all columns, and the one column that has the
highest mean of all columns.
Using your provided sample data, this gives you the indices:
colMeans(a)
[1] 12.48160 17.46868 22.51761 27.59880
dat - structure(list(date = structure(c(14879, 14886, 14893, 14899,
14906, 14913), class = Date), y = c(1356L, 1968L, 2602L, 3116L,
3496L, 3958L)), .Names = c(date, y), row.names = c(1, 2,
3, 4, 5, 6), class = data.frame)
x - as.Date( 2010-10-06 )
getY - function( x ) { dat[ dat$date = x, 2][
My amateur approach:
I put your data in a dataframe called t:
head( t )
Date Score
1 2008-05-01 08:58:0080
2 2008-05-01 13:31:0011
3 2008-05-01 16:35:0081
4 2008-05-01 23:20:00 152
5 2008-05-02 01:01:00 130
6 2008-05-02 03:35:00 122
Then I created a vector
Is that what you mean:
2 + 3
[1] 5
.Last.value
[1] 5
Rgds,
Rainer
(from R-intro.pdf, page 7, 2nd footnote)
Original-Nachricht
Datum: Thu, 19 Jul 2012 22:12:22 -0700 (PDT)
Von: darnold dwarnol...@suddenlink.net
An: r-help@r-project.org
Betreff: [R] Last answer
Hi,
Not sure whether I understand your data and objectives well enough but here is
what I would do:
To make my life easier, I used x as a variable name. I'm not using attach().
You can extract your data with something like
y - x[x$wrfta= 255 | x$wrfta= 65 x$wrfrain == 0, ]
y - y[!is.na(y[5]),]
y
Try
for( i in 1:10 ){
...
}
That should resove your problem 1.!
Rgds,
Rainer
On Wednesday 23 May 2012 09:23:04 RH Gibson wrote:
blap.txt is a numeric vector of length 64.
I am using the following code:
bd-scan(blap.txt)
output-matrix(0,64,10)
s-sum(bd)
for (i in 10){
while
mean( 16, 18 )
[1] 16
mean( c( 16, 18 ) )
[1] 17
On Tuesday 22 May 2012 02:10:27 Vincy Pyne wrote:
Dear R helpers,
I have recently installed R version 2.15.0
I just wanted to calculate
mean(16, 18)
Surprisingly I got answer as
mean(16, 18)
[1] 16
mean(18, 16)
Based upon my understanding of your problem, this should do the job:
d3 - dat1
d3[2] - ifelse( d3[2] == 1, dat2[1,2], NA )
d3[3] - ifelse( d3[3] == 1, dat2[2,2], NA )
d3[4] - Nodata
d3[5] - ifelse( d3[5] == 1, dat2[3,2], NA )
d3$average - rowMeans( d3[c(2,3,5)], na.rm = TRUE )
d3 is now
You cannot avoid the hyphen I think, but if you say (for example):
prefix.string=foo/x
then your files start with 'x-' (so 'graph' becomes 'foo/x-graph') which may be
better for you than the hyphen at the beginning of the file name.
Rgds,
Rainer
On Friday 04 May 2012 17:23:58
The easiest way probably is to put the code that takes so long to execute, in a
separate file, such as graph1.Rnw, and get it into your master file via
SweaveInput( graph1.Rnw ).
Once you are happy with your graph1, you can comment this line out and only
compile the stuff that keeps changing.
Cross posting
http://stackoverflow.com/questions/10308955/how-to-reduce-image-size-in-sweave
The code you have provided there is unusable, I assume your problems come from
a lack of understanding how Sweave works (nothing to do with Linux).
Always make sure that
=
and
@
are always the first
What I usually do when I have to write a report with some functions I use
multiple times is that I put them in a separate file (call it setup.Rnw or
so).
The first chunk there loads the libraries, sets initial variable values etc:
echo=FALSE, results=hide=
library( xtable )
d - iris
ind - 1
@
I also had the same problem.
Being on Linux, I prefer Walmes' command line method but I found that putting
\usepackage[utf8x]{inputenc}
as the first instruction in the master .Rnw file also does the trick. No need
to change anything after that in the file, at least not for me!
Rgds,
Rainer
On
1. Some data structured the way you are using would have been helpful.
I used Tal Galil's play data and set up a dataframe with the variable names you
are using:
structure(list(var1 = c(1, NA, NA, 4, 5, 6, 7, 8, 9, 10, 5),
var2 = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 5)), .Names = c(var1,
var2),
cbind() works as well, but only if c is attached to the existing test variable:
tst - cbind( test, c )
tst
ab c
I guess the problem starts with setting read.table(...dec = ,, ... ).
The data in your file are with decimal point.
Without that, it works just fine:
f - http://r.789695.n4.nabble.com/file/n4498828/p_diarios.txt;
df - read.table( f, header = TRUE )
log.Price - log(df$price)
head(
More information (reproducible code) is needed to address your specific
situation, but in general, you change the value of a variable in R and take
care of the formatting in LaTeX.
You may want to look at the Hmisc package's Latex() function. I have not tried
it, xtable serves me well, but
You can change the column names of a data frame with
colnames( df ) - c( my, data, frame )
and from here, xtable() is your friend (or at least mine...).
Rgds,
Rainer
On Thursday 22 March 2012 01:13:18 Manish Gupta wrote:
Hi,
Can we change column names in latex table?
Regards
--
For a small number of elements you could use \Sexpr{},
i.e.
echo= FALSE=
x-c(1,0,2,4)
@
x\\
\textbf{\Sexpr{x[1]}}\\
\textbf{\Sexpr{x[2]}}\\
\textbf{\Sexpr{x[3]}}\\
\textbf{\Sexpr{x[4]}}\\
Rgds,
Rainer
On Monday 19 March 2012 20:03:47 Manish Gupta wrote:
Hi,
I am using R and latex for
Or, with a little less typing:
echo= FALSE=
x-c(1,0,2,4)
@
x\\
\begin{textbf}
\Sexpr{x[1]}\\
\Sexpr{x[2]}\\
\Sexpr{x[3]}\\
\Sexpr{x[4]}\\
\end{textbf}
On Tuesday 20 March 2012 10:14:38 Rainer Schuermann wrote:
For a small number of elements you could use \Sexpr{},
i.e.
echo= FALSE=
x-c
As to the reasons, David as given you the necessary hints.
In order to get around the issue, here is what I do:
a - round( 0.1 * ( 1:9 ), 1 )
a
[1] 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9
which( a == 0.3 )
[1] 3
Rgds,
Rainer
Original-Nachricht
Datum: Sun, 18 Mar 2012
colnames( df )[2]
[1] c2
On Thursday 02 February 2012 07:31:33 ikuzar wrote:
Hi,
I 'd like to know how to retrieve a column name of a data frame. For
instance :
df = data.frame(c1=c('a','b'),c2=c(1,2))
df
c1 c2
1 a 1
2 b 2
I would like to retrieve the column name
as.numeric(A)
[1] 4.4 1.9 4.1
Integers are just integers...
On Tuesday 31 January 2012 12:21:48 Marion Wenty wrote:
dear r-helpers,
i created an object named A, which looks like this:
A - c(4.4,1.9,4.1)
now i needed to get numbers instead of characters and for this i used the
Hi,
I wouldn't know how to fill the data into the array form you want, but
you can get the aggregated data with
dfm - melt( df )
dfc - cast( dfm, LOC ~ variable, sum )
dfc
LOC SPEC1 SPEC2
1 123 5
2 223 2
3 3 0 0
Hope this helps as a first step!
Rgds,
Rainer
Coming from a different angle: The LaTeX beamer class comes with the
capability to produce different sets of documents from the same master
file (presentation, handout, article...). That could get you where you want.
For sweave questions, you may want to look at
... or perhaps some other CRAN package has already gone in
this direction.
The tableGrob function in the gridExtra package probably is one of them.
Original-Nachricht
Datum: Wed, 7 Dec 2011 19:29:54 -0500
Von: Gabor Grothendieck ggrothendi...@gmail.com
An: Duncan Murdoch
You have a dot (not a comma) after 8:
seq(2,8.1,length.out=3)
^
Rgds,
Rainer
On Wednesday 23 November 2011 06:59:12 Czerminski, Ryszard wrote:
Is there any rational explanation for the bizarre seq() behavior below?
seq(2,8.1, lenght.out=3)
[1] 2 3 4 5 6 7 8
help(seq)
...and a spelling mistake in your first line (lenght instead of length)...
On Wednesday 23 November 2011 06:59:12 Czerminski, Ryszard wrote:
Is there any rational explanation for the bizarre seq() behavior below?
seq(2,8.1, lenght.out=3)
[1] 2 3 4 5 6 7 8
help(seq)
Being new to R myself, I always get trapped by factors. Taking the data you
have provided, this worked for my understanding of your intention:
x - rep( 0, 4 )
x
[1] 0 0 0 0
df - data.frame( matrix( x, 1 ), stringsAsFactors = FALSE )
df
X1 X2 X3 X4
1 0 0 0 0
is.character( df[1,1] )
[1]
n = 2
sort( rep( seq(as.Date(2000/1/1), by=month, length.out=3), n ) )
It works if you separate the print command and put the caption placement in
the print command
, see below:
\documentclass[11pt,a4paper]{article}
\usepackage{Sweave}
\begin{document}
=
x = runif(100, 1, 10)
y = 2 + 3 * x + rnorm(100)
@
echo=FALSE,results=tex=
library(xtable)
p -
nchar()
[1] 0
On Friday 18 November 2011 16:09:38 Jaensch, Steffen [TIBBE] wrote:
Hi all,
Can somebody
Does
library( stringr )
str_extract( mena, m5[0-9] )
achieve what you are looking for?
Rgds,
Rainer
On Monday 14 November 2011 10:22:09 Petr PIKAL wrote:
Hi
On 11/14/2011 07:45 PM, Petr PIKAL wrote:
Dear all
I am again (as usual) lost in regular expression use for
selection.
On Friday 28 October 2011 18:04:59 Vinny Moriarty wrote:
Thanks everyone for you help with my last question, and now I have one
last one...
Here is what I would do, based on my understanding of your question:
# your data snippet as data frame
x
site time_localtime_utc
From ?read.csv:
read.csv2( file, header = TRUE, sep = ;, quote=\, dec=,,
fill = TRUE, comment.char=, ...)
I think this is specifically set up for German decimal commas.
Rgds,
Rainer
On Thursday 06 October 2011 17:39:46 Anna Lee wrote:
Hello everyone!
I work with a german excell
m - matrix( rep( y, length( x ) ), length( y ), length( x ) )
On Wednesday 05 October 2011 18:11:18 fernando.cabr...@nordea.com wrote:
Hi guys
I have vectors x - c(1,2,3,4) and y - c(4,3,9) and would like to generate a
matrix which has 3 rows (length(y)) and 4
columns (length(x)), and
Any comments are very welcome,
So I give it a shot, although I don't have answers but only some ideas which
avenues I would explore, not being an
expert at all:
1. I would try to be more restrictive with the columns used for merge, trying
something like
m1 - merge( x, y, by.x = V1, by.y = V1,
I haven't tested it thoroughly but what worked here is replacing
download.file(url, destfile, quiet = FALSE)
with
sys_call - paste( wget, url, , destfile, sep= )
system( sys_call )
Program execution continues, whether or not the download from url was
successful. However, wget is, I believe,
That looks like a perfect job for (g)awk which is in every Linux distribution
but also available for Windows.
It can be called with something like
system( awk -f script.awk inputfile.txt )
and does its job silently and very fast. 650MB should not be an issue. I'm not
proficient in awk but
Does that help:
x
xin xout
1 1 14
2 85
3 16 884
4 1 14
5 85
6 16 884
subset( x, x$xin 7, select = xout )
Not sure whether I understand your question right but here is what I would do:
# Sample data
x - seq( 1, 100, by=6)
x
[1] 1 7 13 19 25 31 37 43 49 55 61 67 73 79 85 91 97
# remove element with value 19
x - x[ x != 19 ]
x
[1] 1 7 13 25 31 37 43 49 55 61 67 73 79 85 91 97
If you want to
In Excel, make sure that your data has a format that corresponds to an R data
frame (first row with column names, consistent column size and data type).
Export your .XLS worksheet as .CSV file (mydata.csv).
In R, read it into a data frame with
read.csv( mydata.csv )
From here, you shold be
cran.r-project.org/doc/manuals/R-intro.pdf
cran.r-project.org/doc/contrib/Paradis-rdebuts_en.pdf
cran.r-project.org/doc/contrib/Verzani-SimpleR.pdf
cran.r-project.org/doc/contrib/Lemon-kickstart/kr_intro.html
https://stat.ethz.ch/mailman/listinfo/r-help
On Thursday 21 July 2011 10:46:43 Varsha
For me, this works:
Now, I want to add a 4th column, trend
pricedata$trend - 0
which can have 2 values 0 or 1. if return1%, trend=1 else trend=0.
pricedata$trend - ifelse( pricedata$return .01, 1, 0 )
Rgds,
Rainer
On Thursday 21 July 2011 19:39:15 financial engineer wrote:
hi,
Can
Can you explain a little more?
I have created a small CSV file following your pattern which looks like this in
a text editor:
A,B,C,D,E
65,68,71,74,77
67,71,75,79,83
69,73,77,81,85
71,77,83,89,95
When I load it into R with
x - read.csv( a.csv )
I get this which I think is what you would
It may be helpful to make sure that, in the dialog that pops up when saving a
spreadsheet to CSV, the option Save cell content as shown is checked - that
would leave numbers as numbers, not wrapping them in . That has helped me at
least in a similar situation!
Rgds,
Rainer
On Tuesday 12 July
On Saturday 02 July 2011 21:40:24 Trying To learn again wrote:
Clumsy but it works (replace the bingo stuff with what you want to do next):
x - as.matrix( read.table( input.txt) )
xdim - dim( x )
ix - xdim[ 1 ]
jx - xdim[ 2 ] - 2
bingo - 0
for( i in 1:ix )
{
for( j in 1:jx )
{
if(
Sorry, I forgot to attach the original post, so here once more with a cosmetic
change:
x - as.matrix( read.table( matr.txt) )
bingo - 0
for( i in 1:dim( x )[1] )
{
for( j in 1:dim( x )[2] - 2 )
{
if( x[i,j] == 8 x[i,j+1] == 9 x[i,j+2] == 2 )
{
bingo - bingo + 1
}
}
}
Tell PDF the size of your piece of paper - here is what works for me:
pdf( file = result.pdf, width = 28, height = 18 ) # numbers are cm
some( stuff )
dev.off()
Hope it helps,
Rainer
On Saturday 25 June 2011 18:46:28 Juan Andres Hernandez wrote:
Does anybody know how to get a pdf
On Thursday, January 27, 2011 08:57:01 am 刘力平 wrote:
who sincerely thinks R is not google friendly, since R is a
awful keyword.
http://www.rseek.org/
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the
On Monday, January 24, 2011 07:18:03 pm Alaios wrote:
Hello :)
I wanted to right an expression to check when x and y have the same sign
and I wrote the following:
if ((x0 y0) || (x0 y0))
which looks pretty ugly to me.
Can you please suggest me a better way for that?
Regards
Altogether I got five more or less silly solutions (not my judgment!), some of
them further discussed in private mail, for a problem where my expectation was
to get a simple one-liner back: Check ?clt or so...
Fortunately, with all of them I seem to arrive at a result that is consistent
with
This is probably embarrassingly basic, but I have spent quite a few hours in
Google and RSeek without getting a clue - probably I'm asking the wrong
questions...
There is this guy who has decided to walk through Australia, a total distance
of 4000 km. His daily portion (mean) is 40km with an
^-))
2
On Saturday 08 January 2011 14:56:20 you wrote:
On Jan 8, 2011, at 6:56 AM, Rainer Schuermann wrote:
This is probably embarrassingly basic, but I have spent quite a few
hours in Google and RSeek without getting a clue - probably I'm
asking the wrong
If your OS is Linux, you might want to look at sed or gawk. They are very good
and efficient for such tasks.
You need it once or as a part of program?
Some samples would be helpful...
Rgds,
Rainer
Original-Nachricht
Datum: Wed, 15 Dec 2010 16:55:26 +0800
Von: Luis Felipe
1 - 100 of 104 matches
Mail list logo