Displaying 20 results from an estimated 10000 matches similar to: "ordering a data frame to same order as a chr vector"
2005 May 25
3
Rounding fractional numbers to nearest fraction
Hi all,
I've got a matrix of fractional data that is all positive and greater than
zero that I would like to "loosely" classify, for lack of a better word. It
looks something like this :
1.07 1.11 1.27 1.59 0.97 0.76
2.23 0.98 0.71 0.88 1.19 1.02
What I'm looking for is a way to round these numbers to the nearest 0.25,
i.e. the above matrix would be
2005 Oct 03
3
Problem building/checking library that requires input from user
Hi all,
I've got a package i've written that i am trying to check, build, and
install. This is my 1st time doing this, so apologies in advance... ;)
The package that I've written requires input from the user. It needs to know
sample sizes and then runs some calcs, (sample sizes are just integers), and
it gets this info from the user as
num_reps <- readline("How many reps
2005 Oct 11
4
Any way to add to data frame saved as .rData file?
Hi all,
I've got a script that generates a few moderate-size data frames, and then
puts them together into one big data frame at the end in order to write that
data frame to disk, so that it may be re-opened later on...
I'm trying to trim down memory requirements in this script, so I was
wondering if there was any way to append to a data frame already saved on
disk (just like
2005 Jun 09
1
Help with SOM membership
Hi all,
I originally posted this to the bioconductor group, but maybe it's better
suited to the r-help...
I'm using som() to partition samples of gene expression data into clusters.
The point is to classify control vs. experimental cases (sample clustering).
The original matrix was 22283 x 8. The 8 samples have 4 controls and 4
experimentals.
I transposed the matrix so that its dim
2005 Jul 11
2
Isolating string containing only file name from complete path
Hi all,
What I'd like to do is to is to be able to extract a string corresponding to
only the file name from a string containing the complete path, i.e. from the
following path string:
"/Users/ken/Desktop/test/runs/file1"
I would like to end up with:
"file1"
This would be most ideally done in a platform-independent way.
Thanks in advance,
-Ken
2010 Jan 16
1
order() fails on a chr object of class "AsIs" with "\265" in it
Here's an example (session info at the end).
> tmpv <- c('\265g/L','Bq/L')
> order(tmpv)
[1] 2 1
> tmpv <- I(tmpv)
> order(tmpv)
Error in if (xi > xj) 1L else -1L : missing value where TRUE/FALSE needed
> foov <- gsub('\265','',tmpv)
> order(foov)
[1] 2 1
> str(tmpv)
Class 'AsIs' chr [1:2] "\265g/L"
2003 Nov 05
3
How to represent pure linefeeds chr(10) under R for Windows
I need to write out with write.table() a csv file allowing for line feeds
(pure chr(10)) as part of character field (not as a line seperator).
How can I do that?
Best regards
Jens Oehlschl?gel
--
2003 Nov 06
2
Summary: How to represent pure linefeeds chr(10) under R for Windows
Thanks to all who have responded.
My concern was to be able to write a csv file that can have line feeds in
string columns chr(10).
Why? Excel allows line feeds chr(10) within cells and line breaks
chr(13)+chr(10) at line ending,
but the windows version of R automatically replaces \n by \r\n in writing
and \r\n by \n in reading (text mode).
The clues for a solution came from Brian Ripley and
2005 Apr 08
1
Princomp$Scores
Hi all,
I was hoping that someone could verify this for me-
when I run princomp() on a matrix, it is my understanding that the scores
slot of the output is a measure of how well each row correlates (for lack of
a better word) with each principal component.
i.e. say I have a 300x6 log2 scaled matrix, and I run princomp(). I would
get back a $scores slot that is also 300x6, where each value
2010 Sep 21
1
reshape is re-ordering my variables
Is it an undocumented (at least I missed it if it's documented) feature
of the reshape function to do numeric variables followed by character?
I ask because that seems to be the case below.
> str(rcw)
'data.frame': 23 obs. of 21 variables:
$ ICU : int 1 18 17 9 22 19 6 16 25 26 ...
$ Q6.RC.1 : chr "SM" "JF" "IW"
2005 Dec 14
2
memory tops out at 1.84gb on OS X 10.4 machine w/ 5GB ram
Hi all,
Sorry if this is a dumb question, but I am on 10.4 with R2.2, and when
loading a big text file (~500MB) with scan(file, what=character) I am
throwing malloc errors that say I am out of memory...I have 5GB on this
machine, and Activity Monitor tells me R is only up to ~1.84GB both times
this has happened (running from terminal)...
I am wondering why this is happening when I still have
2013 Sep 02
1
Convert chr pieces to numbers that have specific values defined by 2 vectors
Dear all,
I think this is an easy task, but I don't know how to do it. Specifically, I have 69 columns with 300.000 rows. In each cell there is a code like
"2E3", "4RR", etc.
I now have a list that replaces this with values, e.g.,
old new
2E3 5
4RR 3
etc.
The list ist about 1600 rows long, so also to extensive for normal solutions
Do you how to do that? It would
2003 May 30
2
Rsyncing Problem with - character!
Dear Rsync Users,
Please can I have a bit of rsync advice?
I am trying to rsync a file called.
'Draft text - with Holley comments.doc' from machine a to machine b.
Unfortunately this isn't working because I think rsync recognises the -
character and thinks it's an option.
I have tried escaping this out as well as putting it all in " " but
neither seems to work
2011 Feb 09
1
Adding labels into lattice's barchart
*** APOLOGIZES FOR THOSE READING THE LIST THROUGH NABBLE THIS WAS ALREADY POSTED THERE BUT NOT FORWARDED TO THE LIST FOR SOME UNKNOWN REASON ***
I have a dataset that looks like:
$ V1: factor with 4 levels
$ V2: factor with 4 levels
$ V3: factor with 2 levels
$ V4: num (summing up to 100 within V3 levels)
$ V5: num (nr of cases for each unique combination of V1*V2*V3 levels)
Quite new to
2006 Oct 06
1
sparklines in lattice
Dear R-help,
Has anyone implemented sparklines in the strips of a lattice plot? What I have in mind is, say, highlighting that part of a time series that one is examining in more detail in a set of lattice plots.
Regads,.
Mark Difford.
PS: (Andreas Loffler has implemented a simple but functional version for
TeX/LaTeX:
http://www.tug.org/tex-archive/help/Catalogue/entries/sparklines.html)
2013 Jan 02
2
Read many cvs files
Hello R helpers,
I would like to automate this code for many files of the same type. But I
don´t know how to make it. In particular, i don´t know how to read many
files each one as an r object with the name of the file. Then a for loop
would be sufficient, right?
Many thanks and a happy new year.
Dominic
datos <- read.table('global2001.csv',head=T,sep=';',stringsAsFactors=F)
2011 Apr 19
1
How to Extract Information from SIMEX Output
Below is a SIMEX object that was generated with the "simex" function from the
"simex" package applied to a logistic regression fit. From this mountain of
information I would like to extract all of the values summarized in this
line:
.. ..$ variance.jackknife: num [1:5, 1:4] 1.684 1.144 0.85 0.624 0.519 ...
Can someone suggest how to go about doing this? I can extract the
2012 Oct 02
1
ffsave problems
Dear R friends.
After having some troubles learning how to create a ffdf object, now I find
myself having problems saving it.
this is the data i´d like to save:
str(DATA)
List of 3
$ virtual: 'data.frame': 6 obs. of 7 variables:
.. $ VirtualVmode : chr "double" "short" "integer" "integer" ...
.. $ AsIs : logi FALSE FALSE FALSE
2003 Sep 03
1
Last line in .Rprofile must have newline (PR#4056)
Full_Name: Henrik Bengtsson
Version: R v1.7.1
OS: WinXP Pro, Solaris 9
Submission from: (NULL) (130.235.2.229)
A colleague of mine who is new to R had problems setting up his .Rprofile and we
tracked it down to the following. On both WinXP and Solaris with Rv1.7.1 we
noticed that the *last* line in .Rprofile has to have a *newline* to be
evaluated. For instance, starting R with the following
2010 Sep 16
2
problem reading Matlab file into R
Hi,
I'm trying to read a .mat file into R (2.11.1) with medium success so far. The file I have is a MATLAB 5.0 MAT-file exported from RiverSurveyor LIVE software (http://www.sontek.com/software.php). I have R.matlab and Rcompression installed and readMat() starts reading the file, as can be seen in verbose mode (hence medium success), but then gives the following error:
Error in dim(matrix)