Displaying 20 results from an estimated 4000 matches similar to: "Problem reading a CSV"
2008 Jul 01
3
Change name of a specific column of a data frame
Hi,
Sorry for the simple question. Is there a way to change the name of only one
column of an existing data frame?
I know colnames allows you to set the name of all the columns, but only one
column in the middle of my data frame needs a new name.
Thanks,
-Nina
2008 Jul 01
3
Ignore blank columns when reading a row from a table
Hi,
I am extracting data from a table where the rows have different column lengths,
and empty columns have NA in them. Whenever I extract a row with some empty
columns, the resulting vector carries all the NAs. Is there a way to ignore the
empty columns?
Thanks,
-Nina
2008 Jul 17
3
Display variables when running a script
Hi,
I know this must be a stupid question, and sorry in advance for being such a
noob. But, is there way to get R to display only certain variables when running
a script. I know if you want to see the value of a variable when using the
interface, you just type it in and hit enter, but is there a command that I can
use in a script file that will show the value at a certain point?
Thanks,
-Nina
2008 Jul 02
2
Problem reading from a data frame
Hi,
I have a data frame with strings that have two letters and four numbers. When I
store a whole row as a new vector and try to remove the preceding letters using
the gsub command, it returns characters of single numbers that have no relation
to the numbers in each string. I also noticed that when I view the new vector
before using gsub, it includes the original headers from the data frame. For
2008 Jul 22
2
Decoding subscripts/superscripts from CSVs
Hi,
I have a CSV file with various biological reactions. Subscripts, superscripts,
and italics are encoded in carats, and I was wondering if R can actually
recognize those and print actual superscripts, etc. Here's an example:
<i>S</i>-adenosyl-L-methionine + rRNA = <i>S</i>-adenosyl-L-homocysteine +
rRNA containing
2008 Jul 24
2
Help with which()
Hi,
I'm using which to find the position of a value in my data table, and it is
returning the correct position and the position of another number that differs
by an extra decimal place. For example, when I do:
where1<-which(Operons==3573.1,arr.ind=TRUE)
it returns the position of that number and of 3573.15.
Is it possible to get the function to only return a position if the number
2008 Jun 10
1
Really simple question
Hi,
I don't have too much programming experience - sorry in advance if this question
is very basic, and thanks for the help.
I have a vector of numbers and another vector of a subset of those numbers. How
can I create a third vector with all the numbers in the original list that
aren't in the given subset. Like this:
List1 subset --> result
1 1 2
2 3
3 4
2008 Jun 11
1
Search entire table for a value
Hi,
I have a table of numbers without any repeats. Is there a function that will
search the entire table for a specified value and return the indices if it is
found? Also, some rows may have columns without values.
Thank you so much,
-Nina
2008 Jun 18
1
Extract only certain rows from a table
Hi,
I have a table where column 1 has ID numbers and column two has data, and I have
a vector containing a subset of those ID numbers. How can I create a new table
with only the rows from the old table that match the IDs in the vector, like
below:
Original Table:
ID Value
1 123
2 123
3 123
4 123
vect: [2, 3]
New table:
ID Value
2 123
3 123
2008 Jun 27
1
Error reading a table
Hi,
I get the following error when I try to read in a CSV file:
> Path<-read.table('MetaCycSample2.csv',sep=',', header=FALSE)
Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, :
line 17 did not have 5 elements
Some of the rows have more columns than others. Also when I try the read.csv
command, the very last column, which only has one cell
2008 Jul 14
1
Help with an error message
Hi,
I am writing a very long program that deals with multiple large databases which
often have missing data cells and other quirks. I've been testing it on small
samples of the data so it doesn't take too long, but when I tried it using the
real files, it ran for about a minute and then gave me this error message:
Error in matrix(unlist(value, recursive = FALSE, use.names = FALSE), nrow
2008 Jul 30
1
Converting to subscripts and superscripts
Hi,
I am reading in a CSV file of chemical reactions where the subscripts and
superscripts are encoded in angle brackets, like below:
2 H<SUP>+</SUP> + 2 O<SUB>2</SUB><SUP>-</SUP>
Is there a way to convert these to actual sub/superscripts and save them in
another excel file? I greatly appreciate the help!
Thanks,
-Nina
PS. I asked this before, but I
2008 Jul 25
1
Insert rows into a pre-existing data frame
Hi,
I'm sorry if this is a simple question. How do you insert a blank row into a
data frame? I basically need to do this:
old table: new table:
C1 C2 C3 C1 C2 C3
1 32 34 1 32 34
2 52 23 54
2 52 23
2008 Sep 16
1
plotting on the figure margin
Dear R-list members,
I am trying to put a legend just outside the plotting area
of a graph.
1. Is there some way to plot symbols on the figure margin,
in the same way as function "mtext" can write on the
margin?
2. Is there some way to use the "legend" function (or some
equivalent function) to plot a legend on the figure margin?
3. Any other way to plot either symbols or a
2008 Aug 21
2
barplot with anchored bars
Dear R list members,
How to produce barplots anchored to the x-axis (not floating
above the x-axis) with a box around?
With both following codes, the lower horizontal line of the
box is below the y = 0 line:
# first code
x <- c(1,2,3,4)
barplot(x,yaxs='i')
box()
# second code
x <- c(1,2,3,4)
op <- par(yaxs='i')
barplot(x)
box()
par(op)
The parameter yaxs='i'
2008 Dec 21
1
function prop.trend.test (stats)
To the R-help list,
In the documentation of the prop.trend.test function in the
stats package, no bibliography has been provided which
would allow one to find out the theoretical basis of that
function and/or details of its implementation.
May I suggest that some bibliography be included, as it
generally happens with other statistical functions.
I currently use R 2.8.0 running on Windows XP.
2006 Nov 22
3
saving graphics in jpeg format
Dear R users,
I need to save a graph in jpeg format. After plotting the graph,
when the graphics window is active, in the File menu, the
Save as / Jpeg / 100% quality correctly saves the graph in jpeg format.
But I would like to know, how could I control the resolution (in dpi)
of the saved jpeg file? I need to produce a jpeg at 1200 dpi.
I have tried also the jpeg function in the package
2006 Aug 08
1
parameter yaxs / function hist (graphics)
Dear R users,
The parameters xaxs and yaxs (function par, package graphics)
seem not to work with the function hist (package graphics),
even when the parameters xlim and ylim are defined.
Is there any way to make yaxs="i" and xaxs="i" work properly
with the function hist, mainly to produce histograms that
"touch" the horizontal axis? The R documentation and the
R
2010 Apr 22
1
packages gdata / gtools - installation in R 2.11.0
Dear R-list members,
I have just downloaded R version 2.11.0. Then I installed
package gdata. At the end of the installation, a warning message
said that package gtools could not be found. Package gdata
was, after the installation, included in the "Package Index"
in the help files. Messages during installation (which was made
through the menu Packages / Instal package(s), choosing the
2012 Jul 15
5
variable (column) in a data frame
To the R help list,
When using a data frame, there is no warning or error message
when I refer to a non-existent variable inside the data frame.
Example:
##----------------------------------------------
a <- c(1,2,3)
b <- c(11,22,33)
df <- data.frame(a,b)
df
## correct: there is a column in df named 'a'
## the sum is correctly performed
sum(df$a==2)
## incorrect: there is