R中直方图的binwidth

时间:2018-11-13 00:06:17

标签: r

到目前为止,这是我的程序。我需要让用户接下来输入自己的绑定宽度,但我不知道该怎么做。

file.name <- readline('Please enter name and file location: ')
has.header <- readline('Does your data file contain a header (Y/N)? ')

if (has.header == 'Y')
{
  file.df <- read.table( file = file.name, sep=',', header = TRUE)
}else
{
  file.df <- read.table ( file = file.name, sep=',', header = FALSE)
}
cat('\n')
print(file.df)
cat('\n')

#Histogram 
print(head(file.df))
column <- as.numeric(readline('What column do you want to graph (enter           number)? '))
print(hist(file.df[ ,column]))

#New bin width
binsize <- readline("Enter a new bin width for your graph: ")

1 个答案:

答案 0 :(得分:0)

/etc/hosts